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
max32630hsp.h@0:9d70b2e8b1ec, 2018-01-19 (annotated)
- Committer:
- Ismail Kose
- Date:
- Fri Jan 19 15:35:54 2018 -0800
- Revision:
- 0:9d70b2e8b1ec
- Child:
- 3:60c0cc971d85
Add MAX32630HSP3 initial class
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Ismail Kose |
0:9d70b2e8b1ec | 1 | /******************************************************************************* |
Ismail Kose |
0:9d70b2e8b1ec | 2 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
Ismail Kose |
0:9d70b2e8b1ec | 3 | * |
Ismail Kose |
0:9d70b2e8b1ec | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
Ismail Kose |
0:9d70b2e8b1ec | 5 | * copy of this software and associated documentation files (the "Software"), |
Ismail Kose |
0:9d70b2e8b1ec | 6 | * to deal in the Software without restriction, including without limitation |
Ismail Kose |
0:9d70b2e8b1ec | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
Ismail Kose |
0:9d70b2e8b1ec | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
Ismail Kose |
0:9d70b2e8b1ec | 9 | * Software is furnished to do so, subject to the following conditions: |
Ismail Kose |
0:9d70b2e8b1ec | 10 | * |
Ismail Kose |
0:9d70b2e8b1ec | 11 | * The above copyright notice and this permission notice shall be included |
Ismail Kose |
0:9d70b2e8b1ec | 12 | * in all copies or substantial portions of the Software. |
Ismail Kose |
0:9d70b2e8b1ec | 13 | * |
Ismail Kose |
0:9d70b2e8b1ec | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
Ismail Kose |
0:9d70b2e8b1ec | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
Ismail Kose |
0:9d70b2e8b1ec | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
Ismail Kose |
0:9d70b2e8b1ec | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
Ismail Kose |
0:9d70b2e8b1ec | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
Ismail Kose |
0:9d70b2e8b1ec | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
Ismail Kose |
0:9d70b2e8b1ec | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
Ismail Kose |
0:9d70b2e8b1ec | 21 | * |
Ismail Kose |
0:9d70b2e8b1ec | 22 | * Except as contained in this notice, the name of Maxim Integrated |
Ismail Kose |
0:9d70b2e8b1ec | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
Ismail Kose |
0:9d70b2e8b1ec | 24 | * Products, Inc. Branding Policy. |
Ismail Kose |
0:9d70b2e8b1ec | 25 | * |
Ismail Kose |
0:9d70b2e8b1ec | 26 | * The mere transfer of this software does not imply any licenses |
Ismail Kose |
0:9d70b2e8b1ec | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
Ismail Kose |
0:9d70b2e8b1ec | 28 | * trademarks, maskwork rights, or any other form of intellectual |
Ismail Kose |
0:9d70b2e8b1ec | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
Ismail Kose |
0:9d70b2e8b1ec | 30 | * ownership rights. |
Ismail Kose |
0:9d70b2e8b1ec | 31 | ******************************************************************************* |
Ismail Kose |
0:9d70b2e8b1ec | 32 | */ |
Ismail Kose |
0:9d70b2e8b1ec | 33 | |
Ismail Kose |
0:9d70b2e8b1ec | 34 | #ifndef _MAX32630HSP_H_ |
Ismail Kose |
0:9d70b2e8b1ec | 35 | #define _MAX32630HSP_H_ |
Ismail Kose |
0:9d70b2e8b1ec | 36 | |
Ismail Kose |
0:9d70b2e8b1ec | 37 | #include "mbed.h" |
Ismail Kose |
0:9d70b2e8b1ec | 38 | #include "MAX20303.h" |
Ismail Kose |
0:9d70b2e8b1ec | 39 | |
Ismail Kose |
0:9d70b2e8b1ec | 40 | /** |
Ismail Kose |
0:9d70b2e8b1ec | 41 | * @brief MAX32630HSP Board Support Library |
Ismail Kose |
0:9d70b2e8b1ec | 42 | * |
Ismail Kose |
0:9d70b2e8b1ec | 43 | * @details The MAX32630HSP is a rapid development application board for |
Ismail Kose |
0:9d70b2e8b1ec | 44 | * ultra low power wearable applications. It includes common peripherals and |
Ismail Kose |
0:9d70b2e8b1ec | 45 | * expansion connectors all power optimized for getting the longest life from |
Ismail Kose |
0:9d70b2e8b1ec | 46 | * the battery. This library configures the power and I/O for the board. |
Ismail Kose |
0:9d70b2e8b1ec | 47 | * <br>https://www.maximintegrated.com/max32630hsp |
Ismail Kose |
0:9d70b2e8b1ec | 48 | * |
Ismail Kose |
0:9d70b2e8b1ec | 49 | * @code |
Ismail Kose |
0:9d70b2e8b1ec | 50 | * #include "mbed.h" |
Ismail Kose |
0:9d70b2e8b1ec | 51 | * #include "max32630hsp.h" |
Ismail Kose |
0:9d70b2e8b1ec | 52 | * |
Ismail Kose |
0:9d70b2e8b1ec | 53 | * DigitalOut led1(LED1); |
Ismail Kose |
0:9d70b2e8b1ec | 54 | * MAX32630HSP icarus(MAX32630HSP::VIO_3V3); |
Ismail Kose |
0:9d70b2e8b1ec | 55 | * |
Ismail Kose |
0:9d70b2e8b1ec | 56 | * // main() runs in its own thread in the OS |
Ismail Kose |
0:9d70b2e8b1ec | 57 | * // (note the calls to Thread::wait below for delays) |
Ismail Kose |
0:9d70b2e8b1ec | 58 | * int main() |
Ismail Kose |
0:9d70b2e8b1ec | 59 | * { |
Ismail Kose |
0:9d70b2e8b1ec | 60 | * // initialize power and I/O on MAX32630HSP board |
Ismail Kose |
0:9d70b2e8b1ec | 61 | * icarus.init(); |
Ismail Kose |
0:9d70b2e8b1ec | 62 | * |
Ismail Kose |
0:9d70b2e8b1ec | 63 | * while (true) { |
Ismail Kose |
0:9d70b2e8b1ec | 64 | * led1 = !led1; |
Ismail Kose |
0:9d70b2e8b1ec | 65 | * Thread::wait(500); |
Ismail Kose |
0:9d70b2e8b1ec | 66 | * } |
Ismail Kose |
0:9d70b2e8b1ec | 67 | * } |
Ismail Kose |
0:9d70b2e8b1ec | 68 | * @endcode |
Ismail Kose |
0:9d70b2e8b1ec | 69 | */ |
Ismail Kose |
0:9d70b2e8b1ec | 70 | |
Ismail Kose |
0:9d70b2e8b1ec | 71 | // Sharp LS013B7DH03 Memory Display |
Ismail Kose |
0:9d70b2e8b1ec | 72 | #define SCK_PIN P6_1 |
Ismail Kose |
0:9d70b2e8b1ec | 73 | #define MOSI_PIN P6_2 |
Ismail Kose |
0:9d70b2e8b1ec | 74 | #define CS_PIN P6_5 |
Ismail Kose |
0:9d70b2e8b1ec | 75 | #define EXTCOM_PIN P6_4 |
Ismail Kose |
0:9d70b2e8b1ec | 76 | #define DISP_PIN P6_6 |
Ismail Kose |
0:9d70b2e8b1ec | 77 | #define DISPSEL_PIN NC |
Ismail Kose |
0:9d70b2e8b1ec | 78 | |
Ismail Kose |
0:9d70b2e8b1ec | 79 | class MAX32630HSP |
Ismail Kose |
0:9d70b2e8b1ec | 80 | { |
Ismail Kose |
0:9d70b2e8b1ec | 81 | public: |
Ismail Kose |
0:9d70b2e8b1ec | 82 | // max32630hsp configuration utilities |
Ismail Kose |
0:9d70b2e8b1ec | 83 | |
Ismail Kose |
0:9d70b2e8b1ec | 84 | /** |
Ismail Kose |
0:9d70b2e8b1ec | 85 | * @brief IO Voltage |
Ismail Kose |
0:9d70b2e8b1ec | 86 | * @details Enumerated options for operating voltage |
Ismail Kose |
0:9d70b2e8b1ec | 87 | */ |
Ismail Kose |
0:9d70b2e8b1ec | 88 | typedef enum { |
Ismail Kose |
0:9d70b2e8b1ec | 89 | VIO_1V8 = 0x00, ///< 1.8V IO voltage at headers (from BUCK2) |
Ismail Kose |
0:9d70b2e8b1ec | 90 | VIO_3V3 = 0x01, ///< 3.3V IO voltage at headers (from LDO2) |
Ismail Kose |
0:9d70b2e8b1ec | 91 | } vio_t; |
Ismail Kose |
0:9d70b2e8b1ec | 92 | |
Ismail Kose |
0:9d70b2e8b1ec | 93 | /** |
Ismail Kose |
0:9d70b2e8b1ec | 94 | * MAX32630HSP constructor. |
Ismail Kose |
0:9d70b2e8b1ec | 95 | * |
Ismail Kose |
0:9d70b2e8b1ec | 96 | */ |
Ismail Kose |
0:9d70b2e8b1ec | 97 | MAX32630HSP(); |
Ismail Kose |
0:9d70b2e8b1ec | 98 | |
Ismail Kose |
0:9d70b2e8b1ec | 99 | /** |
Ismail Kose |
0:9d70b2e8b1ec | 100 | * MAX32630HSP constructor. |
Ismail Kose |
0:9d70b2e8b1ec | 101 | * |
Ismail Kose |
0:9d70b2e8b1ec | 102 | */ |
Ismail Kose |
0:9d70b2e8b1ec | 103 | MAX32630HSP(vio_t vio); |
Ismail Kose |
0:9d70b2e8b1ec | 104 | |
Ismail Kose |
0:9d70b2e8b1ec | 105 | /** |
Ismail Kose |
0:9d70b2e8b1ec | 106 | * MAX32630HSP destructor. |
Ismail Kose |
0:9d70b2e8b1ec | 107 | */ |
Ismail Kose |
0:9d70b2e8b1ec | 108 | ~MAX32630HSP(); |
Ismail Kose |
0:9d70b2e8b1ec | 109 | |
Ismail Kose |
0:9d70b2e8b1ec | 110 | /** |
Ismail Kose |
0:9d70b2e8b1ec | 111 | * @brief Initialize MAX32630HSP board |
Ismail Kose |
0:9d70b2e8b1ec | 112 | * @details Initializes PMIC and I/O on MAX32630HSP board. |
Ismail Kose |
0:9d70b2e8b1ec | 113 | * Configures PMIC to enable LDO2 and LDO3 at 3.3V. |
Ismail Kose |
0:9d70b2e8b1ec | 114 | * Disables resisitive pulldown on MON(AIN_0) |
Ismail Kose |
0:9d70b2e8b1ec | 115 | * Sets default I/O voltages to 3V3 for micro SD card. |
Ismail Kose |
0:9d70b2e8b1ec | 116 | * Sets I/O voltage for header pins to hdrVio specified. |
Ismail Kose |
0:9d70b2e8b1ec | 117 | * @param hdrVio I/O voltage for header pins |
Ismail Kose |
0:9d70b2e8b1ec | 118 | * @returns 0 if no errors, -1 if error. |
Ismail Kose |
0:9d70b2e8b1ec | 119 | */ |
Ismail Kose |
0:9d70b2e8b1ec | 120 | int init(vio_t hdrVio); |
Ismail Kose |
0:9d70b2e8b1ec | 121 | |
Ismail Kose |
0:9d70b2e8b1ec | 122 | /** |
Ismail Kose |
0:9d70b2e8b1ec | 123 | * @brief Sets I/O Voltage |
Ismail Kose |
0:9d70b2e8b1ec | 124 | * @details Sets the voltage rail to be used for a given pin. |
Ismail Kose |
0:9d70b2e8b1ec | 125 | * VIO_1V8 selects VDDIO which is supplied by Buck2, which is set at 1.8V, |
Ismail Kose |
0:9d70b2e8b1ec | 126 | * VIO_3V3 selects VDDIOH which is supplied by LDO2, which is typically 3.3V/ |
Ismail Kose |
0:9d70b2e8b1ec | 127 | * @param pin Pin whose voltage supply is being assigned. |
Ismail Kose |
0:9d70b2e8b1ec | 128 | * @param vio Voltage rail to be used for specified pin. |
Ismail Kose |
0:9d70b2e8b1ec | 129 | * @returns 0 if no errors, -1 if error. |
Ismail Kose |
0:9d70b2e8b1ec | 130 | */ |
Ismail Kose |
0:9d70b2e8b1ec | 131 | int vddioh(PinName pin, vio_t vio); |
Ismail Kose |
0:9d70b2e8b1ec | 132 | |
Ismail Kose |
0:9d70b2e8b1ec | 133 | /* Set vddio for Sharp LS013B7DH03 Display */ |
Ismail Kose |
0:9d70b2e8b1ec | 134 | void enableDisplay(void); |
Ismail Kose |
0:9d70b2e8b1ec | 135 | |
Ismail Kose |
0:9d70b2e8b1ec | 136 | /// Local I2C bus for configuring PMIC and accessing BMI160 IMU. |
Ismail Kose |
0:9d70b2e8b1ec | 137 | I2C i2c; |
Ismail Kose |
0:9d70b2e8b1ec | 138 | |
Ismail Kose |
0:9d70b2e8b1ec | 139 | /// MAX20303 PMIC Instance |
Ismail Kose |
0:9d70b2e8b1ec | 140 | MAX20303 max20303; |
Ismail Kose |
0:9d70b2e8b1ec | 141 | }; |
Ismail Kose |
0:9d70b2e8b1ec | 142 | |
Ismail Kose |
0:9d70b2e8b1ec | 143 | #endif /* _MAX32630HSP_H_ */ |