ch1 test1
Dependencies: MAX14690
max32630fthr.cpp
- Committer:
- switches
- Date:
- 2016-11-16
- Revision:
- 0:8926602da648
- Child:
- 1:15e34492fbf1
File content as of revision 0:8926602da648:
#include "mbed.h" #include "max3263x.h" #include "ioman_regs.h" #include "PinNames.h" #include "max32630fthr.h" #define MAX14690_I2C_ADDR 0x50 int max32630fthrInit() { I2C __i2cm2(P5_7, P6_0); char data[5]; data[0] = 0x14; // I2C address for first register (LDO2 CFG) data[1] = 0x00; // Dissable LDO2 data[2] = 0x19; // Set voltage to 3.3V data[3] = 0x00; // Dissable LDO3 data[4] = 0x19; // Set voltage to 3.3V __i2cm2.write(MAX14690_I2C_ADDR, data, 5); data[1] = 0x02; // Enable LDO2 data[3] = 0x02; // Enable LDO3 __i2cm2.write(MAX14690_I2C_ADDR, data, 5); return 0; } int vddioh(PinName pin, bool en) { __IO uint32_t *use_vddioh = &((mxc_ioman_regs_t *)MXC_IOMAN)->use_vddioh_0; if (pin == NOT_CONNECTED) { return -1; } use_vddioh += PINNAME_TO_PORT(pin) >> 2; if (en) { *use_vddioh |= (1 << (PINNAME_TO_PIN(pin) + ((PINNAME_TO_PORT(pin) & 0x3) << 3))); } else { *use_vddioh &= ~(1 << (PINNAME_TO_PIN(pin) + ((PINNAME_TO_PORT(pin) & 0x3) << 3))); } return 0; }