don't check for 3V3 if already started

pico-i2c
alanbjohnston 3 years ago committed by GitHub
parent b4ceadca6e
commit dcf8fa7579
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3015,11 +3015,12 @@ void led_set(int ledPin, bool state)
void start_ina219() { void start_ina219() {
//#define PI_3V3_PIN 9 // for v0.1 hardware //#define PI_3V3_PIN 9 // for v0.1 hardware
Serial.println("Starting INA219"); Serial.println("Starting INA219");
Serial.println(PI_3V3_PIN); // Serial.println(PI_3V3_PIN);
ina219_started = true;
i2c_1 = i2c2 = i2c3 = i2c4 = i2c5 = i2c6 = i2c7 = i2c8 = false; i2c_1 = i2c2 = i2c3 = i2c4 = i2c5 = i2c6 = i2c7 = i2c8 = false;
if (!ina219_started) {
#ifndef PICO_0V1 #ifndef PICO_0V1
// check if Pi is present by 3.3V voltage // check if Pi is present by 3.3V voltage
pinMode(PI_3V3_PIN, INPUT); pinMode(PI_3V3_PIN, INPUT);
@ -3038,7 +3039,7 @@ void start_ina219() {
pinMode(PI_3V3_PIN, OUTPUT); pinMode(PI_3V3_PIN, OUTPUT);
digitalWrite(PI_3V3_PIN, HIGH); digitalWrite(PI_3V3_PIN, HIGH);
#endif #endif
}
sleep(0.1); sleep(0.1);
if (!(i2c_1 = ina219_1_0x40.begin())) // check i2c bus 1 if (!(i2c_1 = ina219_1_0x40.begin())) // check i2c bus 1
Serial.println("I2C +X sensor (bus 1 0x40) not found"); Serial.println("I2C +X sensor (bus 1 0x40) not found");
@ -3084,6 +3085,7 @@ void start_ina219() {
ina219_2_0x45.setCalibration_16V_400mA(); ina219_2_0x45.setCalibration_16V_400mA();
} }
*/ */
ina219_started = true;
} }
void start_pwm() { void start_pwm() {

Loading…
Cancel
Save

Powered by TurnKey Linux.