Library for MAX32625PICO board. Configures IOH supply and I/O voltage rails.

Dependents:   MAX34417_demo BER_Board PICO_board_demo_copy PICO_board_demo ... more

Committer:
switches
Date:
Tue May 23 00:12:03 2017 +0000
Revision:
0:65bda25808e4
New library for the max32625pico board

Who changed what in which revision?

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