|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
-
- #ifndef control_ak4558_h_
- #define control_ak4558_h_
-
- #include "AudioControl.h"
-
- #define AK4558_SERIAL_DEBUG 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #ifndef PIN_PDN
- #define PIN_PDN 1
- #endif
-
-
-
-
- #ifndef AK4558_CAD1
- #define AK4558_CAD1 1
- #endif
-
-
-
- #ifndef AK4558_CAD0
- #define AK4558_CAD0 1
- #endif
-
-
-
- #define AK4558_I2C_ADDR (0x10 + (AK4558_CAD1<<1) + AK4558_CAD0)
-
-
-
-
-
-
-
- #define AK4558_PWR_MNGT 0x00
-
-
- #define AK4558_PMADR (1u<<4)
- #define AK4558_PMADL (1u<<3)
-
-
-
- #define AK4558_PMDAR (1u<<2)
- #define AK4558_PMDAL (1u<<1)
-
-
-
- #define AK4558_RSTN (1u)
-
-
-
-
-
-
- #define AK4558_PLL_CTRL 0X01
-
-
- #define AK4558_PLL3 (1u<<4)
- #define AK4558_PLL2 (1u<<3)
- #define AK4558_PLL1 (1u<<2)
- #define AK4558_PLL0 (1u<<1)
-
-
- #define AK4558_PMPLL (1u)
-
-
-
-
-
-
- #define AK4558_DAC_TDM 0X02
-
-
- #define AK4558_SDS1 (1u<<1)
- #define AK4558_SDS0 (1u)
-
-
-
-
-
- #define AK4558_CTRL_1 0X03
-
-
- #define AK4558_TDM1 (1u<<7)
- #define AK4558_TDM0 (1u<<6)
-
-
- #define AK4558_DIF2 (1u<<5)
- #define AK4558_DIF1 (1u<<4)
- #define AK4558_DIF0 (1u<<3)
-
-
- #define AK4558_ATS1 (1u<<2)
- #define AK4558_ATS0 (1u<<1)
-
-
- #define AK4558_SMUTE (1u)
-
-
-
-
-
-
- #define AK4558_CTRL_2 0X04
-
-
- #define AK4558_MCKS1 (1u<<4)
- #define AK4558_MCKS0 (1u<<3)
-
-
-
-
-
-
- #define AK4558_DFS1 (1u<<2)
- #define AK4558_DFS0 (1u<<1)
-
-
- #define AK4558_ACKS (1u)
-
-
-
-
-
-
-
-
-
- #define AK4558_MODE_CTRL 0X05
-
-
- #define AK4558_FS3 (1u<<6)
- #define AK4558_FS2 (1u<<5)
- #define AK4558_FS1 (1u<<4)
- #define AK4558_FS0 (1u<<3)
-
-
- #define AK4558_BCKO1 (1u<<2)
- #define AK4558_BCKO0 (1u<<1)
-
-
- #define AK4558_LOPS (1u<<0)
-
-
-
-
-
-
- #define AK4558_FLTR_SET 0x06
-
-
- #define AK4558_FIRDA2 (1u<<7)
- #define AK4558_FIRDA1 (1u<<6)
- #define AK4558_FIRDA0 (1u<<5)
-
-
- #define AK4558_SLDA (1u<<4)
-
-
-
- #define AK4558_SDDA (1u<<3)
-
-
-
- #define AK4558_SSLOW (1u<<2)
-
-
-
- #define AK4558_DEM1 (1u<<1)
- #define AK4558_DEM0 (1u)
-
-
-
-
-
- #define AK4558_HPF_EN_FLTR_SET 0x07
-
-
- #define AK4558_SLAD (1u<<3)
-
-
-
- #define AK4558_SDAD (1u<<2)
-
-
-
- #define AK4558_HPFER (1u<<1)
- #define AK4558_HPFEL (1u)
-
-
-
-
-
-
- #define AK4558_LOUT_VOL 0X08
-
-
-
-
-
-
-
-
- #define AK4558_ROUT_VOL 0X09
-
-
-
-
-
-
- class AudioControlAK4558 : public AudioControl
- {
- public:
- bool enable(void);
- bool enableIn(void);
- bool enableOut(void);
- bool disable(void) { return (disableIn()&&disableOut()); }
- bool disableIn(void);
- bool disableOut(void);
- bool volume(float n);
- bool volumeLeft(float n);
- bool volumeRight(float n);
- bool inputLevel(float n) { return false; }
- bool inputSelect(int n) { return false; }
- private:
- uint8_t registers[10];
- void initConfig(void);
- void readConfig(void);
- bool write(unsigned int reg, unsigned int val);
- uint8_t convertVolume(float vol);
- };
-
- #endif
|