Firmware for MAXREFDES1213
Dependencies: max32630fthr USBDevice
main.cpp@0:60a522ae2e35, 2016-11-11 (annotated)
- Committer:
- switches
- Date:
- Fri Nov 11 21:08:36 2016 +0000
- Revision:
- 0:60a522ae2e35
- Child:
- 1:6923b075c8d7
Basic blinky demo with development libraries for MAX32630FTHR
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
switches | 0:60a522ae2e35 | 1 | #include "mbed.h" |
switches | 0:60a522ae2e35 | 2 | |
switches | 0:60a522ae2e35 | 3 | #define MAX14690_I2C_ADDR 0x50 |
switches | 0:60a522ae2e35 | 4 | |
switches | 0:60a522ae2e35 | 5 | DigitalOut led1(LED1); |
switches | 0:60a522ae2e35 | 6 | I2C i2cm2(P5_7, P6_0); |
switches | 0:60a522ae2e35 | 7 | |
switches | 0:60a522ae2e35 | 8 | |
switches | 0:60a522ae2e35 | 9 | // main() runs in its own thread in the OS |
switches | 0:60a522ae2e35 | 10 | // (note the calls to Thread::wait below for delays) |
switches | 0:60a522ae2e35 | 11 | int main() |
switches | 0:60a522ae2e35 | 12 | { |
switches | 0:60a522ae2e35 | 13 | char data[5]; |
switches | 0:60a522ae2e35 | 14 | data[0] = 0x14; // I2C address for first register (LDO2 CFG) |
switches | 0:60a522ae2e35 | 15 | data[1] = 0x00; // Dissable LDO2 |
switches | 0:60a522ae2e35 | 16 | data[2] = 0x19; // Set voltage to 3.3V |
switches | 0:60a522ae2e35 | 17 | data[3] = 0x00; // Dissable LDO3 |
switches | 0:60a522ae2e35 | 18 | data[4] = 0x19; // Set voltage to 3.3V |
switches | 0:60a522ae2e35 | 19 | i2cm2.write(MAX14690_I2C_ADDR, data, 5); |
switches | 0:60a522ae2e35 | 20 | data[1] = 0x02; // Enable LDO2 |
switches | 0:60a522ae2e35 | 21 | data[3] = 0x02; // Enable LDO3 |
switches | 0:60a522ae2e35 | 22 | i2cm2.write(MAX14690_I2C_ADDR, data, 5); |
switches | 0:60a522ae2e35 | 23 | |
switches | 0:60a522ae2e35 | 24 | while (true) { |
switches | 0:60a522ae2e35 | 25 | led1 = !led1; |
switches | 0:60a522ae2e35 | 26 | Thread::wait(500); |
switches | 0:60a522ae2e35 | 27 | } |
switches | 0:60a522ae2e35 | 28 | } |
switches | 0:60a522ae2e35 | 29 |