Maxim Integrated / Mbed OS HSP3_USB_serial

Dependencies:   USBDevice max32630hsp3

Run the Code

  • Import it into the mbed online compiler.
  • Compile the program.
  • It will automatically download the .bin file.
  • Drag-drop or copy-paste the .bin file to the programmer drive. (PICO DAPLINK).
  • Open a serial terminal (Putty, Tera Term, etc.)
  • Find the COM port that the device is connected to and set that COM port in the terminal. Adjust the baudrate to 9600.
  • Press the reset button on the microcontroller board. Now you should see another COM port on the device manager
  • You should now see the temperature values on the terminal with 0.5-second intervals.

Files at this revision

API Documentation at this revision

Comitter:
Emre.Eken
Date:
Wed Apr 25 11:44:53 2018 +0300
Parent:
2:bc6feae09da3
Child:
4:00136669e20b
Commit message:
max32630hsp.lib is added instead of the folder max32630hsp

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
max32630hsp.lib Show annotated file Show diff for this revision Revisions of this file
max32630hsp/MAX20303/MAX20303.cpp Show diff for this revision Revisions of this file
max32630hsp/MAX20303/MAX20303.h Show diff for this revision Revisions of this file
max32630hsp/max32630hsp.cpp Show diff for this revision Revisions of this file
max32630hsp/max32630hsp.h Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Apr 24 15:20:52 2018 +0300
+++ b/main.cpp	Wed Apr 25 11:44:53 2018 +0300
@@ -5,7 +5,7 @@
 MAX32630HSP icarus(MAX32630HSP::VIO_3V3);
 
 // Hardware serial port over DAPLink
-Serial daplink(P2_0, P2_1);
+Serial daplink(USBTX, USBRX);
 
 // Virtual serial port over USB
 USBSerial microUSB; 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/max32630hsp.lib	Wed Apr 25 11:44:53 2018 +0300
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/MaximIntegrated/code/max32630hsp3/#60c0cc971d85
\ No newline at end of file
--- a/max32630hsp/MAX20303/MAX20303.cpp	Tue Apr 24 15:20:52 2018 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,305 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2018 Maxim Integrated Products, Inc., All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
- * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of Maxim Integrated
- * Products, Inc. shall not be used except as stated in the Maxim Integrated
- * Products, Inc. Branding Policy.
- *
- * The mere transfer of this software does not imply any licenses
- * of trade secrets, proprietary technology, copyrights, patents,
- * trademarks, maskwork rights, or any other form of intellectual
- * property whatsoever. Maxim Integrated Products, Inc. retains all
- * ownership rights.
- *******************************************************************************
- */
-
-
-#include "MAX20303.h"
-
-
-
-//******************************************************************************
-MAX20303::MAX20303(I2C *i2c):
-	m_i2c(i2c), m_writeAddress(MAX20303_SLAVE_WR_ADDR),
-	m_readAddress(MAX20303_SLAVE_RD_ADDR)
-{
-}
-
-
-//******************************************************************************
-MAX20303::~MAX20303(void)
-{
-  //empty block
-}
-
-
-//******************************************************************************
-int MAX20303::LDO1Config()
-{
-	int32_t ret = 0;
-	uint8_t val;
-//	ret |= writeReg(MAX20303::REG_AP_CMDOUT, 0x40);
-//	ret |= writeReg(MAX20303::REG_AP_DATOUT0, 0x05);
-//	ret |= writeReg(MAX20303::REG_AP_DATOUT1, 0x34);
-//
-//	readReg(MAX20303::REG_AP_CMDOUT, val);
-//	readReg(MAX20303::REG_AP_DATOUT0, val);
-//	readReg(MAX20303::REG_AP_DATOUT1, val);
-	appcmdoutvalue_ = 0x40;
-	appdatainoutbuffer_[0] = 0x05;
-	appdatainoutbuffer_[1] = 0x34;
-	AppWrite(2);
-
-
-
-
-	return ret;
-}
-
-//******************************************************************************
-int MAX20303::writeReg(registers_t reg, uint8_t value)
-{
-	int32_t ret;
-
-	char cmdData[2] = {reg, value};
-
-	ret = m_i2c->write(m_writeAddress, cmdData, sizeof(cmdData));
-	//printf("MAX20303 write reg[0x%X]=0x%X, ret=%d\r\n", (uint32_t)reg, value, ret)
-
-	if (ret != 0)
-		return MAX20303_ERROR;
-
-	return MAX20303_NO_ERROR;
-}
-
-
-//******************************************************************************
-int MAX20303::readReg(registers_t reg, uint8_t &value)
-{
-	int32_t ret;
-
-	char data = reg;
-
-	ret = m_i2c->write(m_writeAddress, &data, sizeof(data));
-	if (ret != 0) {
-		printf("%s - failed - ret: %d\n", __func__);
-		return MAX20303_ERROR;
-	}
-
-	ret = m_i2c->read(m_readAddress, &data, sizeof(data));
-	if (ret != 0) {
-		printf("%s - failed - ret: %d\n", __func__);
-		return MAX20303_ERROR;
-	}
-
-	value = data;
-	printf("MAX20303 read reg[0x%X]=0x%X, ret=%d\r\n", (uint32_t)reg, value, ret);
-	return MAX20303_NO_ERROR;
-}
-
-//******************************************************************************
-int MAX20303::readRegMulti(registers_t reg, uint8_t *value, uint8_t len){
-	int32_t ret;
-	char data = reg;
-
-	ret = m_i2c->write(m_writeAddress, &data, sizeof(data));
-	if (ret != 0) {
-		printf("%s - failed - ret: %d\n", __func__);
-		return MAX20303_ERROR;
-	}
-
-	ret = m_i2c->read(m_readAddress, (char *)value, len);
-	if (ret != 0) {
-		printf("%s - failed - ret: %d\n", __func__);
-		return MAX20303_ERROR;
-	}
-
-	printf("MAX20303 read reg[0x%X]=0x%X, ret=%d\r\n", (uint32_t)reg, value, ret);
-	return MAX20303_NO_ERROR;
-}
-
-//******************************************************************************
-int MAX20303::writeRegMulti(registers_t reg, uint8_t *value, uint8_t len){
-	int32_t ret;
-	i2cbuffer_[0] = reg;
-	memcpy(&i2cbuffer_[1], value, len);
-
-	ret = m_i2c->write(m_writeAddress, (char *)i2cbuffer_, (len+1));
-	//printf("MAX20303 write reg[0x%X]=0x%X, ret=%d\r\n", (uint32_t)reg, value, ret)
-
-	if (ret != 0)
-		return MAX20303_ERROR;
-
-	return MAX20303_NO_ERROR;
-}
-//******************************************************************************
-int MAX20303::mv2bits(int mV)
-{
-    int regBits;
-
-    if (( MAX20303_LDO_MIN_MV <= mV) && (mV <= MAX20303_LDO_MAX_MV)) {
-        regBits = (mV -  MAX20303_LDO_MIN_MV) /  MAX20303_LDO_STEP_MV;
-    } else {
-        return -1;
-    }
-
-    return regBits;
-}
-//******************************************************************************
-int MAX20303::PowerOffthePMIC(){
-	int ret;
-	appdatainoutbuffer_[0] = 0xB2;
-	appcmdoutvalue_ = 0x80;
-	ret = AppWrite(1);
-
-	if(appcmdoutvalue_ != 0x80){
-		ret |= MAX20303_ERROR;
-	}
-
-	return ret;
-}
-//******************************************************************************
-int MAX20303::SoftResetthePMIC(){
-	int ret;
-	appdatainoutbuffer_[0] = 0xB3;
-	appcmdoutvalue_ = 0x81;
-	ret = AppWrite(1);
-
-	if(appcmdoutvalue_ != 0x81){
-		ret |= MAX20303_ERROR;
-	}
-
-	return ret;
-}
-//******************************************************************************
-int MAX20303::HardResetthePMIC(){
-	int ret;
-	appdatainoutbuffer_[0] = 0xB4;
-	appcmdoutvalue_ = 0x82;
-	ret = AppWrite(1);
-
-	if(appcmdoutvalue_ != 0x82){
-		ret |= MAX20303_ERROR;
-	}
-
-	return ret;
-}
-
-//******************************************************************************
-int MAX20303::AppWrite(uint8_t dataoutlen){
-	int ret;
-
-	ret = writeRegMulti(MAX20303::REG_AP_DATOUT0, appdatainoutbuffer_, dataoutlen);
-	ret |= writeReg(MAX20303::REG_AP_CMDOUT, appcmdoutvalue_);
-	wait_ms(10);
-	ret |= readReg(MAX20303::REG_AP_RESPONSE, appcmdoutvalue_);
-
-	if(ret != 0)
-		return MAX20303_ERROR;
-
-	return MAX20303_NO_ERROR;
-}
-
-
-//******************************************************************************
-int MAX20303::AppRead(uint8_t datainlen){
-	int ret;
-
-	ret = writeReg(MAX20303::REG_AP_CMDOUT, appcmdoutvalue_);
-	wait_ms(10);
-	ret |= readRegMulti(MAX20303::REG_AP_RESPONSE, i2cbuffer_, datainlen);
-	if(ret != 0)
-		return MAX20303_ERROR;
-
-	return MAX20303_NO_ERROR;
-}
-
-//******************************************************************************
-char MAX20303::CheckPMICHWID(){
-	int ret;
-	uint8_t value = 0x00;
-
-	ret = readReg(MAX20303::REG_HARDWARE_ID, value);
-	if(ret != MAX20303_NO_ERROR)
-		return false;
-
-	if(value == 0x02)
-		return true;
-	else
-		return false;
-}
-
-//******************************************************************************
-int MAX20303::led0on(char enable) {
-
-	if(enable)
-		return writeReg(REG_LED0_DIRECT, 0x21);
-	else
-		return writeReg(REG_LED0_DIRECT, 0x01);
-}
-
-//******************************************************************************
-int MAX20303::led1on(char enable) {
-	if(enable)
-		return writeReg(REG_LED1_DIRECT, 0x21);
-	else
-		return writeReg(REG_LED1_DIRECT, 0x01);
-}
-
-//******************************************************************************
-int MAX20303::led2on(char enable) {
-	if(enable)
-		return writeReg(REG_LED2_DIRECT, 0x21);
-	else
-		return writeReg(REG_LED2_DIRECT, 0x01);
-}
-
-
-//******************************************************************************
-int MAX20303::BoostEnable(void) {
-
-	writeReg(REG_AP_CMDOUT, 0x30);
-	writeReg(REG_AP_DATOUT3, 0x00);	// 00 : 5V
-	writeReg(REG_AP_DATOUT0, 0x01);	// Boost Enabled
-
-	return MAX20303_NO_ERROR;
-}
-
-//******************************************************************************
-int MAX20303::BuckBoostEnable(void)
-{
-	int ret = 0;
-
-	ret |= writeReg( REG_AP_DATOUT0,  0x00);    // Reserved = 0x00
-	ret |= writeReg( REG_AP_DATOUT1,  0x04);    // BBstlSet = 0b'100   Buck Boost Peak current Limit = 200mA
-	ret |= writeReg( REG_AP_DATOUT2,  0x19);    // BBstVSet = 0b'11001  Buck Boost Output Voltage = 5V
-	ret |= writeReg( REG_AP_DATOUT3,  0x01);    // BBstRipRed = 1 Ripple Reduction
-	// BBstAct    = 1 Actively discharged in Hard-Reset or Enable Low
-	// BBstPas    = 1 Passively discharged in Hard-Reset or Enable Low
-	// BBstMd     = 1 Damping Enabled
-	// BBstInd    = 0  Inductance is 4.7uH
-	// BBstEn     = 0b'01 Enabled
-	ret |= writeReg( REG_AP_CMDOUT, 0x70);
-	if (ret != 0)
-		return MAX20303_ERROR;
-
-	return MAX20303_NO_ERROR;
-}
--- a/max32630hsp/MAX20303/MAX20303.h	Tue Apr 24 15:20:52 2018 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2018 Maxim Integrated Products, Inc., All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
- * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of Maxim Integrated
- * Products, Inc. shall not be used except as stated in the Maxim Integrated
- * Products, Inc. Branding Policy.
- *
- * The mere transfer of this software does not imply any licenses
- * of trade secrets, proprietary technology, copyrights, patents,
- * trademarks, maskwork rights, or any other form of intellectual
- * property whatsoever. Maxim Integrated Products, Inc. retains all
- * ownership rights.
- *******************************************************************************
- */
-#ifndef __MAX20303_H_
-#define __MAX20303_H_
-
-#include "mbed.h"
-
-#define MAX20303_SLAVE_ADDR		(0x50 >> 1)
-#define MAX20303_SLAVE_WR_ADDR		((MAX20303_SLAVE_ADDR << 1))
-#define MAX20303_SLAVE_RD_ADDR		((MAX20303_SLAVE_ADDR << 1) | 1)
-
-
-#define MAX20303_NO_ERROR   0
-#define MAX20303_ERROR      -1
-
-#define MAX20303_I2C_ADDR_FUEL_GAUGE	0x6c
-
-#define MAX20303_LDO_MIN_MV 800
-#define MAX20303_LDO_MAX_MV 3600
-#define MAX20303_LDO_STEP_MV 100
-
-#define MAX20303_OFF_COMMAND 0xB2
-
-class MAX20303
-{
-
-public:
-	/**
-	 * @brief   Register Addresses
-	 * @details Enumerated MAX20303 register addresses
-	 */
-	enum registers_t {
-		REG_HARDWARE_ID		= 0x00,		///< HardwareID Register
-		REG_FIRMWARE_REV	= 0x01,		///< FirmwareID Register
-		//					= 0x02,		///<
-		REG_INT0			= 0x03,		///< Int0 Register
-		REG_INT1			= 0x04,		///< Int1 Register
-		REG_INT2			= 0x05,		///< Int2 Register
-		REG_STATUS0			= 0x06,		///< Status Register 0
-		REG_STATUS1			= 0x07,		///< Status Register 1
-		REG_STATUS2			= 0x08,		///< Status Register 2
-		REG_STATUS3			= 0x09,		///< Status Register 2
-		//					= 0x0A,		///<
-		REG_SYSTEM_ERROR	= 0x0B,		///< SystemError Register
-		REG_INT_MASK0		= 0x0C,		///< IntMask0 Register
-		REG_INT_MASK1		= 0x0D,		///< IntMask1 Register
-		REG_INT_MASK2		= 0x0E,		///< IntMask1 Register
-		REG_AP_DATOUT0		= 0x0F,     ///< APDataOut0 Register
-		REG_AP_DATOUT1		= 0x10,     ///< APDataOut1 Register
-		REG_AP_DATOUT2		= 0x11,     ///< APDataOut2 Register
-		REG_AP_DATOUT3		= 0x12,     ///< APDataOut3 Register
-		REG_AP_DATOUT4		= 0x13,     ///< APDataOut4 Register
-		REG_AP_DATOUT5		= 0x14,     ///< APDataOut5 Register
-		REG_AP_DATOUT6		= 0x15,     ///< APDataOut6 Register
-		REG_AP_CMDOUT		= 0x17,     ///< APCmdOut Register
-		REG_AP_RESPONSE		= 0x18,     ///< APResponse Register
-		REG_AP_DATAIN0		= 0x19,
-		REG_AP_DATAIN1		= 0x1A,
-		REG_AP_DATAIN2		= 0x1B,
-		REG_AP_DATAIN3		= 0x1C,
-		REG_AP_DATAIN4		= 0x1D,
-		REG_AP_DATAIN5		= 0x1E,
-		//					= 0x1F,		///<
-		REG_LDO_DIRECT		= 0x20,
-		REG_MPC_DIRECTWRITE	= 0x21,
-		REG_MPC_DIRECTRED	= 0x22,
-
-		REG_LED_STEP_DIRECT	= 0x2C,
-		REG_LED0_DIRECT		= 0x2D,
-		REG_LED1_DIRECT		= 0x2E,
-		REG_LED2_DIRECT		= 0x2F,
-
-
-		REG_LDO1_CONFIG_WRITE = 0x40,
-		REG_LDO1_CONFIG_READ  = 0x41,
-		REG_LDO2_CONFIG_WRITE = 0x42,
-		REG_LDO2_CONFIG_READ  = 0x43
-
-		/*
-		REG_CHG_TMR = 0x0C,   ///< Charger Timers
-		REG_BUCK1_CFG = 0x0D,   ///< Buck 1 Configuration
-		REG_BUCK1_VSET = 0x0E,   ///< Buck 1 Voltage Setting
-		REG_BUCK2_CFG = 0x0F,   ///< Buck 2 Configuration
-		REG_BUCK2_VSET = 0x10,   ///< Buck 2 Voltage Setting
-		REG_RSVD_11 = 0x11,   ///< Reserved 0x11
-		REG_LDO1_CFG = 0x12,   ///< LDO 1 Configuration
-		REG_LDO1_VSET = 0x13,   ///< LDO 1 Voltage Setting
-		REG_LDO2_CFG = 0x14,   ///< LDO 2 Configuration
-		REG_LDO2_VSET = 0x15,   ///< LDO 2 Voltage Setting
-		REG_LDO3_CFG = 0x16,   ///< LDO 3 Configuration
-		REG_LDO3_VSET = 0x17,   ///< LDO 3 Voltage Setting
-		REG_THRM_CFG = 0x18,   ///< Thermistor Configuration
-		REG_MON_CFG = 0x19,   ///< Monitor Multiplexer Configuration
-		REG_BOOT_CFG = 0x1A,   ///< Boot Configuration
-		REG_PIN_STATUS = 0x1B,   ///< Pin Status
-		REG_BUCK_EXTRA = 0x1C,   ///< Additional Buck Settings
-		REG_PWR_CFG = 0x1D,   ///< Power Configuration
-		REG_NULL = 0x1E,   ///< Reserved 0x1E
-		REG_PWR_OFF = 0x1F,   ///< Power Off Register
-		*/
-	};
-
-	/**
-	* @brief  Constructor using reference to I2C object
-	* @param i2c - Reference to I2C object
-	* @param slaveAddress - 7-bit I2C address
-	*/
-	MAX20303(I2C *i2c);
-
-	/** @brief Destructor */
-	~MAX20303(void);
-
-	int led0on(char enable);
-	int led1on(char enable);
-	int led2on(char enable);
-	int BoostEnable(void);
-	int BuckBoostEnable(void);
-
-	/// @brief Enable the 1.8V output rail **/
-	int LDO1Config(void);
-	int mv2bits(int mV);
-
-	/** @brief Power Off the board
-	 */
-	int PowerOffthePMIC();
-
-	/** @brief Soft reset the PMIC
-	 */
-	int SoftResetthePMIC();
-
-	/** @brief Hard reset the PMIC
-	 */
-	int HardResetthePMIC();
-
-	/** @brief check if can communicate with max20303
-	*/
-	char CheckPMICHWID();
-
-private:
-
-	int writeReg(registers_t reg, uint8_t value);
-	int readReg(registers_t reg, uint8_t &value);
-
-	int writeRegMulti(registers_t reg, uint8_t *value, uint8_t len);
-	int readRegMulti(registers_t reg, uint8_t *value, uint8_t len);
-
-	/// I2C object
-	I2C  *m_i2c;
-
-	/// Device slave addresses
-	uint8_t m_writeAddress, m_readAddress;
-
-	// Application Processor Interface Related Variables
-	uint8_t i2cbuffer_[16];
-	uint8_t appdatainoutbuffer_[8];
-	uint8_t appcmdoutvalue_;
-
-
-	/** @brief API Related Functions ***/
-
-	/***
-	 *  @brief  starts writing from ApResponse register 0x0F
-	 *  check the datasheet to determine the value of dataoutlen
-	 */
-	int AppWrite(uint8_t dataoutlen);
-
-	/** @brief starts reading from ApResponse register 0x18
-	 *  check the datasheet to determine the value of datainlen
-	 *  the result values are written into i2cbuffer
-	 *
-	*/
-	int AppRead(uint8_t datainlen);
-};
-
-#endif /* __MAX20303_H_ */
--- a/max32630hsp/max32630hsp.cpp	Tue Apr 24 15:20:52 2018 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
- * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of Maxim Integrated
- * Products, Inc. shall not be used except as stated in the Maxim Integrated
- * Products, Inc. Branding Policy.
- *
- * The mere transfer of this software does not imply any licenses
- * of trade secrets, proprietary technology, copyrights, patents,
- * trademarks, maskwork rights, or any other form of intellectual
- * property whatsoever. Maxim Integrated Products, Inc. retains all
- * ownership rights.
- *******************************************************************************
- */
-
-#include "mbed.h"
-#include "max3263x.h"
-#include "ioman_regs.h"
-#include "PinNames.h"
-#include "max32630hsp.h"
-
-//******************************************************************************
-MAX32630HSP::MAX32630HSP() : i2c(P5_7, P6_0), max20303(&i2c)
-{
-}
-
-//******************************************************************************
-MAX32630HSP::MAX32630HSP(vio_t vio) : i2c(P5_7, P6_0), max20303(&i2c)
-{
-    init(vio);
-}
-
-//******************************************************************************
-MAX32630HSP::~MAX32630HSP()
-{
-
-}
-
-//******************************************************************************
-int MAX32630HSP::init(vio_t hdrVio)
-{
-    // Set LED pins to 3.3V
-    vddioh(P2_4, VIO_3V3);
-    vddioh(P2_5, VIO_3V3);
-    vddioh(P2_6, VIO_3V3);
-
-    // Set header pins to hdrVio
-    vddioh(P3_0, hdrVio);
-    vddioh(P3_1, hdrVio);
-    vddioh(P3_2, hdrVio);
-    vddioh(P3_3, hdrVio);
-    vddioh(P3_4, hdrVio);
-    vddioh(P3_5, hdrVio);
-    vddioh(P4_0, hdrVio);
-    vddioh(P4_1, hdrVio);
-    vddioh(P4_2, hdrVio);
-    vddioh(P4_3, hdrVio);
-    vddioh(P4_4, hdrVio);
-    vddioh(P4_5, hdrVio);
-    vddioh(P4_6, hdrVio);
-    vddioh(P4_7, hdrVio);
-    vddioh(P5_0, hdrVio);
-    vddioh(P5_1, hdrVio);
-    vddioh(P5_2, hdrVio);
-    vddioh(P5_3, hdrVio);
-    vddioh(P5_4, hdrVio);
-    vddioh(P5_5, hdrVio);
-    vddioh(P5_6, hdrVio);
-
-	/* Wait for pmic to settle down */
-	wait_ms(1000);
-	//max20303.led0on();
-	/*Set LDO1 to 1.8v*/
-	max20303.LDO1Config();
-	max20303.BoostEnable();
-	max20303.BuckBoostEnable();
-    return 0;
-}
-
-void MAX32630HSP::enableDisplay(void)
-{
-	vddioh(P6_4, VIO_3V3); //EXTCOM
-	vddioh(P6_1, VIO_3V3); //SCLK
-	vddioh(P6_2, VIO_3V3); //MOSI1
-	vddioh(P6_5, VIO_3V3); //SCS
-	vddioh(P6_4, VIO_3V3); //EXTCOM
-	vddioh(P6_6, VIO_3V3); //DISP
-}
-
-//******************************************************************************
-int MAX32630HSP::vddioh(PinName pin, vio_t vio)
-{
-    __IO uint32_t *use_vddioh = &((mxc_ioman_regs_t *)MXC_IOMAN)->use_vddioh_0;
-
-    if (pin == NOT_CONNECTED) {
-        return -1;
-    }
-
-    use_vddioh += PINNAME_TO_PORT(pin) >> 2;
-    if (vio) {
-        *use_vddioh |= (1 << (PINNAME_TO_PIN(pin) + ((PINNAME_TO_PORT(pin) & 0x3) << 3)));
-    } else {
-        *use_vddioh &= ~(1 << (PINNAME_TO_PIN(pin) + ((PINNAME_TO_PORT(pin) & 0x3) << 3)));
-    }
-
-    return 0;
-}
--- a/max32630hsp/max32630hsp.h	Tue Apr 24 15:20:52 2018 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
- * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of Maxim Integrated
- * Products, Inc. shall not be used except as stated in the Maxim Integrated
- * Products, Inc. Branding Policy.
- *
- * The mere transfer of this software does not imply any licenses
- * of trade secrets, proprietary technology, copyrights, patents,
- * trademarks, maskwork rights, or any other form of intellectual
- * property whatsoever. Maxim Integrated Products, Inc. retains all
- * ownership rights.
- *******************************************************************************
- */
-
-#ifndef _MAX32630HSP_H_
-#define _MAX32630HSP_H_
-
-#include "mbed.h"
-#include "MAX20303.h"
-
-/**
- * @brief MAX32630HSP Board Support Library
- *
- * @details The MAX32630HSP is a rapid development application board for
- * ultra low power wearable applications.  It includes common peripherals and
- * expansion connectors all power optimized for getting the longest life from
- * the battery.  This library configures the power and I/O for the board.
- * <br>https://www.maximintegrated.com/max32630hsp
- *
- * @code
- * #include "mbed.h"
- * #include "max32630hsp.h"
- *
- * DigitalOut led1(LED1);
- * MAX32630HSP icarus(MAX32630HSP::VIO_3V3);
- *
- * // main() runs in its own thread in the OS
- * // (note the calls to Thread::wait below for delays)
- * int main()
- * {
- *     // initialize power and I/O on MAX32630HSP board
- *     icarus.init();
- *
- *     while (true) {
- *         led1 = !led1;
- *         Thread::wait(500);
- *     }
- * }
- * @endcode
- */
-
-// Sharp LS013B7DH03 Memory Display
-#define SCK_PIN     P6_1
-#define MOSI_PIN    P6_2
-#define CS_PIN      P6_5
-#define EXTCOM_PIN  P6_4
-#define DISP_PIN    P6_6
-#define DISPSEL_PIN NC
-
-class MAX32630HSP
-{
-public:
-// max32630hsp configuration utilities
-
-    /**
-      * @brief   IO Voltage
-      * @details Enumerated options for operating voltage
-      */
-    typedef enum {
-        VIO_1V8 = 0x00,    ///< 1.8V IO voltage at headers (from BUCK2)
-        VIO_3V3 = 0x01,    ///< 3.3V IO voltage at headers (from LDO2)
-    } vio_t;
-
-    /**
-        * MAX32630HSP constructor.
-        *
-        */
-    MAX32630HSP();
-
-    /**
-        * MAX32630HSP constructor.
-        *
-        */
-    MAX32630HSP(vio_t vio);
-
-    /**
-        * MAX32630HSP destructor.
-        */
-    ~MAX32630HSP();
-
-    /**
-     * @brief   Initialize MAX32630HSP board
-     * @details Initializes PMIC and I/O on MAX32630HSP board.
-     *  Configures PMIC to enable LDO2 and LDO3 at 3.3V.
-     *  Disables resisitive pulldown on MON(AIN_0)
-     *  Sets default I/O voltages to 3V3 for micro SD card.
-     *  Sets I/O voltage for header pins to hdrVio specified.
-     * @param hdrVio I/O voltage for header pins
-     * @returns 0 if no errors, -1 if error.
-    */
-    int init(vio_t hdrVio);
-
-    /**
-     * @brief   Sets I/O Voltage
-     * @details Sets the voltage rail to be used for a given pin.
-     *  VIO_1V8 selects VDDIO which is supplied by Buck2, which is set at 1.8V,
-     *  VIO_3V3 selects VDDIOH which is supplied by LDO2, which is typically 3.3V/
-     * @param   pin Pin whose voltage supply is being assigned.
-     * @param   vio Voltage rail to be used for specified pin.
-     * @returns 0 if no errors, -1 if error.
-    */
-    int vddioh(PinName pin, vio_t vio);
-
-	/* Set vddio for Sharp LS013B7DH03 Display */
-	void enableDisplay(void);
-
-    /// Local I2C bus for configuring PMIC and accessing BMI160 IMU.
-    I2C i2c;
-
-    /// MAX20303 PMIC Instance
-    MAX20303 max20303;
-};
-
-#endif /* _MAX32630HSP_H_ */