i2cscan fixes

This commit is contained in:
Verkehrsrot 2019-09-02 20:45:40 +02:00
parent 094d086010
commit ad9bd3e63e

View File

@ -11,6 +11,7 @@ static const char TAG[] = __FILE__;
#define BME_SECONDARY_ADDRESS (0x76) #define BME_SECONDARY_ADDRESS (0x76)
#define AXP192_PRIMARY_ADDRESS (0x34) #define AXP192_PRIMARY_ADDRESS (0x34)
#define MCP_24AA02E64_PRIMARY_ADDRESS (0x50) #define MCP_24AA02E64_PRIMARY_ADDRESS (0x50)
#define QUECTEL_GPS_PRIMARY_ADDRESS (0x10)
int i2c_scan(void) { int i2c_scan(void) {
@ -49,6 +50,10 @@ int i2c_scan(void) {
#endif #endif
break; break;
case QUECTEL_GPS_PRIMARY_ADDRESS:
ESP_LOGI(TAG, "0x%X: Quectel GPS", addr);
break;
case MCP_24AA02E64_PRIMARY_ADDRESS: case MCP_24AA02E64_PRIMARY_ADDRESS:
ESP_LOGI(TAG, "0x%X: 24AA02E64 serial EEPROM", addr); ESP_LOGI(TAG, "0x%X: 24AA02E64 serial EEPROM", addr);
break; break;
@ -80,23 +85,26 @@ void AXP192_init(void) {
axp.setPowerOutPut(AXP192_DCDC2, AXP202_ON); axp.setPowerOutPut(AXP192_DCDC2, AXP202_ON);
axp.setPowerOutPut(AXP192_EXTEN, AXP202_ON); axp.setPowerOutPut(AXP192_EXTEN, AXP202_ON);
axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON); axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON);
axp.setChgLEDMode(AXP20X_LED_OFF);
//axp.setChgLEDMode(LED_BLINK_4HZ);
/*
axp.setDCDC1Voltage(3300); axp.setDCDC1Voltage(3300);
axp.setChgLEDMode(AXP20X_LED_BLINK_1HZ);
pinMode(PMU_IRQ, INPUT_PULLUP); //axp.setChgLEDMode(AXP20X_LED_OFF);
attachInterrupt(PMU_IRQ, [] { pmu_irq = true; }, FALLING);
axp.adc1Enable(AXP202_BATT_CUR_ADC1, 1); axp.adc1Enable(AXP202_BATT_CUR_ADC1, 1);
#ifdef PMU_INT
pinMode(PMU_INT, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(PMU_INT),
[] {
ESP_LOGI(TAG, "Power source changed");
/* put your code here */
},
FALLING);
axp.enableIRQ(AXP202_VBUS_REMOVED_IRQ | AXP202_VBUS_CONNECT_IRQ | axp.enableIRQ(AXP202_VBUS_REMOVED_IRQ | AXP202_VBUS_CONNECT_IRQ |
AXP202_BATT_REMOVED_IRQ | AXP202_BATT_CONNECT_IRQ, AXP202_BATT_REMOVED_IRQ | AXP202_BATT_CONNECT_IRQ,
1); 1);
axp.clearIRQ(); axp.clearIRQ();
*/ #endif // PMU_INT
ESP_LOGI(TAG, "AXP192 PMU initialized."); ESP_LOGI(TAG, "AXP192 PMU initialized.");
} }
#endif // HAS_PMU }
} #endif // HAS_PMU