The MAX32630HSP2 board is a rapid development platform designed to help engineers quickly implement battery optimized solutions with the MAX32630 ARM Cortex-M4F microcontroller.
Dependencies: max20303
Dependents: MAX32630HSP3_IMU_HelloWorld
Fork of max32630hsp3 by
Revision 3:60c0cc971d85, committed 2018-04-25
- Comitter:
- Emre.Eken
- Date:
- Wed Apr 25 09:56:03 2018 +0300
- Parent:
- 2:760266d846ee
- Commit message:
- Contents of the files were changed.
Changed in this revision
--- a/max20303.lib Tue Apr 24 11:07:04 2018 +0000 +++ b/max20303.lib Wed Apr 25 09:56:03 2018 +0300 @@ -1,1 +1,1 @@ -https://os.mbed.com/teams/MaximIntegrated/code/max20303/#ff4818eff240 +https://os.mbed.com/teams/MaximIntegrated/code/max20303/#0333f77c665f
--- a/max32630hsp.cpp Tue Apr 24 11:07:04 2018 +0000 +++ b/max32630hsp.cpp Wed Apr 25 09:56:03 2018 +0300 @@ -1,125 +1,125 @@ -/******************************************************************************* - * Copyright (C) 2018 Maxim Integrated Products, Inc., All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES - * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of Maxim Integrated - * Products, Inc. shall not be used except as stated in the Maxim Integrated - * Products, Inc. Branding Policy. - * - * The mere transfer of this software does not imply any licenses - * of trade secrets, proprietary technology, copyrights, patents, - * trademarks, maskwork rights, or any other form of intellectual - * property whatsoever. Maxim Integrated Products, Inc. retains all - * ownership rights. - ******************************************************************************* - */ - -#include "mbed.h" -#include "max3263x.h" -#include "ioman_regs.h" -#include "PinNames.h" -#include "max32630hsp.h" - -//****************************************************************************** -MAX32630HSP::MAX32630HSP() : i2c(P5_7, P6_0), max20303(&i2c) -{ -} - -//****************************************************************************** -MAX32630HSP::MAX32630HSP(vio_t vio) : i2c(P5_7, P6_0), max20303(&i2c) -{ - init(vio); -} - -//****************************************************************************** -MAX32630HSP::~MAX32630HSP() -{ - -} - -//****************************************************************************** -int MAX32630HSP::init(vio_t hdrVio) -{ - // Set LED pins to 3.3V - vddioh(P2_4, VIO_3V3); - vddioh(P2_5, VIO_3V3); - vddioh(P2_6, VIO_3V3); - - // Set header pins to hdrVio - vddioh(P3_0, hdrVio); - vddioh(P3_1, hdrVio); - vddioh(P3_2, hdrVio); - vddioh(P3_3, hdrVio); - vddioh(P3_4, hdrVio); - vddioh(P3_5, hdrVio); - vddioh(P4_0, hdrVio); - vddioh(P4_1, hdrVio); - vddioh(P4_2, hdrVio); - vddioh(P4_3, hdrVio); - vddioh(P4_4, hdrVio); - vddioh(P4_5, hdrVio); - vddioh(P4_6, hdrVio); - vddioh(P4_7, hdrVio); - vddioh(P5_0, hdrVio); - vddioh(P5_1, hdrVio); - vddioh(P5_2, hdrVio); - vddioh(P5_3, hdrVio); - vddioh(P5_4, hdrVio); - vddioh(P5_5, hdrVio); - vddioh(P5_6, hdrVio); - - /* Wait for pmic to settle down */ - wait_ms(1000); - - /*Set LDO1 to 1.8v*/ - max20303.LDO1Config(); - max20303.BoostEnable(); - max20303.BuckBoostEnable(); - return 0; -} - -void MAX32630HSP::enableDisplay(void) -{ - vddioh(P6_4, VIO_3V3); //EXTCOM - vddioh(P6_1, VIO_3V3); //SCLK - vddioh(P6_2, VIO_3V3); //MOSI1 - vddioh(P6_5, VIO_3V3); //SCS - vddioh(P6_4, VIO_3V3); //EXTCOM - vddioh(P6_6, VIO_3V3); //DISP -} - -//****************************************************************************** -int MAX32630HSP::vddioh(PinName pin, vio_t vio) -{ - __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 (vio) { - *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; -} +/******************************************************************************* + * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES + * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of Maxim Integrated + * Products, Inc. shall not be used except as stated in the Maxim Integrated + * Products, Inc. Branding Policy. + * + * The mere transfer of this software does not imply any licenses + * of trade secrets, proprietary technology, copyrights, patents, + * trademarks, maskwork rights, or any other form of intellectual + * property whatsoever. Maxim Integrated Products, Inc. retains all + * ownership rights. + ******************************************************************************* + */ + +#include "mbed.h" +#include "max3263x.h" +#include "ioman_regs.h" +#include "PinNames.h" +#include "max32630hsp.h" + +//****************************************************************************** +MAX32630HSP::MAX32630HSP() : i2c(P5_7, P6_0), max20303(&i2c) +{ +} + +//****************************************************************************** +MAX32630HSP::MAX32630HSP(vio_t vio) : i2c(P5_7, P6_0), max20303(&i2c) +{ + init(vio); +} + +//****************************************************************************** +MAX32630HSP::~MAX32630HSP() +{ + +} + +//****************************************************************************** +int MAX32630HSP::init(vio_t hdrVio) +{ + // Set LED pins to 3.3V + vddioh(P2_4, VIO_3V3); + vddioh(P2_5, VIO_3V3); + vddioh(P2_6, VIO_3V3); + + // Set header pins to hdrVio + vddioh(P3_0, hdrVio); + vddioh(P3_1, hdrVio); + vddioh(P3_2, hdrVio); + vddioh(P3_3, hdrVio); + vddioh(P3_4, hdrVio); + vddioh(P3_5, hdrVio); + vddioh(P4_0, hdrVio); + vddioh(P4_1, hdrVio); + vddioh(P4_2, hdrVio); + vddioh(P4_3, hdrVio); + vddioh(P4_4, hdrVio); + vddioh(P4_5, hdrVio); + vddioh(P4_6, hdrVio); + vddioh(P4_7, hdrVio); + vddioh(P5_0, hdrVio); + vddioh(P5_1, hdrVio); + vddioh(P5_2, hdrVio); + vddioh(P5_3, hdrVio); + vddioh(P5_4, hdrVio); + vddioh(P5_5, hdrVio); + vddioh(P5_6, hdrVio); + + /* Wait for pmic to settle down */ + wait_ms(1000); + //max20303.led0on(); + /*Set LDO1 to 1.8v*/ + max20303.LDO1Config(); + max20303.BoostEnable(); + max20303.BuckBoostEnable(); + return 0; +} + +void MAX32630HSP::enableDisplay(void) +{ + vddioh(P6_4, VIO_3V3); //EXTCOM + vddioh(P6_1, VIO_3V3); //SCLK + vddioh(P6_2, VIO_3V3); //MOSI1 + vddioh(P6_5, VIO_3V3); //SCS + vddioh(P6_4, VIO_3V3); //EXTCOM + vddioh(P6_6, VIO_3V3); //DISP +} + +//****************************************************************************** +int MAX32630HSP::vddioh(PinName pin, vio_t vio) +{ + __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 (vio) { + *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; +}
--- a/max32630hsp.h Tue Apr 24 11:07:04 2018 +0000 +++ b/max32630hsp.h Wed Apr 25 09:56:03 2018 +0300 @@ -1,143 +1,143 @@ -/******************************************************************************* - * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES - * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of Maxim Integrated - * Products, Inc. shall not be used except as stated in the Maxim Integrated - * Products, Inc. Branding Policy. - * - * The mere transfer of this software does not imply any licenses - * of trade secrets, proprietary technology, copyrights, patents, - * trademarks, maskwork rights, or any other form of intellectual - * property whatsoever. Maxim Integrated Products, Inc. retains all - * ownership rights. - ******************************************************************************* - */ - -#ifndef _MAX32630HSP_H_ -#define _MAX32630HSP_H_ - -#include "mbed.h" -#include "MAX20303.h" - -/** - * @brief MAX32630HSP Board Support Library - * - * @details The MAX32630HSP is a rapid development application board for - * ultra low power wearable applications. It includes common peripherals and - * expansion connectors all power optimized for getting the longest life from - * the battery. This library configures the power and I/O for the board. - * <br>https://www.maximintegrated.com/max32630hsp - * - * @code - * #include "mbed.h" - * #include "max32630hsp.h" - * - * DigitalOut led1(LED1); - * MAX32630HSP icarus(MAX32630HSP::VIO_3V3); - * - * // main() runs in its own thread in the OS - * // (note the calls to Thread::wait below for delays) - * int main() - * { - * // initialize power and I/O on MAX32630HSP board - * icarus.init(); - * - * while (true) { - * led1 = !led1; - * Thread::wait(500); - * } - * } - * @endcode - */ - -// Sharp LS013B7DH03 Memory Display -#define SCK_PIN P6_1 -#define MOSI_PIN P6_2 -#define CS_PIN P6_5 -#define EXTCOM_PIN P6_4 -#define DISP_PIN P6_6 -#define DISPSEL_PIN NC - -class MAX32630HSP -{ -public: -// max32630hsp configuration utilities - - /** - * @brief IO Voltage - * @details Enumerated options for operating voltage - */ - typedef enum { - VIO_1V8 = 0x00, ///< 1.8V IO voltage at headers (from BUCK2) - VIO_3V3 = 0x01, ///< 3.3V IO voltage at headers (from LDO2) - } vio_t; - - /** - * MAX32630HSP constructor. - * - */ - MAX32630HSP(); - - /** - * MAX32630HSP constructor. - * - */ - MAX32630HSP(vio_t vio); - - /** - * MAX32630HSP destructor. - */ - ~MAX32630HSP(); - - /** - * @brief Initialize MAX32630HSP board - * @details Initializes PMIC and I/O on MAX32630HSP 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. - * @param hdrVio I/O voltage for header pins - * @returns 0 if no errors, -1 if error. - */ - int init(vio_t hdrVio); - - /** - * @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); - - /* Set vddio for Sharp LS013B7DH03 Display */ - void enableDisplay(void); - - /// Local I2C bus for configuring PMIC and accessing BMI160 IMU. - I2C i2c; - - /// MAX20303 PMIC Instance - MAX20303 max20303; -}; - -#endif /* _MAX32630HSP_H_ */ +/******************************************************************************* + * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES + * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of Maxim Integrated + * Products, Inc. shall not be used except as stated in the Maxim Integrated + * Products, Inc. Branding Policy. + * + * The mere transfer of this software does not imply any licenses + * of trade secrets, proprietary technology, copyrights, patents, + * trademarks, maskwork rights, or any other form of intellectual + * property whatsoever. Maxim Integrated Products, Inc. retains all + * ownership rights. + ******************************************************************************* + */ + +#ifndef _MAX32630HSP_H_ +#define _MAX32630HSP_H_ + +#include "mbed.h" +#include "MAX20303.h" + +/** + * @brief MAX32630HSP Board Support Library + * + * @details The MAX32630HSP is a rapid development application board for + * ultra low power wearable applications. It includes common peripherals and + * expansion connectors all power optimized for getting the longest life from + * the battery. This library configures the power and I/O for the board. + * <br>https://www.maximintegrated.com/max32630hsp + * + * @code + * #include "mbed.h" + * #include "max32630hsp.h" + * + * DigitalOut led1(LED1); + * MAX32630HSP icarus(MAX32630HSP::VIO_3V3); + * + * // main() runs in its own thread in the OS + * // (note the calls to Thread::wait below for delays) + * int main() + * { + * // initialize power and I/O on MAX32630HSP board + * icarus.init(); + * + * while (true) { + * led1 = !led1; + * Thread::wait(500); + * } + * } + * @endcode + */ + +// Sharp LS013B7DH03 Memory Display +#define SCK_PIN P6_1 +#define MOSI_PIN P6_2 +#define CS_PIN P6_5 +#define EXTCOM_PIN P6_4 +#define DISP_PIN P6_6 +#define DISPSEL_PIN NC + +class MAX32630HSP +{ +public: +// max32630hsp configuration utilities + + /** + * @brief IO Voltage + * @details Enumerated options for operating voltage + */ + typedef enum { + VIO_1V8 = 0x00, ///< 1.8V IO voltage at headers (from BUCK2) + VIO_3V3 = 0x01, ///< 3.3V IO voltage at headers (from LDO2) + } vio_t; + + /** + * MAX32630HSP constructor. + * + */ + MAX32630HSP(); + + /** + * MAX32630HSP constructor. + * + */ + MAX32630HSP(vio_t vio); + + /** + * MAX32630HSP destructor. + */ + ~MAX32630HSP(); + + /** + * @brief Initialize MAX32630HSP board + * @details Initializes PMIC and I/O on MAX32630HSP 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. + * @param hdrVio I/O voltage for header pins + * @returns 0 if no errors, -1 if error. + */ + int init(vio_t hdrVio); + + /** + * @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); + + /* Set vddio for Sharp LS013B7DH03 Display */ + void enableDisplay(void); + + /// Local I2C bus for configuring PMIC and accessing BMI160 IMU. + I2C i2c; + + /// MAX20303 PMIC Instance + MAX20303 max20303; +}; + +#endif /* _MAX32630HSP_H_ */