Added recording mode to detect volumes.
This commit is contained in:
@ -4,7 +4,6 @@
|
||||
#include <SD.h>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <Adafruit_MCP23017.h>
|
||||
#include "spi_master.h"
|
||||
|
||||
#define SCI_MODE 0x00
|
||||
@ -15,20 +14,28 @@
|
||||
#define SCI_VOL 0x0B
|
||||
#define SCI_WRAMADDR 0x07
|
||||
#define SCI_WRAM 0x06
|
||||
#define SCI_HDAT0 0x08
|
||||
#define SCI_HDAT1 0x09
|
||||
#define SCI_AICTRL0 0x0C
|
||||
#define SCI_AICTRL1 0x0D
|
||||
#define SCI_AICTRL2 0x0E
|
||||
#define SCI_AICTRL3 0x0F
|
||||
|
||||
#define CMD_WRITE 0x02
|
||||
#define CMD_READ 0x03
|
||||
|
||||
#define ADDR_ENDBYTE 0x1E06
|
||||
|
||||
#define SM_RESET 0x0004
|
||||
#define SM_CANCEL 0x0008
|
||||
#define SM_ADPCM 0x1000
|
||||
#define SS_DO_NOT_JUMP 0x8000
|
||||
|
||||
class Player {
|
||||
private:
|
||||
enum state { uninitialized, idle, playing, stopping,
|
||||
system_sound_while_playing, system_sound_while_stopped,
|
||||
sleeping };
|
||||
sleeping, recording };
|
||||
struct album_state {
|
||||
uint8_t index;
|
||||
uint32_t position;
|
||||
@ -39,6 +46,7 @@ private:
|
||||
void _wait();
|
||||
uint16_t _read_control_register(uint8_t address);
|
||||
void _write_control_register(uint8_t address, uint16_t value);
|
||||
void _write_direct(uint8_t address, uint16_t value);
|
||||
void _write_data(uint8_t* data);
|
||||
uint16_t _read_wram(uint16_t address);
|
||||
state _state = state::uninitialized;
|
||||
@ -58,6 +66,8 @@ private:
|
||||
void _unmute();
|
||||
void _sleep();
|
||||
void _wakeup();
|
||||
void _record();
|
||||
void _patch_adpcm();
|
||||
void _speaker_off();
|
||||
void _speaker_on();
|
||||
|
||||
|
Reference in New Issue
Block a user