Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: max20303
Dependents: HSP3_USB_serial MAX32630HSP3_IMU_Hello_World
max32630hsp.cpp
00001 /******************************************************************************* 00002 * Copyright (C) 2016 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 #include "mbed.h" 00035 #include "max3263x.h" 00036 #include "ioman_regs.h" 00037 #include "PinNames.h" 00038 #include "max32630hsp.h" 00039 00040 //****************************************************************************** 00041 MAX32630HSP::MAX32630HSP() : i2c(P5_7, P6_0), max20303(&i2c) 00042 { 00043 } 00044 00045 //****************************************************************************** 00046 MAX32630HSP::MAX32630HSP(vio_t vio) : i2c(P5_7, P6_0), max20303(&i2c) 00047 { 00048 init(vio); 00049 } 00050 00051 //****************************************************************************** 00052 MAX32630HSP::~MAX32630HSP() 00053 { 00054 00055 } 00056 00057 //****************************************************************************** 00058 int MAX32630HSP::init(vio_t hdrVio) 00059 { 00060 // Set LED pins to 3.3V 00061 vddioh(P2_4, VIO_3V3); 00062 vddioh(P2_5, VIO_3V3); 00063 vddioh(P2_6, VIO_3V3); 00064 00065 // Set header pins to hdrVio 00066 vddioh(P3_0, hdrVio); 00067 vddioh(P3_1, hdrVio); 00068 vddioh(P3_2, hdrVio); 00069 vddioh(P3_3, hdrVio); 00070 vddioh(P3_4, hdrVio); 00071 vddioh(P3_5, hdrVio); 00072 vddioh(P4_0, hdrVio); 00073 vddioh(P4_1, hdrVio); 00074 vddioh(P4_2, hdrVio); 00075 vddioh(P4_3, hdrVio); 00076 vddioh(P4_4, hdrVio); 00077 vddioh(P4_5, hdrVio); 00078 vddioh(P4_6, hdrVio); 00079 vddioh(P4_7, hdrVio); 00080 vddioh(P5_0, hdrVio); 00081 vddioh(P5_1, hdrVio); 00082 vddioh(P5_2, hdrVio); 00083 vddioh(P5_3, hdrVio); 00084 vddioh(P5_4, hdrVio); 00085 vddioh(P5_5, hdrVio); 00086 vddioh(P5_6, hdrVio); 00087 00088 /* Wait for pmic to settle down */ 00089 wait_ms(1000); 00090 //max20303.led0on(); 00091 /*Set LDO1 to 1.8v*/ 00092 max20303.LDO1Config(); 00093 max20303.BoostEnable(); 00094 max20303.BuckBoostEnable(); 00095 return 0; 00096 } 00097 00098 void MAX32630HSP::enableDisplay(void) 00099 { 00100 vddioh(P6_4, VIO_3V3); //EXTCOM 00101 vddioh(P6_1, VIO_3V3); //SCLK 00102 vddioh(P6_2, VIO_3V3); //MOSI1 00103 vddioh(P6_5, VIO_3V3); //SCS 00104 vddioh(P6_4, VIO_3V3); //EXTCOM 00105 vddioh(P6_6, VIO_3V3); //DISP 00106 } 00107 00108 //****************************************************************************** 00109 int MAX32630HSP::vddioh(PinName pin, vio_t vio) 00110 { 00111 __IO uint32_t *use_vddioh = &((mxc_ioman_regs_t *)MXC_IOMAN)->use_vddioh_0; 00112 00113 if (pin == NOT_CONNECTED) { 00114 return -1; 00115 } 00116 00117 use_vddioh += PINNAME_TO_PORT(pin) >> 2; 00118 if (vio) { 00119 *use_vddioh |= (1 << (PINNAME_TO_PIN(pin) + ((PINNAME_TO_PORT(pin) & 0x3) << 3))); 00120 } else { 00121 *use_vddioh &= ~(1 << (PINNAME_TO_PIN(pin) + ((PINNAME_TO_PORT(pin) & 0x3) << 3))); 00122 } 00123 00124 return 0; 00125 }
Generated on Tue Jul 19 2022 23:21:06 by
