Board library for MAX32630FTHR platform

Dependencies:   MAX14690

Dependents:   FTHR_OLED MAX32630FTHR_ADC_Example Test_TFT_RT MAX32630FTHR_RGB ... more

Fork of max32630fthr by Greg Steiert

Committer:
phonemacro
Date:
Thu Feb 14 09:20:32 2019 +0000
Revision:
14:8f6e6a800f2f
Parent:
5:8e424775234a
Move max31875 library back to correct spot.

Who changed what in which revision?

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