MAX14690 library
Fork of MAX14690 by
Diff: MAX14720.h
- Revision:
- 5:0010586546d8
- Parent:
- 4:2e4837c3b6e1
- Child:
- 6:06450093da48
--- a/MAX14720.h Tue Oct 04 23:56:42 2016 +0000 +++ b/MAX14720.h Wed Oct 05 00:05:14 2016 +0000 @@ -36,38 +36,6 @@ #include "mbed.h" -/** - * Example for the MAX14720 PMIC Driver - * - * @code - * #include <stdio.h> - * #include "mbed.h" - * #include "MAX14720.h" - * - * // I2C Master 2 - * I2C i2c2(I2C2_SDA, I2C2_SCL); - * - * #define I2C_ADDR_PMIC (0x54) - * MAX14720 max14720(&i2c2,I2C_ADDR_PMIC); - * - * int main(void) { - * int result; - * - * // initialize BoostVSet on the MAX14720 PMIC to 4.5 Volts - * printf("Init MAX14720\n"); - * result = max14720.boostEn(MAX14720::BoostEn_Disable); - * if (result == MAX14720_ERROR) printf("Error communicating with MAX14720"); - * result = max14720.boostVSet(MAX14720::BoostVSet_45); - * if (result == MAX14720_ERROR) printf("Error communicating with MAX14720"); - * result = max14720.boostEn(MAX14720::BoostEn_Enable); - * if (result == MAX14720_ERROR) printf("Error communicating with MAX14720"); - * - * while (1) { - * } - * } - * @endcode - */ - #define MAX14720_NO_ERROR 0 #define MAX14720_ERROR -1 @@ -75,8 +43,51 @@ #define MAX14720_BOOST_MAX_MV 5000 #define MAX14720_BOOST_STEP_MV 100 +/** + * MAX14720 PMIC Driver + * + * @code + * #include "mbed.h" + * #include "MAX14720.h" + * + * // I2C Master 2 + * I2C i2c2(I2C2_SDA, I2C2_SCL); + * + * #define I2C_ADDR_PMIC (0x54) + * MAX14720 max14720(&i2c2,I2C_ADDR_PMIC); + * + * DigitalOut led(LED1); + * InterruptIn button(SW1); + * + * void turnOff() + * { + * max14720.shutdown(); + * } + * + * int main() + * { + * int result; + * button.fall(&turnOff); + * led = 0; + * max14720.boostEn = MAX14720::BOOST_ENABLED; + * result = max14720.init(); + * if (result == MAX14720_ERROR) printf("Error initializing MAX14720"); + * wait(1); + * while(1) { + * max14720.boostSetMode(MAX14720::BOOST_DISABLED); + * max14720.boostEn = MAX14720::BOOST_ENABLED; + * wait(0.5); + * max14720.boostSetVoltage(2500); + * wait(0.5); + * max14720.boostSetVoltage(5000); + * wait(0.5); + * } + * } + * @endcode + */ class MAX14720 { + public: /** @@ -306,4 +317,4 @@ }; -#endif /* PMIC_H_ */ +#endif /* _MAX14720_H_ */