upd
This commit is contained in:
+60
-1
@@ -6,7 +6,6 @@
|
||||
// ----------------------
|
||||
// I2C
|
||||
// ----------------------
|
||||
#define ES8311_I2C_ADDR 0x18
|
||||
|
||||
// ----------------------
|
||||
// System
|
||||
@@ -64,6 +63,58 @@
|
||||
#define ES8311_RESET_CMD 0x1F
|
||||
#define ES8311_ALL_ON 0xFF
|
||||
|
||||
|
||||
// ----------------------
|
||||
// Clock Management Values
|
||||
// ----------------------
|
||||
#define ES8311_CLK_ALL_EN 0x3F // Enable all clocks
|
||||
#define ES8311_CLK_DIV_DEFAULT 0x00 // Default divider
|
||||
|
||||
// ----------------------
|
||||
// Power Analog Values
|
||||
// ----------------------
|
||||
#define ES8311_PWR_ANALOG_OFF 0x00 // All analog blocks off
|
||||
#define ES8311_PWR_ANALOG_ON 0xBF // Power up analog circuits
|
||||
|
||||
// ----------------------
|
||||
// ADC Control Values
|
||||
// ----------------------
|
||||
#define ES8311_ADC_CTRL1_DEFAULT 0x44 // TODO: Document bit meanings
|
||||
#define ES8311_ADC_CTRL2_DEFAULT 0x0C // TODO: Document bit meanings
|
||||
|
||||
// ----------------------
|
||||
// DAC Control Values
|
||||
// ----------------------
|
||||
#define ES8311_DAC_CTRL1_DEFAULT 0x04 // TODO: Document bit meanings
|
||||
#define ES8311_DAC_CTRL2_DEFAULT 0x0C // TODO: Document bit meanings
|
||||
|
||||
// ----------------------
|
||||
// Output Control Values
|
||||
// ----------------------
|
||||
#define ES8311_HP_CTRL_DEFAULT 0xF0 // TODO: Document bit meanings
|
||||
#define ES8311_SPK_CTRL_MAX 0xFF // Maximum speaker output
|
||||
|
||||
// ----------------------
|
||||
// Volume Defaults
|
||||
// ----------------------
|
||||
#define ES8311_DAC_VOL_DEFAULT 0xBF // ~75% volume
|
||||
#define ES8311_ADC_VOL_DEFAULT 0x88 // ~50% gain
|
||||
|
||||
// ----------------------
|
||||
// Timing Constants (milliseconds)
|
||||
// ----------------------
|
||||
#define ES8311_RESET_DELAY_MS 20
|
||||
#define ES8311_POWER_DELAY_MS 10
|
||||
#define ES8311_STARTUP_DELAY_MS 50
|
||||
|
||||
// ----------------------
|
||||
// Beep Configuration
|
||||
// ----------------------
|
||||
#define ES8311_BEEP_DURATION_SAMPLES 4410 // 100ms at 44.1kHz
|
||||
#define ES8311_BEEP_AMPLITUDE 12000 // ~36% of 16-bit max
|
||||
#define ES8311_BEEP_HALF_PERIOD 20 // ~2.2kHz tone
|
||||
|
||||
|
||||
void es8311_init(void);
|
||||
|
||||
void es8311_set_dac_volume(uint8_t vol);
|
||||
@@ -74,3 +125,11 @@ int audio_write(const int16_t *samples, size_t count);
|
||||
int audio_read(int16_t *samples, size_t count);
|
||||
|
||||
void audio_beep(void);
|
||||
|
||||
void audio_test_tone(void);
|
||||
|
||||
int es8311_write(uint8_t reg, uint8_t val);
|
||||
|
||||
uint8_t es8311_read(uint8_t reg);
|
||||
|
||||
void es8311_verify_init(void);
|
||||
|
||||
Reference in New Issue
Block a user