SakuraIO

Fork of SakuraIO by SAKURA Internet

Committer:
spiralray
Date:
Thu Nov 24 14:55:48 2016 +0000
Revision:
4:3d73874507bc
Parent:
0:8d34375d954c
Child:
5:84a9fcd0c28b
Fix peek command

Who changed what in which revision?

UserRevisionLine numberNew contents of line
spiralray 0:8d34375d954c 1 #include "mbed.h"
spiralray 0:8d34375d954c 2 #include "SakuraIO.h"
spiralray 0:8d34375d954c 3 #include "SakuraIO/commands.h"
spiralray 0:8d34375d954c 4 #include "SakuraIO/debug.h"
spiralray 0:8d34375d954c 5
spiralray 0:8d34375d954c 6 uint8_t SakuraIO::executeCommand(uint8_t cmd,uint8_t requestLength, uint8_t *request, uint8_t *responseLength, uint8_t *response)
spiralray 0:8d34375d954c 7 {
spiralray 0:8d34375d954c 8 uint8_t parity = 0x00;
spiralray 0:8d34375d954c 9 uint8_t result = 0x00;
spiralray 0:8d34375d954c 10 uint8_t tmpResponseLength, tmpResponse;
spiralray 0:8d34375d954c 11
spiralray 0:8d34375d954c 12 dbgln("executeCommand");
spiralray 0:8d34375d954c 13
spiralray 0:8d34375d954c 14 this->begin();
spiralray 0:8d34375d954c 15
spiralray 0:8d34375d954c 16 // request
spiralray 0:8d34375d954c 17 this->sendByte(cmd);
spiralray 0:8d34375d954c 18 this->sendByte(requestLength);
spiralray 0:8d34375d954c 19 parity = cmd ^ requestLength;
spiralray 0:8d34375d954c 20 for(int16_t i=0; i<requestLength; i++){
spiralray 0:8d34375d954c 21 parity ^= request[i];
spiralray 0:8d34375d954c 22 this->sendByte(request[i]);
spiralray 0:8d34375d954c 23 }
spiralray 0:8d34375d954c 24 this->sendByte(parity);
spiralray 0:8d34375d954c 25 //this->finishSending();
spiralray 0:8d34375d954c 26
spiralray 0:8d34375d954c 27 tmpResponseLength = 0;
spiralray 0:8d34375d954c 28 if(responseLength != NULL){
spiralray 0:8d34375d954c 29 tmpResponseLength = *responseLength;
spiralray 0:8d34375d954c 30 }
spiralray 0:8d34375d954c 31
spiralray 0:8d34375d954c 32 wait_ms(10);
spiralray 0:8d34375d954c 33
spiralray 0:8d34375d954c 34 // response
spiralray 0:8d34375d954c 35 this->startReceive(tmpResponseLength+3);
spiralray 0:8d34375d954c 36 result = this->receiveByte();
spiralray 0:8d34375d954c 37 if(result != CMD_ERROR_NONE){
spiralray 0:8d34375d954c 38 dbgln("Invalid status");
spiralray 0:8d34375d954c 39 this->end();
spiralray 0:8d34375d954c 40 return result;
spiralray 0:8d34375d954c 41 }
spiralray 0:8d34375d954c 42 tmpResponseLength = this->receiveByte();
spiralray 0:8d34375d954c 43 parity = result ^ tmpResponseLength;
spiralray 0:8d34375d954c 44 if(responseLength != NULL){
spiralray 0:8d34375d954c 45 if(*responseLength < tmpResponseLength){
spiralray 0:8d34375d954c 46 tmpResponseLength = *responseLength;
spiralray 0:8d34375d954c 47 }
spiralray 0:8d34375d954c 48 *responseLength = tmpResponseLength;
spiralray 0:8d34375d954c 49 }
spiralray 0:8d34375d954c 50 for(int16_t i=0; i<tmpResponseLength; i++){
spiralray 0:8d34375d954c 51 tmpResponse = this->receiveByte();
spiralray 0:8d34375d954c 52 parity ^= tmpResponse;
spiralray 0:8d34375d954c 53 if(response != NULL){
spiralray 0:8d34375d954c 54 response[i] = tmpResponse;
spiralray 0:8d34375d954c 55 }
spiralray 0:8d34375d954c 56 }
spiralray 0:8d34375d954c 57 dbgln("Parity");
spiralray 0:8d34375d954c 58 uint8_t p = this->receiveByte(true);
spiralray 0:8d34375d954c 59 parity ^= p;
spiralray 0:8d34375d954c 60 dbg("Parity=");
spiralray 0:8d34375d954c 61 dbgln(p);
spiralray 0:8d34375d954c 62 if(parity != 0x00){
spiralray 0:8d34375d954c 63 result = CMD_ERROR_PARITY;
spiralray 0:8d34375d954c 64 dbgln("Invalid parity");
spiralray 0:8d34375d954c 65 }else{
spiralray 0:8d34375d954c 66 dbgln("Success");
spiralray 0:8d34375d954c 67 }
spiralray 0:8d34375d954c 68 //this->finishReceiving();
spiralray 0:8d34375d954c 69
spiralray 0:8d34375d954c 70 this->end();
spiralray 0:8d34375d954c 71 return result;
spiralray 0:8d34375d954c 72 }
spiralray 0:8d34375d954c 73
spiralray 0:8d34375d954c 74 /* Common Commands */
spiralray 0:8d34375d954c 75
spiralray 0:8d34375d954c 76 uint8_t SakuraIO::getConnectionStatus(){
spiralray 0:8d34375d954c 77 uint8_t responseLength = 1;
spiralray 0:8d34375d954c 78 uint8_t response[1] = {0x00};
spiralray 0:8d34375d954c 79 if(executeCommand(CMD_GET_CONNECTION_STATUS, 0, NULL, &responseLength, response) != CMD_ERROR_NONE){
spiralray 0:8d34375d954c 80 return 0x7F;
spiralray 0:8d34375d954c 81 }
spiralray 0:8d34375d954c 82 return response[0];
spiralray 0:8d34375d954c 83 }
spiralray 0:8d34375d954c 84
spiralray 0:8d34375d954c 85 uint8_t SakuraIO::getSignalQuarity(){
spiralray 0:8d34375d954c 86 uint8_t responseLength = 1;
spiralray 0:8d34375d954c 87 uint8_t response[1] = {0x00};
spiralray 0:8d34375d954c 88
spiralray 0:8d34375d954c 89 if(executeCommand(CMD_GET_SIGNAL_QUALITY, 0, NULL, &responseLength, response) != CMD_ERROR_NONE){
spiralray 0:8d34375d954c 90 return 0x00;
spiralray 0:8d34375d954c 91 }
spiralray 0:8d34375d954c 92 return response[0];
spiralray 0:8d34375d954c 93 }
spiralray 0:8d34375d954c 94
spiralray 0:8d34375d954c 95 uint64_t SakuraIO::getUnixtime(){
spiralray 0:8d34375d954c 96 uint8_t responseLength = 8;
spiralray 0:8d34375d954c 97 uint8_t response[8] = {0x00};
spiralray 0:8d34375d954c 98 if(executeCommand(CMD_GET_DATETIME, 0, NULL, &responseLength, response) != CMD_ERROR_NONE){
spiralray 0:8d34375d954c 99 return 0x00;
spiralray 0:8d34375d954c 100 }
spiralray 0:8d34375d954c 101 return *((uint64_t *)response);
spiralray 0:8d34375d954c 102 }
spiralray 0:8d34375d954c 103
spiralray 0:8d34375d954c 104 uint8_t SakuraIO::echoback(uint8_t length, uint8_t *data, uint8_t *response){
spiralray 0:8d34375d954c 105 uint8_t responseLength = length;
spiralray 0:8d34375d954c 106 if(executeCommand(CMD_ECHO_BACK, length, data, &responseLength, response) != CMD_ERROR_NONE){
spiralray 0:8d34375d954c 107 return 0x00;
spiralray 0:8d34375d954c 108 }
spiralray 0:8d34375d954c 109 return responseLength;
spiralray 0:8d34375d954c 110 }
spiralray 0:8d34375d954c 111
spiralray 0:8d34375d954c 112 /* IO Commands */
spiralray 0:8d34375d954c 113
spiralray 0:8d34375d954c 114 uint16_t SakuraIO::getADC(uint8_t channel){
spiralray 0:8d34375d954c 115 uint8_t request[1] = {channel};
spiralray 0:8d34375d954c 116 uint8_t response[2] = {0x00};
spiralray 0:8d34375d954c 117 uint8_t responseLength = sizeof(response);
spiralray 0:8d34375d954c 118 if(executeCommand(CMD_READ_ADC, 1, request, &responseLength, response) != CMD_ERROR_NONE){
spiralray 0:8d34375d954c 119 return 0xffff;
spiralray 0:8d34375d954c 120 }
spiralray 0:8d34375d954c 121 return *((uint16_t *)response);
spiralray 0:8d34375d954c 122 }
spiralray 0:8d34375d954c 123
spiralray 0:8d34375d954c 124 /* TX Commands */
spiralray 0:8d34375d954c 125 uint8_t SakuraIO::enqueueTxRaw(uint8_t ch, uint8_t type, uint8_t length, uint8_t *data, uint64_t offset){
spiralray 0:8d34375d954c 126 uint8_t request[18] = {0x00};
spiralray 0:8d34375d954c 127 uint8_t requestLength = 10;
spiralray 0:8d34375d954c 128 request[0] = ch;
spiralray 0:8d34375d954c 129 request[1] = type;
spiralray 0:8d34375d954c 130 for(uint8_t i=0;i<length;i++){
spiralray 0:8d34375d954c 131 request[2+i] = data[i];
spiralray 0:8d34375d954c 132 }
spiralray 0:8d34375d954c 133 if(offset != 0){
spiralray 0:8d34375d954c 134 requestLength = 18;
spiralray 0:8d34375d954c 135 for(uint8_t i=0;i<8;i++){
spiralray 0:8d34375d954c 136 request[10+i] = ((uint8_t *)&offset)[i];
spiralray 0:8d34375d954c 137 }
spiralray 0:8d34375d954c 138 }
spiralray 0:8d34375d954c 139 return executeCommand(CMD_TX_ENQUEUE, requestLength, request, NULL, NULL);
spiralray 0:8d34375d954c 140 }
spiralray 0:8d34375d954c 141
spiralray 0:8d34375d954c 142 uint8_t SakuraIO::enqueueTx(uint8_t ch, int32_t value, uint64_t offset){
spiralray 0:8d34375d954c 143 return enqueueTxRaw(ch, 'i', 4, (uint8_t *)&value, offset);
spiralray 0:8d34375d954c 144 }
spiralray 0:8d34375d954c 145
spiralray 0:8d34375d954c 146 uint8_t SakuraIO::enqueueTx(uint8_t ch, uint32_t value, uint64_t offset){
spiralray 0:8d34375d954c 147 return enqueueTxRaw(ch, 'I', 4, (uint8_t *)&value, offset);
spiralray 0:8d34375d954c 148 }
spiralray 0:8d34375d954c 149
spiralray 0:8d34375d954c 150 uint8_t SakuraIO::enqueueTx(uint8_t ch, int64_t value, uint64_t offset){
spiralray 0:8d34375d954c 151 return enqueueTxRaw(ch, 'l', 8, (uint8_t *)&value, offset);
spiralray 0:8d34375d954c 152 }
spiralray 0:8d34375d954c 153
spiralray 0:8d34375d954c 154 uint8_t SakuraIO::enqueueTx(uint8_t ch, uint64_t value, uint64_t offset){
spiralray 0:8d34375d954c 155 return enqueueTxRaw(ch, 'L', 8, (uint8_t *)&value, offset);
spiralray 0:8d34375d954c 156 }
spiralray 0:8d34375d954c 157
spiralray 0:8d34375d954c 158 uint8_t SakuraIO::enqueueTx(uint8_t ch, float value, uint64_t offset){
spiralray 0:8d34375d954c 159 return enqueueTxRaw(ch, 'f', 4, (uint8_t *)&value, offset);
spiralray 0:8d34375d954c 160 }
spiralray 0:8d34375d954c 161
spiralray 0:8d34375d954c 162 uint8_t SakuraIO::enqueueTx(uint8_t ch, double value, uint64_t offset){
spiralray 0:8d34375d954c 163 return enqueueTxRaw(ch, 'd', 8, (uint8_t *)&value, offset);
spiralray 0:8d34375d954c 164 }
spiralray 0:8d34375d954c 165
spiralray 0:8d34375d954c 166 uint8_t SakuraIO::enqueueTx(uint8_t ch, uint8_t value[8], uint64_t offset){
spiralray 0:8d34375d954c 167 return enqueueTxRaw(ch, 'b', 8, (uint8_t *)value, offset);
spiralray 0:8d34375d954c 168 }
spiralray 0:8d34375d954c 169
spiralray 0:8d34375d954c 170 uint8_t SakuraIO::enqueueTx(uint8_t ch, int32_t value){
spiralray 0:8d34375d954c 171 return enqueueTx(ch, value, (uint32_t)0);
spiralray 0:8d34375d954c 172 }
spiralray 0:8d34375d954c 173
spiralray 0:8d34375d954c 174 uint8_t SakuraIO::enqueueTx(uint8_t ch, uint32_t value){
spiralray 0:8d34375d954c 175 return enqueueTx(ch, value, (uint32_t)0);
spiralray 0:8d34375d954c 176 }
spiralray 0:8d34375d954c 177
spiralray 0:8d34375d954c 178 uint8_t SakuraIO::enqueueTx(uint8_t ch, int64_t value){
spiralray 0:8d34375d954c 179 return enqueueTx(ch, value, (uint32_t)0);
spiralray 0:8d34375d954c 180 }
spiralray 0:8d34375d954c 181
spiralray 0:8d34375d954c 182 uint8_t SakuraIO::enqueueTx(uint8_t ch, uint64_t value){
spiralray 0:8d34375d954c 183 return enqueueTx(ch, value, (uint32_t)0);
spiralray 0:8d34375d954c 184 }
spiralray 0:8d34375d954c 185
spiralray 0:8d34375d954c 186 uint8_t SakuraIO::enqueueTx(uint8_t ch, float value){
spiralray 0:8d34375d954c 187 return enqueueTx(ch, value, (uint32_t)0);
spiralray 0:8d34375d954c 188 }
spiralray 0:8d34375d954c 189
spiralray 0:8d34375d954c 190 uint8_t SakuraIO::enqueueTx(uint8_t ch, double value){
spiralray 0:8d34375d954c 191 return enqueueTx(ch, value, (uint32_t)0);
spiralray 0:8d34375d954c 192 }
spiralray 0:8d34375d954c 193
spiralray 0:8d34375d954c 194 uint8_t SakuraIO::enqueueTx(uint8_t ch, uint8_t value[8]){
spiralray 0:8d34375d954c 195 return enqueueTx(ch, value, (uint32_t)0);
spiralray 0:8d34375d954c 196 }
spiralray 0:8d34375d954c 197
spiralray 0:8d34375d954c 198 uint8_t SakuraIO::getTxQueueLength(uint8_t *available, uint8_t *queued){
spiralray 0:8d34375d954c 199 uint8_t response[2] = {0x00};
spiralray 0:8d34375d954c 200 uint8_t responseLength = 2;
spiralray 0:8d34375d954c 201 uint8_t ret = executeCommand(CMD_TX_LENGTH, 0, NULL, &responseLength, response);
spiralray 0:8d34375d954c 202 *available = response[0];
spiralray 0:8d34375d954c 203 *queued = response[1];
spiralray 0:8d34375d954c 204 return ret;
spiralray 0:8d34375d954c 205 }
spiralray 0:8d34375d954c 206
spiralray 0:8d34375d954c 207 uint8_t SakuraIO::clearTx(){
spiralray 0:8d34375d954c 208 return executeCommand(CMD_TX_CLEAR, 0, NULL, NULL, NULL);
spiralray 0:8d34375d954c 209 }
spiralray 0:8d34375d954c 210
spiralray 0:8d34375d954c 211 uint8_t SakuraIO::send(){
spiralray 0:8d34375d954c 212 return executeCommand(CMD_TX_SEND, 0, NULL, NULL, NULL);
spiralray 0:8d34375d954c 213 }
spiralray 0:8d34375d954c 214
spiralray 0:8d34375d954c 215 uint8_t SakuraIO::getTxStatus(uint8_t *queue, uint8_t *immediate){
spiralray 0:8d34375d954c 216 uint8_t response[2] = {0x00};
spiralray 0:8d34375d954c 217 uint8_t responseLength = 2;
spiralray 0:8d34375d954c 218 uint8_t ret = executeCommand(CMD_TX_STAT, 0, NULL, &responseLength, response);
spiralray 0:8d34375d954c 219 *queue = response[0];
spiralray 0:8d34375d954c 220 *immediate = response[1];
spiralray 0:8d34375d954c 221 return ret;
spiralray 0:8d34375d954c 222 }
spiralray 0:8d34375d954c 223
spiralray 0:8d34375d954c 224 /* RX Commands */
spiralray 0:8d34375d954c 225
spiralray 0:8d34375d954c 226 uint8_t SakuraIO::dequeueRx(uint8_t *ch, uint8_t *type, uint8_t *value, int64_t *offset){
spiralray 0:8d34375d954c 227 uint8_t response[18] = {0x00};
spiralray 0:8d34375d954c 228 uint8_t responseLength = 18;
spiralray 0:8d34375d954c 229 uint8_t ret = executeCommand(CMD_RX_DEQUEUE, 0, NULL, &responseLength, response);
spiralray 0:8d34375d954c 230 if(ret != CMD_ERROR_NONE){
spiralray 0:8d34375d954c 231 return ret;
spiralray 0:8d34375d954c 232 }
spiralray 0:8d34375d954c 233
spiralray 0:8d34375d954c 234 *ch = response[0];
spiralray 0:8d34375d954c 235 *type = response[1];
spiralray 0:8d34375d954c 236 for(uint8_t i=0; i<8; i++){
spiralray 0:8d34375d954c 237 value[i] = response[2+i];
spiralray 0:8d34375d954c 238 }
spiralray 0:8d34375d954c 239 for(uint8_t i=0; i<8; i++){
spiralray 0:8d34375d954c 240 ((uint8_t *)offset)[i] = response[10+i];
spiralray 0:8d34375d954c 241 }
spiralray 0:8d34375d954c 242
spiralray 0:8d34375d954c 243 return ret;
spiralray 0:8d34375d954c 244 }
spiralray 0:8d34375d954c 245
spiralray 0:8d34375d954c 246 uint8_t SakuraIO::peekRx(uint8_t *ch, uint8_t *type, uint8_t *value, int64_t *offset){
spiralray 0:8d34375d954c 247 uint8_t response[18] = {0x00};
spiralray 0:8d34375d954c 248 uint8_t responseLength = 18;
spiralray 0:8d34375d954c 249 uint8_t ret = executeCommand(CMD_RX_PEEK, 0, NULL, &responseLength, response);
spiralray 0:8d34375d954c 250 if(ret != CMD_ERROR_NONE){
spiralray 0:8d34375d954c 251 return ret;
spiralray 0:8d34375d954c 252 }
spiralray 0:8d34375d954c 253
spiralray 0:8d34375d954c 254 *ch = response[0];
spiralray 0:8d34375d954c 255 *type = response[1];
spiralray 0:8d34375d954c 256 for(uint8_t i=0; i<8; i++){
spiralray 4:3d73874507bc 257 value[i] = response[2+i];
spiralray 0:8d34375d954c 258 }
spiralray 0:8d34375d954c 259 for(uint8_t i=0; i<8; i++){
spiralray 0:8d34375d954c 260 ((uint8_t *)offset)[i] = response[10+i];
spiralray 0:8d34375d954c 261 }
spiralray 0:8d34375d954c 262
spiralray 0:8d34375d954c 263 return ret;
spiralray 0:8d34375d954c 264 }
spiralray 0:8d34375d954c 265
spiralray 0:8d34375d954c 266 uint8_t SakuraIO::getRxQueueLength(uint8_t *available, uint8_t *queued){
spiralray 0:8d34375d954c 267 uint8_t response[2] = {0x00};
spiralray 0:8d34375d954c 268 uint8_t responseLength = 2;
spiralray 0:8d34375d954c 269 uint8_t ret = executeCommand(CMD_RX_LENGTH, 0, NULL, &responseLength, response);
spiralray 0:8d34375d954c 270 *available = response[0];
spiralray 0:8d34375d954c 271 *queued = response[1];
spiralray 0:8d34375d954c 272 return ret;
spiralray 0:8d34375d954c 273 }
spiralray 0:8d34375d954c 274
spiralray 0:8d34375d954c 275 uint8_t SakuraIO::clearRx(){
spiralray 0:8d34375d954c 276 return executeCommand(CMD_RX_CLEAR, 0, NULL, NULL, NULL);
spiralray 0:8d34375d954c 277 }
spiralray 0:8d34375d954c 278
spiralray 0:8d34375d954c 279 /* Operation command */
spiralray 0:8d34375d954c 280
spiralray 0:8d34375d954c 281 uint16_t SakuraIO::getProductID(){
spiralray 0:8d34375d954c 282 uint8_t response[2] = {0x00};
spiralray 0:8d34375d954c 283 uint8_t responseLength = 2;
spiralray 0:8d34375d954c 284 uint8_t ret = executeCommand(CMD_GET_PRODUCT_ID, 0, NULL, &responseLength, response);
spiralray 0:8d34375d954c 285 if(ret != CMD_ERROR_NONE){
spiralray 0:8d34375d954c 286 return 0x00;
spiralray 0:8d34375d954c 287 }
spiralray 0:8d34375d954c 288 return *((uint16_t *)response);
spiralray 0:8d34375d954c 289 }
spiralray 0:8d34375d954c 290
spiralray 0:8d34375d954c 291 uint8_t SakuraIO::getUniqueID(char *data){
spiralray 0:8d34375d954c 292 uint8_t response[11] = {0x00};
spiralray 0:8d34375d954c 293 uint8_t responseLength = 10;
spiralray 0:8d34375d954c 294 uint8_t ret = executeCommand(CMD_GET_UNIQUE_ID, 0, NULL, &responseLength, response);
spiralray 0:8d34375d954c 295 if(ret != CMD_ERROR_NONE){
spiralray 0:8d34375d954c 296 return ret;
spiralray 0:8d34375d954c 297 }
spiralray 0:8d34375d954c 298 for(uint8_t i=0; i<responseLength; i++){
spiralray 0:8d34375d954c 299 data[i] = (char)response[i];
spiralray 0:8d34375d954c 300 }
spiralray 0:8d34375d954c 301 data[responseLength] = 0x00;
spiralray 0:8d34375d954c 302 return ret;
spiralray 0:8d34375d954c 303 }
spiralray 0:8d34375d954c 304
spiralray 0:8d34375d954c 305 uint8_t SakuraIO::getFirmwareVersion(char *data){
spiralray 0:8d34375d954c 306 uint8_t response[33] = {0x00};
spiralray 0:8d34375d954c 307 uint8_t responseLength = 32;
spiralray 0:8d34375d954c 308 uint8_t ret = executeCommand(CMD_GET_FIRMWARE_VERSION, 0, NULL, &responseLength, response);
spiralray 0:8d34375d954c 309 if(ret != CMD_ERROR_NONE){
spiralray 0:8d34375d954c 310 return ret;
spiralray 0:8d34375d954c 311 }
spiralray 0:8d34375d954c 312 for(uint8_t i=0; i<responseLength; i++){
spiralray 0:8d34375d954c 313 data[i] = (char)response[i];
spiralray 0:8d34375d954c 314 }
spiralray 0:8d34375d954c 315 data[responseLength] = 0x00;
spiralray 0:8d34375d954c 316 return ret;
spiralray 0:8d34375d954c 317 }
spiralray 0:8d34375d954c 318
spiralray 0:8d34375d954c 319 uint8_t SakuraIO::unlock(){
spiralray 0:8d34375d954c 320 uint8_t request[4] = {0x53, 0x6B, 0x72, 0x61};
spiralray 0:8d34375d954c 321 return executeCommand(CMD_UNLOCK, 4, request, NULL, NULL);
spiralray 0:8d34375d954c 322 }
spiralray 0:8d34375d954c 323
spiralray 0:8d34375d954c 324 uint8_t SakuraIO::updateFirmware(){
spiralray 0:8d34375d954c 325 return executeCommand(CMD_UPDATE_FIRMWARE, 0, 0, NULL, NULL);
spiralray 0:8d34375d954c 326 }
spiralray 0:8d34375d954c 327
spiralray 0:8d34375d954c 328 uint8_t SakuraIO::getFirmwareUpdateStatus(){
spiralray 0:8d34375d954c 329 uint8_t response[1] = {0x00};
spiralray 0:8d34375d954c 330 uint8_t responseLength = 1;
spiralray 0:8d34375d954c 331 if(executeCommand(CMD_GET_UPDATE_FIRMWARE_STATUS, 0, 0, &responseLength, response) != CMD_ERROR_NONE){
spiralray 0:8d34375d954c 332 return 0xff;
spiralray 0:8d34375d954c 333 }
spiralray 0:8d34375d954c 334 return response[0];
spiralray 0:8d34375d954c 335 }
spiralray 0:8d34375d954c 336
spiralray 0:8d34375d954c 337 uint8_t SakuraIO::reset(){
spiralray 0:8d34375d954c 338 return executeCommand(CMD_SOFTWARE_RESET, 0, 0, NULL, NULL);
spiralray 0:8d34375d954c 339 }