Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MAX30101 max32630fthr
Fork of MAX30101_Demo_Plot_Algorithm by
Diff: main.cpp
- Revision:
- 8:a1538e8a3fd9
- Parent:
- 7:6075af57668e
- Child:
- 9:affd4e6372a0
diff -r 6075af57668e -r a1538e8a3fd9 main.cpp --- a/main.cpp Tue Sep 05 14:11:26 2017 +0000 +++ b/main.cpp Tue Sep 26 16:45:15 2017 +0000 @@ -39,6 +39,7 @@ MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); bool op_sensor_config(MAX30101 &op_sensor); +void pmic_config(I2C & i2c_bus, DigitalOut & pmic_en); /* Op Sensor FIFO nearly full callback */ volatile bool op_sensorIntFlag = 0; @@ -61,6 +62,9 @@ I2C i2cBus(I2C1_SDA, I2C1_SCL); // I2C bus, P3_4 = SDA, P3_5 = SCL + DigitalOut VLED_EN(P3_3,0); //Enable for VLEDs + pmic_config(i2cBus, VLED_EN); + MAX30101 op_sensor(i2cBus); // Create new MAX30101 on i2cBus int rc = op_sensor_config(op_sensor); // Config sensor, return 0 on success @@ -176,3 +180,24 @@ return rc; } + +void pmic_config(I2C & i2c_bus, DigitalOut & pmic_en) +{ + + const uint8_t PMIC_ADRS = 0x54; + const uint8_t BBB_EXTRA_ADRS = 0x1C; + const uint8_t BOOST_VOLTAGE = 0x05; + + char data_buff[] = {BBB_EXTRA_ADRS, 0x40}; //BBBExtra register address + //and data to enable passive + //pull down. + i2c_bus.write(PMIC_ADRS, data_buff,2); //write to BBBExtra register + + data_buff[0] = BOOST_VOLTAGE; + data_buff[1] = 0x14; //Boost voltage configuration + //register followed by data + //to set voltage to 4.5V + pmic_en = 0; //disables VLED + i2c_bus.write(PMIC_ADRS, data_buff,2); //write to BBBExtra register + pmic_en = 1; //enables VLED +} \ No newline at end of file