ch1 test1

Dependencies:   MAX14690

Committer:
switches
Date:
Sun Nov 20 23:31:36 2016 +0000
Revision:
1:15e34492fbf1
Parent:
0:8926602da648
Child:
2:7a1d7d6d520e
Created MAX32630FTHR class for board support functions

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 1:15e34492fbf1 40 class MAX32630FTHR
switches 1:15e34492fbf1 41 {
switches 1:15e34492fbf1 42 public:
switches 0:8926602da648 43 // max32630fthr configuration utilities
switches 0:8926602da648 44
switches 1:15e34492fbf1 45 /**
switches 1:15e34492fbf1 46 * @brief IO Voltage
switches 1:15e34492fbf1 47 * @details Enumerated options for operating voltage
switches 1:15e34492fbf1 48 */
switches 1:15e34492fbf1 49 typedef enum {
switches 1:15e34492fbf1 50 VIO_1V8 = 0x00, ///< 1.8V IO voltage at headers (from BUCK2)
switches 1:15e34492fbf1 51 VIO_3V3 = 0x01, ///< 3.3V IO voltage at headers (from LDO2)
switches 1:15e34492fbf1 52 } vio_t;
switches 1:15e34492fbf1 53
switches 1:15e34492fbf1 54 /**
switches 1:15e34492fbf1 55 * MAX32630FTHR constructor.
switches 1:15e34492fbf1 56 *
switches 1:15e34492fbf1 57 * @param vio I/O voltage for header pins
switches 1:15e34492fbf1 58 */
switches 1:15e34492fbf1 59 MAX32630FTHR(vio_t vio);
switches 1:15e34492fbf1 60
switches 1:15e34492fbf1 61 /**
switches 1:15e34492fbf1 62 * MAX32630FTHR destructor.
switches 1:15e34492fbf1 63 */
switches 1:15e34492fbf1 64 ~MAX32630FTHR();
switches 0:8926602da648 65
switches 1:15e34492fbf1 66 /**
switches 1:15e34492fbf1 67 * @brief Initialize MAX32630FTHR board
switches 1:15e34492fbf1 68 * @details Initializes PMIC and I/O on MAX32630FTHR board.
switches 1:15e34492fbf1 69 * Configures PMIC to enable LDO2 and LDO3 at 3.3V.
switches 1:15e34492fbf1 70 * Disables resisitive pulldown on MON(AIN_0)
switches 1:15e34492fbf1 71 * Sets default I/O voltages to 3V3 for micro SD card.
switches 1:15e34492fbf1 72 * Sets I/O voltage for header pins to hdrVio specified.
switches 1:15e34492fbf1 73 * @returns 0 if no errors, -1 if error.
switches 1:15e34492fbf1 74 */
switches 1:15e34492fbf1 75 int init();
switches 1:15e34492fbf1 76
switches 1:15e34492fbf1 77 /**
switches 1:15e34492fbf1 78 * @brief Sets I/O Voltage
switches 1:15e34492fbf1 79 * @details Sets the voltage rail to be used for a given pin.
switches 1:15e34492fbf1 80 * VIO_1V8 selects VDDIO which is supplied by Buck2, which is set at 1.8V,
switches 1:15e34492fbf1 81 * VIO_3V3 selects VDDIOH which is supplied by LDO2, which is typically 3.3V/
switches 1:15e34492fbf1 82 * @param pin Pin whose voltage supply is being assigned.
switches 1:15e34492fbf1 83 * @param vio Voltage rail to be used for specified pin.
switches 1:15e34492fbf1 84 * @returns 0 if no errors, -1 if error.
switches 1:15e34492fbf1 85 */
switches 1:15e34492fbf1 86 int vddioh(PinName pin, vio_t vio);
switches 1:15e34492fbf1 87
switches 1:15e34492fbf1 88 /// Local I2C bus for configuring PMIC and accessing BMI160 IMU.
switches 1:15e34492fbf1 89 I2C i2c;
switches 1:15e34492fbf1 90
switches 1:15e34492fbf1 91 /// MAX14690 PMIC Instance
switches 1:15e34492fbf1 92 MAX14690 max14690;
switches 1:15e34492fbf1 93
switches 1:15e34492fbf1 94 /// The default I/O voltage to be used for header pins.
switches 1:15e34492fbf1 95 vio_t hdrVio;
switches 1:15e34492fbf1 96
switches 1:15e34492fbf1 97 };
switches 1:15e34492fbf1 98
switches 1:15e34492fbf1 99 #endif /* _MAX32630FTHR_H_ */