11#ifdef USE_BINARY_SENSOR
72 "enum FaultSensor altered: Update FAULT_SENSORS in binary_sensor.py and fault_sensor_bits in each model's cpp");
75static constexpr uint8_t NO_BIT = 0xFF;
77static constexpr uint8_t FAULT_OUTPUT_NONE = 0xFF;
85 const LogString *(*name)();
102 const LogString *(*fault_name)(uint8_t index);
108 const LogString *(*fault_output_name)(uint8_t pin);
111#ifdef USE_TAS58XX_TAS5805M
114#ifdef USE_TAS58XX_TAS5825M
122 void setup()
override;
155 void apply_mixer_mode(
MixerMode mixer_mode);
158#ifdef USE_BINARY_SENSOR
167 void set_active(
bool active) {
197#ifdef USE_BINARY_SENSOR
This class simplifies creating components that periodically check a state.
This Class provides the methods to read/write bytes from/to an i2c device.
binary_sensor::BinarySensor * sensor
void set_analog_gain(float analog_gain_db)
SUB_BINARY_SENSOR(have_fault) void set_fault_binary_sensor(FaultSensor fault
SUB_SWITCH(activate) void set_active(bool active)
The activate switch: on activates the amplifier (play), off puts it into deep sleep.
SUB_SELECT(mixer_mode) void apply_mixer_mode(MixerMode mixer_mode)
Change input mixer; except if invalid for dac_mode. Written immediately if playing,...
void set_modulation(Modulation modulation)
void set_dac_mode(DacMode dac_mode)
void publish_active_(bool active)
Publish the activate switch state, if there is one.
bool set_mute_(bool muted)
void set_fault_output(uint8_t pin)
pin: 0 to 2 for GPIOn on TAS5825M, 0 for ADR on TAS5805M; leave unset for no fault output
void set_volume_min_db(float volume_min_db)
void set_mixer_mode(MixerMode mixer_mode)
void write_dsp_()
Write DSP settings not written since last reset; call only while DSP is writable.
float get_setup_priority() const override
bool set_mute_off() override
void set_enable_pin(GPIOPin *enable_pin)
std::array< binary_sensor::BinarySensor *, FAULT_SENSOR_COUNT > fault_binary_sensors_
void publish_mixer_mode_()
Show current mixer mode on mixer mode select.
TAS58xx(const ModelInfo *model)
void dump_config() override
void set_volume_max_db(float volume_max_db)
bool set_volume(float volume) override
bool read_power_state_(uint8_t &power_state)
Read POWER_STATE, masked to device state; false if read failed.
bool write_ctrl_state_(uint8_t state, bool muted)
void activate()
Clear faults, leave deep sleep and switch to play; the device waits in Hi-Z until an I2S clock is pre...
void deactivate()
Switch to deep sleep, the lowest power state that keeps I2C and the DSP running.
void on_audio_started() override
uint8_t fault_output_pin_
bool set_mute_on() override
bool select_book_page_(uint8_t book, uint8_t page)
constexpr float IO
For components that represent GPIO pins like PCF8573.
Modulation
DEVICE_CTRL_1 DAMP_MOD values, the same on all models.
const ModelInfo TAS5805M_MODEL
const ModelInfo TAS5825M_MODEL
FaultSensor
Fault binary sensors that map to a single fault bit.
@ FAULT_SENSOR_RIGHT_CHANNEL_OVER_CURRENT
@ FAULT_SENSOR_LEFT_CHANNEL_CBC_OVER_CURRENT
@ FAULT_SENSOR_BQ_WRITE_FAILED
@ FAULT_SENSOR_RIGHT_CHANNEL_CBC_OVER_CURRENT_WARNING
@ FAULT_SENSOR_OVER_TEMP_SHUTDOWN
@ FAULT_SENSOR_LEFT_CHANNEL_DC_FAULT
@ FAULT_SENSOR_RIGHT_CHANNEL_DC_FAULT
@ FAULT_SENSOR_RIGHT_CHANNEL_CBC_OVER_CURRENT
@ FAULT_SENSOR_OTP_CRC_CHECK
@ FAULT_SENSOR_OVER_TEMP_WARNING
@ FAULT_SENSOR_LEFT_CHANNEL_OVER_CURRENT
@ FAULT_SENSOR_OVER_TEMP_146C_WARNING
@ FAULT_SENSOR_PVDD_OVER_VOLTAGE
@ FAULT_SENSOR_PVDD_UNDER_VOLTAGE
@ FAULT_SENSOR_LOAD_EEPROM_ERROR
@ FAULT_SENSOR_LEFT_CHANNEL_CBC_OVER_CURRENT_WARNING
@ FAULT_SENSOR_CLOCK_FAULT
@ MIXER_MODE_STEREO_INVERSE
One register write for I2CDevice::write_registers(); tables of these may live in PROGMEM.
Everything that differs between models of the family.
uint8_t fault_sensor_bits[FAULT_SENSOR_COUNT]
Bit index for each FaultSensor, NO_BIT used where the model does not have that fault bit.
uint32_t fault_output_off_mask
Faults that keep the output off until cleared by activate()
uint32_t fault_warning_mask
Faults logged as warnings.
const i2c::I2CRegValue * startup_sequence
Remainder of the startup sequence, run after the reset, as {register, value} pairs in PROGMEM.
uint8_t mixer_book
Location of the four 9.23 fixed point input mixer coefficients: LEFT_TO_LEFT, RIGHT_TO_LEFT,...
uint8_t startup_sequence_length
uint32_t fault_latched_mask
Faults that stay set after the condition is gone and are cleared after each read.
uint8_t fault_output_pins
Number of pins that can report FAULTZ: pin n is selected at 0x61 + n and enabled by bit n of 0x60.
uint32_t fault_error_mask
Faults logged as errors and reported by have_fault.