Maxim Integrated / MAX32620FTHR

Dependents:   MAX32620FTHR_Pmic MAX32620FTHR_Pmic_Boot MAX32620FTHR_GPS_Tracker firmware_framework1

Fork of MAX32620FTHR by Jesse Marroquin

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MAX32620FTHR.h Source File

MAX32620FTHR.h

00001 /*******************************************************************************
00002  * Copyright (C) 2018 Maxim Integrated Products, Inc., All Rights Reserved.
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a
00005  * copy of this software and associated documentation files (the "Software"),
00006  * to deal in the Software without restriction, including without limitation
00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00008  * and/or sell copies of the Software, and to permit persons to whom the
00009  * Software is furnished to do so, subject to the following conditions:
00010  *
00011  * The above copyright notice and this permission notice shall be included
00012  * in all copies or substantial portions of the Software.
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00016  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00017  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
00018  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00020  * OTHER DEALINGS IN THE SOFTWARE.
00021  *
00022  * Except as contained in this notice, the name of Maxim Integrated
00023  * Products, Inc. shall not be used except as stated in the Maxim Integrated
00024  * Products, Inc. Branding Policy.
00025  *
00026  * The mere transfer of this software does not imply any licenses
00027  * of trade secrets, proprietary technology, copyrights, patents,
00028  * trademarks, maskwork rights, or any other form of intellectual
00029  * property whatsoever. Maxim Integrated Products, Inc. retains all
00030  * ownership rights.
00031  *******************************************************************************
00032  */
00033 
00034 #ifndef _MAX32620FTHR_H_
00035 #define _MAX32620FTHR_H_
00036 
00037 #include "mbed.h"
00038 
00039 /**
00040  * @brief MAX32620FTHR Board Support Library
00041  *
00042  * @details The MAX32620FTHR is a rapid development application board for
00043  * ultra low power wearable applications.  It includes common peripherals and
00044  * expansion connectors all power optimized for getting the longest life from
00045  * the battery.  This library configures the power and I/O for the board.
00046  * <br>https://www.maximintegrated.com/max32620fthr
00047  *
00048  * @code
00049  * #include "mbed.h"
00050  * #include "MAX32620FTHR.h"
00051  *
00052  * DigitalOut led1(LED1);
00053  *
00054  * // Initialize I/O voltages on MAX32620FTHR board
00055  * MAX32620FTHR fthr(MAX32620FTHR::VIO_3V3);
00056  *
00057  * // main() runs in its own thread in the OS
00058  * // (note the calls to Thread::wait below for delays)
00059  * int main()
00060  * {
00061  *     while (true) {
00062  *         led1 = !led1;
00063  *         Thread::wait(500);
00064  *     }
00065  * }
00066  * @endcode
00067  */
00068 class MAX32620FTHR
00069 {
00070 public:
00071     // max32620fthr configuration utilities
00072 
00073     /**
00074       * @brief   IO Voltage
00075       * @details Enumerated options for operating voltage
00076       */
00077     typedef enum {
00078         VIO_1V8 = 0x00,    ///< 1.8V IO voltage at headers (from BUCK0)
00079         VIO_3V3 = 0x01,    ///< 3.3V IO voltage at headers (from BUCK2)
00080     } vio_t;
00081 
00082     /**
00083      * MAX32620FTHR constructor.
00084      */
00085     MAX32620FTHR();
00086 
00087     /**
00088      * MAX32620FTHR constructor.
00089      */
00090     MAX32620FTHR(vio_t vio);
00091 
00092     /**
00093      * MAX32620FTHR destructor.
00094      */
00095     ~MAX32620FTHR();
00096 
00097     /**
00098      * @brief   Initialize MAX32620FTHR board
00099      * @details Initializes I/O voltage on MAX32620FTHR board.
00100      *  Sets I/O voltage for LEDs to 3.3V and header pins to hdrVio specified.
00101      * @param hdrVio I/O voltage for header pins
00102      * @returns 0 if no errors, -1 if error.
00103     */
00104     int init(vio_t hdrVio);
00105 
00106     /**
00107      * @brief   Sets I/O Voltage
00108      * @details Sets the voltage rail to be used for a given pin.
00109      *  VIO_1V8 selects VDDIO which is supplied by Buck0, which is set at 1.8V,
00110      *  VIO_3V3 selects VDDIOH which is supplied by Buck2, which is typically 3.3V
00111      * @param   pin Pin whose voltage supply is being assigned.
00112      * @param   vio Voltage rail to be used for specified pin.
00113      * @returns 0 if no errors, -1 if error.
00114     */
00115     int vddioh(PinName pin, vio_t vio);
00116 };
00117 
00118 #endif /* _MAX32620FTHR_H_ */