diff options
| author | jacqueline <me@jacqueline.id.au> | 2022-09-30 13:19:37 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2022-09-30 13:19:37 +1000 |
| commit | b34b49aabc5284a3efc594da2823ecf47761348b (patch) | |
| tree | 2dfbefbf04fe822d1af277d633b2c8e92a5cc519 /main/gpio-expander.cpp | |
| parent | 112a43679f988a4d4c40ecfbece6d78168c5938e (diff) | |
| download | tangara-fw-b34b49aabc5284a3efc594da2823ecf47761348b.tar.gz | |
working adc and wall power detection
Diffstat (limited to 'main/gpio-expander.cpp')
| -rw-r--r-- | main/gpio-expander.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/main/gpio-expander.cpp b/main/gpio-expander.cpp index 36132356..9e905734 100644 --- a/main/gpio-expander.cpp +++ b/main/gpio-expander.cpp @@ -38,8 +38,8 @@ esp_err_t GpioExpander::Read() { // it because that would indicate some really very badly wrong more generally. i2c_master_start(handle); i2c_master_write_byte(handle, (PCA8575_ADDRESS << 1 | I2C_MASTER_READ), true); - i2c_master_read_byte(handle, &port_a_, I2C_MASTER_ACK); - i2c_master_read_byte(handle, &port_b_, I2C_MASTER_LAST_NACK); + i2c_master_read_byte(handle, &input_a_, I2C_MASTER_ACK); + i2c_master_read_byte(handle, &input_b_, I2C_MASTER_LAST_NACK); i2c_master_stop(handle); esp_err_t ret = i2c_master_cmd_begin(I2C_NUM_0, handle, PCA8575_TIMEOUT); @@ -62,4 +62,16 @@ uint8_t GpioExpander::key_states(void) { return input_b_ & 0b00111111; } +void GpioExpander::set_sd_mux(SdMuxController controller) { + port_a_ &= (1 << 5); +} + +void GpioExpander::set_sd_cs(bool high) { + port_a_ &= (1 << 6); +} + +void GpioExpander::set_display_cs(bool high) { + port_a_ &= (1 << 7); +} + } // namespace gay_ipod |
