Fork of MAX32630FTHR utilities library
Dependents: MAX32630FTHR_BALANCE_BOT MAX32630FTHR_iButton_uSD_Logger MAX32630FTHR_DS18B20_uSD_Logger MAX32630FTHR_BALANCE_BOT
Fork of max32630fthr by
Diff: max32630fthr.h
- Revision:
- 6:92b485e70885
- Parent:
- 3:b735212d2fe5
- Child:
- 7:9157b152011b
diff -r 3f87baa11ee4 -r 92b485e70885 max32630fthr.h --- a/max32630fthr.h Thu Dec 08 00:36:05 2016 +0000 +++ b/max32630fthr.h Thu Dec 08 03:33:50 2016 +0000 @@ -30,13 +30,16 @@ * ownership rights. ******************************************************************************* */ + #ifndef _MAX32630FTHR_H_ #define _MAX32630FTHR_H_ + #include "mbed.h" #include "MAX14690.h" + /** * @brief MAX32630FTHR Board Support Library * @@ -70,60 +73,121 @@ class MAX32630FTHR { public: -// max32630fthr configuration utilities - /** - * @brief IO Voltage - * @details Enumerated options for operating voltage - */ - typedef enum { + // max32630fthr configuration utilities + + ///@brief IoVoltage + ///@details Enumerated options for operating voltage + enum IoVoltage + { VIO_1V8 = 0x00, ///< 1.8V IO voltage at headers (from BUCK2) - VIO_3V3 = 0x01, ///< 3.3V IO voltage at headers (from LDO2) - } vio_t; + VIO_3V3 = 0x01 ///< 3.3V IO voltage at headers (from LDO2) + }; + - /** - * MAX32630FTHR constructor. - * - * @param vio I/O voltage for header pins - */ - MAX32630FTHR(vio_t vio); - - /** - * MAX32630FTHR destructor. - */ - ~MAX32630FTHR(); + ///@brief MAX32630FTHR constructor..\n + /// + ///On Entry: + ///@param[in] vio - I/O voltage for header pins + /// + ///On Exit: + ///@param[out] none + /// + ///@returns none + MAX32630FTHR(IoVoltage vio); + + + ///@brief MAX32630FTHR destructor..\n + /// + ///On Entry: + ///@param[in] none + /// + ///On Exit: + ///@param[out] none + /// + ///@returns none + ~MAX32630FTHR(){ }; - /** - * @brief Initialize MAX32630FTHR board - * @details Initializes PMIC and I/O on MAX32630FTHR board. - * Configures PMIC to enable LDO2 and LDO3 at 3.3V. - * Disables resisitive pulldown on MON(AIN_0) - * Sets default I/O voltages to 3V3 for micro SD card. - * Sets I/O voltage for header pins to hdrVio specified. - * @returns 0 if no errors, -1 if error. - */ - int init(); + + ///@brief Initialize MAX32630FTHR board.\n + ///@details Initializes PMIC and I/O on MAX32630FTHR board.\n + ///Configures PMIC to enable LDO2 and LDO3 at 3.3V. + ///Disables resisitive pulldown on MON(AIN_0).\n + ///Sets default I/O voltages to 3V3 for micro SD card.\n + ///Sets I/O voltage for header pins to hdrVio specified.\n + /// + ///On Entry: + ///@param[in] none + /// + ///On Exit: + ///@param[out] none + /// + ///@returns 0 if no errors, -1 if error. + int32_t init(); + - /** - * @brief Sets I/O Voltage - * @details Sets the voltage rail to be used for a given pin. - * VIO_1V8 selects VDDIO which is supplied by Buck2, which is set at 1.8V, - * VIO_3V3 selects VDDIOH which is supplied by LDO2, which is typically 3.3V/ - * @param pin Pin whose voltage supply is being assigned. - * @param vio Voltage rail to be used for specified pin. - * @returns 0 if no errors, -1 if error. - */ - int vddioh(PinName pin, vio_t vio); + ///@brief Sets I/O Voltage.\n + ///@details Sets the voltage rail to be used for a given pin.\n + ///VIO_1V8 selects VDDIO which is supplied by Buck2, which is set at 1.8V,\n + ///VIO_3V3 selects VDDIOH which is supplied by LDO2, which is typically 3.3V. + ///On Entry: + ///@param[in] pin - Pin whose voltage supply is being assigned. + ///@param[in] vio - Voltage rail to be used for specified pin. + /// + ///On Exit: + ///@param[out] none + /// + ///@returns 0 if no errors, -1 if error. + int32_t vddioh(PinName pin, IoVoltage vio); + + + ///@brief Gets battery voltage as float.\n + /// + ///On Entry: + ///@param[in] battVolts - pointer to float for storing battery voltage + /// + ///On Exit: + ///@param[out] battVolts - holds battery voltage on success + /// + ///@returns 0 if no errors, -1 if error. + int32_t getBatteryVoltage(float *battVolts); + + int32_t getSysVoltage(float *sysVolts); + + int32_t getBuck1Voltage(float *buckVolts); + + int32_t getBuck2Voltage(float *buckVolts); + + int32_t getLDO1Voltage(float *ldoVolts); + + int32_t getLDO2Voltage(float *ldoVolts); + + int32_t getLDO3Voltage(float *ldoVolts); + + +private: - /// Local I2C bus for configuring PMIC and accessing BMI160 IMU. - I2C i2c; + /// I2C bus for configuring PMIC + I2C m_i2c; /// MAX14690 PMIC Instance - MAX14690 max14690; - + MAX14690 m_max14690; + /// The default I/O voltage to be used for header pins. - vio_t hdrVio; - + IoVoltage m_hdrVio; + + int32_t readMonVoltage(MAX14690::monCfg_t monCfg, float *volts); }; #endif /* _MAX32630FTHR_H_ */ + +///@brief fx documentation template.\n +/// +///On Entry: +///@param[in] none +/// +///On Exit: +///@param[out] none +/// +///@returns none +