Skip to content
Snippets Groups Projects
Commit b390d098 authored by schneider's avatar schneider Committed by dx
Browse files

espan: portexpander: detect rev6

parent 7841f5c0
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,8 @@ void os_app_main(void)
leds_init();
captouch_init();
if(portexpander_rev6()) printf("REV6\n"); else printf("REV5\n");
vTaskDelay(2000 / portTICK_PERIOD_MS);
//set_global_vol_dB(0);
......
......@@ -5,4 +5,5 @@
void portexpander_set_badgelink(const bool enabled);
void portexpander_set_leds(const bool enabled);
void portexpander_set_lcd_reset(const bool enabled);
bool portexpander_rev6(void);
void portexpander_init(void);
......@@ -34,6 +34,17 @@ static esp_err_t pca9557_i2c_read(const uint8_t addr, const uint8_t reg, uint8_t
return ret;
}
static bool pca9557_detect(const uint8_t addr)
{
uint8_t data;
esp_err_t ret = pca9557_i2c_read(addr, 0, &data);
if(ret == ESP_OK) {
return true;
} else {
return false;
}
}
static uint8_t pca9557_get(const uint8_t addr)
{
uint8_t pins;
......@@ -85,6 +96,11 @@ void portexpander_set_lcd_reset(const bool enabled)
pca9557_set(PEX2, pex2_state);
}
bool portexpander_rev6(void)
{
return pca9557_detect(PEX1);
}
void portexpander_init(void)
{
pca9557_set_polarities(PEX1, 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment