publishing

Dependencies:   USBDevice

Committer:
asilva14
Date:
Thu Mar 09 23:54:04 2017 +0000
Revision:
0:fd5a76956754
commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
asilva14 0:fd5a76956754 1 /*******************************************************************************
asilva14 0:fd5a76956754 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
asilva14 0:fd5a76956754 3 *
asilva14 0:fd5a76956754 4 * Permission is hereby granted, free of charge, to any person obtaining a
asilva14 0:fd5a76956754 5 * copy of this software and associated documentation files (the "Software"),
asilva14 0:fd5a76956754 6 * to deal in the Software without restriction, including without limitation
asilva14 0:fd5a76956754 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
asilva14 0:fd5a76956754 8 * and/or sell copies of the Software, and to permit persons to whom the
asilva14 0:fd5a76956754 9 * Software is furnished to do so, subject to the following conditions:
asilva14 0:fd5a76956754 10 *
asilva14 0:fd5a76956754 11 * The above copyright notice and this permission notice shall be included
asilva14 0:fd5a76956754 12 * in all copies or substantial portions of the Software.
asilva14 0:fd5a76956754 13 *
asilva14 0:fd5a76956754 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
asilva14 0:fd5a76956754 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
asilva14 0:fd5a76956754 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
asilva14 0:fd5a76956754 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
asilva14 0:fd5a76956754 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
asilva14 0:fd5a76956754 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
asilva14 0:fd5a76956754 20 * OTHER DEALINGS IN THE SOFTWARE.
asilva14 0:fd5a76956754 21 *
asilva14 0:fd5a76956754 22 * Except as contained in this notice, the name of Maxim Integrated
asilva14 0:fd5a76956754 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
asilva14 0:fd5a76956754 24 * Products, Inc. Branding Policy.
asilva14 0:fd5a76956754 25 *
asilva14 0:fd5a76956754 26 * The mere transfer of this software does not imply any licenses
asilva14 0:fd5a76956754 27 * of trade secrets, proprietary technology, copyrights, patents,
asilva14 0:fd5a76956754 28 * trademarks, maskwork rights, or any other form of intellectual
asilva14 0:fd5a76956754 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
asilva14 0:fd5a76956754 30 * ownership rights.
asilva14 0:fd5a76956754 31 *******************************************************************************
asilva14 0:fd5a76956754 32 */
asilva14 0:fd5a76956754 33
asilva14 0:fd5a76956754 34 #include "MAX14720_RPC.h"
asilva14 0:fd5a76956754 35 #include "MAX14720.h"
asilva14 0:fd5a76956754 36 #include "StringHelper.h"
asilva14 0:fd5a76956754 37 #include "Peripherals.h"
asilva14 0:fd5a76956754 38 #include "Device_Logging.h"
asilva14 0:fd5a76956754 39
asilva14 0:fd5a76956754 40 /**
asilva14 0:fd5a76956754 41 * @brief Read the identification of the s25fs512 using quad spi
asilva14 0:fd5a76956754 42 * @param argStrs incoming rpc argument strings
asilva14 0:fd5a76956754 43 * OUTPUT:
asilva14 0:fd5a76956754 44 * replyStrs: strings that get returned to the rpc caller
asilva14 0:fd5a76956754 45 * @return 0 if successful, -1 if error
asilva14 0:fd5a76956754 46 */
asilva14 0:fd5a76956754 47 int MAX14720_ReadBoostVSet(char argStrs[32][32], char replyStrs[32][32]) {
asilva14 0:fd5a76956754 48 uint8_t args[1];
asilva14 0:fd5a76956754 49 uint8_t reply[1];
asilva14 0:fd5a76956754 50 //MAX14720::BoostVSet_Values value;
asilva14 0:fd5a76956754 51
asilva14 0:fd5a76956754 52 ProcessArgs(argStrs, args, sizeof(args));
asilva14 0:fd5a76956754 53 //Peripherals::max14720()->readBoostVSet(&value);
asilva14 0:fd5a76956754 54 //reply[0] = (char)value;
asilva14 0:fd5a76956754 55 FormatReply(reply, sizeof(reply), replyStrs);
asilva14 0:fd5a76956754 56 return 0;
asilva14 0:fd5a76956754 57 }
asilva14 0:fd5a76956754 58
asilva14 0:fd5a76956754 59 /**
asilva14 0:fd5a76956754 60 * @brief Read the identification of the s25fs512 using quad spi
asilva14 0:fd5a76956754 61 * @param argStrs incoming rpc argument strings
asilva14 0:fd5a76956754 62 * OUTPUT:
asilva14 0:fd5a76956754 63 * replyStrs: strings that get returned to the rpc caller
asilva14 0:fd5a76956754 64 * @return 0 if successful, -1 if error
asilva14 0:fd5a76956754 65 */
asilva14 0:fd5a76956754 66 int MAX14720_WriteBoostVSet(char argStrs[32][32], char replyStrs[32][32]) {
asilva14 0:fd5a76956754 67 uint8_t args[1];
asilva14 0:fd5a76956754 68 uint8_t reply[1];
asilva14 0:fd5a76956754 69
asilva14 0:fd5a76956754 70 ProcessArgs(argStrs, args, sizeof(args));
asilva14 0:fd5a76956754 71 // Peripherals::max14720()->boostEn(MAX14720::BoostEn_Disable);
asilva14 0:fd5a76956754 72 // Peripherals::max14720()->boostVSet((MAX14720::BoostVSet_Values)args[0]);
asilva14 0:fd5a76956754 73 // Peripherals::max14720()->boostEn(MAX14720::BoostEn_Enable);
asilva14 0:fd5a76956754 74 reply[0] = 0x80;
asilva14 0:fd5a76956754 75 FormatReply(reply, sizeof(reply), replyStrs);
asilva14 0:fd5a76956754 76 return 0;
asilva14 0:fd5a76956754 77 }
asilva14 0:fd5a76956754 78
asilva14 0:fd5a76956754 79 /**
asilva14 0:fd5a76956754 80 * @brief Read the identification of the s25fs512 using quad spi
asilva14 0:fd5a76956754 81 * @param argStrs incoming rpc argument strings
asilva14 0:fd5a76956754 82 * OUTPUT:
asilva14 0:fd5a76956754 83 * replyStrs: strings that get returned to the rpc caller
asilva14 0:fd5a76956754 84 * @return 0 if successful, -1 if error
asilva14 0:fd5a76956754 85 */
asilva14 0:fd5a76956754 86 int MAX14720_ReadReg(char argStrs[32][32], char replyStrs[32][32]) {
asilva14 0:fd5a76956754 87 uint8_t args[1];
asilva14 0:fd5a76956754 88 uint8_t reply[1];
asilva14 0:fd5a76956754 89 char address;
asilva14 0:fd5a76956754 90 char value;
asilva14 0:fd5a76956754 91
asilva14 0:fd5a76956754 92 ProcessArgs(argStrs, args, sizeof(args));
asilva14 0:fd5a76956754 93 // Peripherals::max14720()->readReg((MAX14720::MAX14720_REG_map_t)address,&value);
asilva14 0:fd5a76956754 94 reply[0] = (char)value;
asilva14 0:fd5a76956754 95 FormatReply(reply, sizeof(reply), replyStrs);
asilva14 0:fd5a76956754 96 return 0;
asilva14 0:fd5a76956754 97 }
asilva14 0:fd5a76956754 98
asilva14 0:fd5a76956754 99 /**
asilva14 0:fd5a76956754 100 * @brief Read the identification of the s25fs512 using quad spi
asilva14 0:fd5a76956754 101 * @param argStrs incoming rpc argument strings
asilva14 0:fd5a76956754 102 * OUTPUT:
asilva14 0:fd5a76956754 103 * replyStrs: strings that get returned to the rpc caller
asilva14 0:fd5a76956754 104 * @return 0 if successful, -1 if error
asilva14 0:fd5a76956754 105 */
asilva14 0:fd5a76956754 106 int MAX14720_WriteReg(char argStrs[32][32], char replyStrs[32][32]) {
asilva14 0:fd5a76956754 107 uint8_t args[2];
asilva14 0:fd5a76956754 108 uint8_t reply[1];
asilva14 0:fd5a76956754 109
asilva14 0:fd5a76956754 110 ProcessArgs(argStrs, args, sizeof(args));
asilva14 0:fd5a76956754 111 // Peripherals::max14720()->writeReg((MAX14720::MAX14720_REG_map_t)args[0],args[1]);
asilva14 0:fd5a76956754 112 reply[0] = 0x80;
asilva14 0:fd5a76956754 113 FormatReply(reply, sizeof(reply), replyStrs);
asilva14 0:fd5a76956754 114 return 0;
asilva14 0:fd5a76956754 115 }