Super Vision / Mbed 2 deprecated sv_usb_firmware

Dependencies:   MODSERIAL USBDevice_for_Rev_C_HW mbed

Fork of mbed_sv_firmware_with_init by Bob Recny

Committer:
bob_tpc
Date:
Tue Jan 20 01:09:41 2015 +0000
Revision:
3:e8cc286f9b2e
Parent:
2:efaf8aee55df
Child:
4:13e3e375c0d3
Included message send back to USB.  Start of proximity/I2C messages.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bob_tpc 0:8604e9cc07f2 1 #include "mbed.h"
bob_tpc 0:8604e9cc07f2 2 #include "USBSerial.h"
bob_tpc 0:8604e9cc07f2 3 #include "MODSERIAL.h"
bob_tpc 0:8604e9cc07f2 4 #include "InterruptIn.h"
bob_tpc 0:8604e9cc07f2 5
bob_tpc 0:8604e9cc07f2 6 // Constants
bob_tpc 0:8604e9cc07f2 7 #define LEDON 0 // Low active for LEDs - turns LED on
bob_tpc 0:8604e9cc07f2 8 #define LEDOFF 1 // Low active for LEDs - turns LED off
bob_tpc 0:8604e9cc07f2 9 #define TRUE 1
bob_tpc 0:8604e9cc07f2 10 #define FALSE 0
bob_tpc 0:8604e9cc07f2 11
bob_tpc 0:8604e9cc07f2 12
bob_tpc 0:8604e9cc07f2 13 // Error return values
bob_tpc 0:8604e9cc07f2 14 #define ERR_NONE 0 // Success
bob_tpc 1:bd988d267998 15 #define ERR_CDC_BAD_CMD 1 // First byte of PC to USB board needs to be 0xBB, 0xCC, 0xDD or 0xEE;
bob_tpc 1:bd988d267998 16 #define ERR_CDC_NO_TX_ENDMARK 2 // message for no endmark on message to PC
bob_tpc 0:8604e9cc07f2 17 #define ERR_UART_NOT_WRITEABLE 3 // UART has no buffer space
bob_tpc 1:bd988d267998 18 #define ERR_UART_NO_TX_ENDMARK 4 // message for UART has no 0x7E end-mark
bob_tpc 0:8604e9cc07f2 19 #define ERR_UART_NO_RX_ENDMARK 5 // message received from UART has no end-mark
bob_tpc 0:8604e9cc07f2 20
bob_tpc 0:8604e9cc07f2 21
bob_tpc 0:8604e9cc07f2 22 // I2C addresses
bob_tpc 0:8604e9cc07f2 23 #define PROX (0x29 << 1) // default I2C address of VL6180X, shift into upper 7 bits
bob_tpc 0:8604e9cc07f2 24 #define EEPROM (0xA0) // default I2C address of EEPROM, already shifted
bob_tpc 0:8604e9cc07f2 25
bob_tpc 0:8604e9cc07f2 26 // UART-RFID baud rate
bob_tpc 0:8604e9cc07f2 27 #define RFIDBAUD 115200 // RFID-FE board default rate = 115.2Kbps
bob_tpc 0:8604e9cc07f2 28
bob_tpc 0:8604e9cc07f2 29 // Peripherals
bob_tpc 0:8604e9cc07f2 30 USBSerial cdc; // CDC Class USB<>Serial adapter. Needs custom INF, but uses existing Windows drivers.
bob_tpc 0:8604e9cc07f2 31 MODSERIAL uart(PTA2, PTA1); // UART port connected to RFID-FE board
bob_tpc 0:8604e9cc07f2 32 I2C i2c(PTB1, PTB0); // I2C port connected to VL6180X and EEPROM - note addresses above)
bob_tpc 0:8604e9cc07f2 33
bob_tpc 0:8604e9cc07f2 34 // GPIO signals
bob_tpc 0:8604e9cc07f2 35 DigitalOut led_err(PTC1); // Red LED shows error condition (active low)
bob_tpc 0:8604e9cc07f2 36 DigitalOut led_com(PTC2); // Yellow LED shows communication activity (active low)
bob_tpc 0:8604e9cc07f2 37 DigitalOut rfid_int(PTD4); // RFID FE power control (active high)
bob_tpc 0:8604e9cc07f2 38 DigitalOut rfid_isp(PTD5); // RFID FE In-System Programming (active high)
bob_tpc 0:8604e9cc07f2 39 DigitalOut rfid_rst(PTD6); // RFID FE Reset (active high)
bob_tpc 0:8604e9cc07f2 40 DigitalOut rfid_pwr(PTE30); // RFID power switch on USB board (active high for prototype 1, low for all others)
bob_tpc 0:8604e9cc07f2 41 DigitalIn rfid_hot(PTE0); // RFID over-current detection on USB board power switch (active low)
bob_tpc 0:8604e9cc07f2 42 InterruptIn prox_int(PTD7); // Proximity sensor interrupt (active low)
bob_tpc 0:8604e9cc07f2 43
bob_tpc 0:8604e9cc07f2 44 // buffers & variables
bob_tpc 0:8604e9cc07f2 45 uint8_t cdc_buffer_rx[32]; // buffers for cdc (USB-Serial port on PC)
bob_tpc 0:8604e9cc07f2 46 uint8_t cdc_buffer_tx[32];
bob_tpc 0:8604e9cc07f2 47 uint8_t uart_buffer_rx[32]; // buffers for uart (RFID-FE board)
bob_tpc 0:8604e9cc07f2 48 uint8_t uart_buffer_tx[32];
bob_tpc 3:e8cc286f9b2e 49 uint8_t i2c_buffer_rx[32]; // buffers for I2C devices - Proximity sensor and EEPROM
bob_tpc 3:e8cc286f9b2e 50 uint8_t i2c_buffer_tx[32];
bob_tpc 0:8604e9cc07f2 51 int i, j; // index variables
bob_tpc 0:8604e9cc07f2 52 int status = 0x00; // return value
bob_tpc 0:8604e9cc07f2 53
bob_tpc 0:8604e9cc07f2 54 int prox_irq(void)
bob_tpc 0:8604e9cc07f2 55 {
bob_tpc 0:8604e9cc07f2 56 return 0;
bob_tpc 0:8604e9cc07f2 57 }
bob_tpc 0:8604e9cc07f2 58
bob_tpc 0:8604e9cc07f2 59 int init_periph(void)
bob_tpc 0:8604e9cc07f2 60 {
bob_tpc 0:8604e9cc07f2 61 // Set up peripherals
bob_tpc 0:8604e9cc07f2 62 // RFID
bob_tpc 0:8604e9cc07f2 63 uart.baud(RFIDBAUD); // RFID-FE baud rate
bob_tpc 0:8604e9cc07f2 64
bob_tpc 0:8604e9cc07f2 65 rfid_int = 0; // RFID FE power control (active high)
bob_tpc 0:8604e9cc07f2 66 rfid_isp = 0; // RFID FE In-System Programming (active high)
bob_tpc 0:8604e9cc07f2 67 rfid_rst = 1; // RFID FE Reset (active high)
bob_tpc 0:8604e9cc07f2 68 rfid_pwr = 1; // RFID power switch on USB board (active high for prototype 1, low for all others)
bob_tpc 2:efaf8aee55df 69 wait(0.25); // wait 250ms before...
bob_tpc 0:8604e9cc07f2 70 rfid_rst = 0; // ... taking RFID out of reset
bob_tpc 0:8604e9cc07f2 71
bob_tpc 0:8604e9cc07f2 72 // Prox
bob_tpc 3:e8cc286f9b2e 73 i2c.frequency(400000); // I2C speed = 400Kbps
bob_tpc 2:efaf8aee55df 74 prox_int.mode(PullUp); // pull up proximity sensor interrupt at MCU
bob_tpc 2:efaf8aee55df 75
bob_tpc 2:efaf8aee55df 76
bob_tpc 0:8604e9cc07f2 77 return 0;
bob_tpc 0:8604e9cc07f2 78 }
bob_tpc 0:8604e9cc07f2 79
bob_tpc 0:8604e9cc07f2 80 int rfid_msg(void)
bob_tpc 0:8604e9cc07f2 81 {
bob_tpc 0:8604e9cc07f2 82 bool end_mark = FALSE;
bob_tpc 0:8604e9cc07f2 83 int i;
bob_tpc 0:8604e9cc07f2 84 uint8_t crcCount = sizeof(uart_buffer_tx); // use tx buffer size to start
bob_tpc 0:8604e9cc07f2 85
bob_tpc 0:8604e9cc07f2 86 uart.txBufferFlush(); // clear out UART buffers
bob_tpc 0:8604e9cc07f2 87 uart.rxBufferFlush();
bob_tpc 0:8604e9cc07f2 88
bob_tpc 0:8604e9cc07f2 89 for (int i = 0; i < sizeof(uart_buffer_tx); i++)
bob_tpc 0:8604e9cc07f2 90 {
bob_tpc 0:8604e9cc07f2 91 if (!uart.writeable()) return ERR_UART_NOT_WRITEABLE; // if no space in uart, return error
bob_tpc 0:8604e9cc07f2 92 uart.putc(uart_buffer_tx[i]); // send uart message
bob_tpc 0:8604e9cc07f2 93
bob_tpc 0:8604e9cc07f2 94 if (uart_buffer_tx[i] == 0x7E) // check for rfid end mark in outbound message
bob_tpc 0:8604e9cc07f2 95 {
bob_tpc 0:8604e9cc07f2 96 crcCount = 2; // two more bytes for CRC
bob_tpc 0:8604e9cc07f2 97 end_mark = TRUE; // end mark was reached
bob_tpc 0:8604e9cc07f2 98 }
bob_tpc 0:8604e9cc07f2 99 if (crcCount-- == 0) // end of message
bob_tpc 0:8604e9cc07f2 100 {
bob_tpc 0:8604e9cc07f2 101 if (end_mark == FALSE) return ERR_UART_NO_TX_ENDMARK; // no end mark detected
bob_tpc 0:8604e9cc07f2 102 break;
bob_tpc 0:8604e9cc07f2 103 }
bob_tpc 0:8604e9cc07f2 104 }
bob_tpc 0:8604e9cc07f2 105
bob_tpc 0:8604e9cc07f2 106 end_mark = FALSE;
bob_tpc 3:e8cc286f9b2e 107 //wait(0.5); // debug
bob_tpc 3:e8cc286f9b2e 108 while(!uart.readable()); // wait for data from rfid
bob_tpc 0:8604e9cc07f2 109 crcCount = sizeof(uart_buffer_rx); // use rx buffer size to start
bob_tpc 0:8604e9cc07f2 110 for (i = 0; i < sizeof(uart_buffer_rx); i++)
bob_tpc 0:8604e9cc07f2 111 {
bob_tpc 0:8604e9cc07f2 112 uart_buffer_rx[i] = uart.getc(); // read a character
bob_tpc 0:8604e9cc07f2 113 // cdc.printf("%d, 0x%X\n\r", i, uart_buffer_rx[i]); // debug
bob_tpc 0:8604e9cc07f2 114
bob_tpc 0:8604e9cc07f2 115 if (uart_buffer_rx[i] == 0x7E) // check for rfid end mark in inbound message
bob_tpc 0:8604e9cc07f2 116 {
bob_tpc 0:8604e9cc07f2 117 crcCount = 2; // two more bytes for crc
bob_tpc 0:8604e9cc07f2 118 end_mark = TRUE; // end mark was reached
bob_tpc 0:8604e9cc07f2 119 }
bob_tpc 0:8604e9cc07f2 120 if (crcCount-- == 0) // end of message
bob_tpc 0:8604e9cc07f2 121 {
bob_tpc 0:8604e9cc07f2 122 if (end_mark == FALSE) return ERR_UART_NO_RX_ENDMARK;
bob_tpc 0:8604e9cc07f2 123 break;
bob_tpc 0:8604e9cc07f2 124 }
bob_tpc 0:8604e9cc07f2 125 }
bob_tpc 0:8604e9cc07f2 126 return ERR_NONE;
bob_tpc 0:8604e9cc07f2 127 }
bob_tpc 0:8604e9cc07f2 128
bob_tpc 0:8604e9cc07f2 129
bob_tpc 0:8604e9cc07f2 130 int prox_msg()
bob_tpc 0:8604e9cc07f2 131 {
bob_tpc 3:e8cc286f9b2e 132 bool end_mark = FALSE;
bob_tpc 3:e8cc286f9b2e 133 int i;
bob_tpc 3:e8cc286f9b2e 134 uint8_t crcCount = sizeof(i2c_buffer_tx); // use tx buffer size to start
bob_tpc 3:e8cc286f9b2e 135
bob_tpc 3:e8cc286f9b2e 136 i2c.txBufferFlush(); // clear out UART buffers
bob_tpc 3:e8cc286f9b2e 137 i2c.rxBufferFlush();
bob_tpc 3:e8cc286f9b2e 138
bob_tpc 3:e8cc286f9b2e 139 for (int i = 0; i < sizeof(uart_buffer_tx); i++)
bob_tpc 3:e8cc286f9b2e 140 {
bob_tpc 3:e8cc286f9b2e 141 if (!uart.writeable()) return ERR_UART_NOT_WRITEABLE; // if no space in uart, return error
bob_tpc 3:e8cc286f9b2e 142 uart.putc(uart_buffer_tx[i]); // send uart message
bob_tpc 3:e8cc286f9b2e 143
bob_tpc 3:e8cc286f9b2e 144 if (uart_buffer_tx[i] == 0x7E) // check for rfid end mark in outbound message
bob_tpc 3:e8cc286f9b2e 145 {
bob_tpc 3:e8cc286f9b2e 146 crcCount = 2; // two more bytes for CRC
bob_tpc 3:e8cc286f9b2e 147 end_mark = TRUE; // end mark was reached
bob_tpc 3:e8cc286f9b2e 148 }
bob_tpc 3:e8cc286f9b2e 149 if (crcCount-- == 0) // end of message
bob_tpc 3:e8cc286f9b2e 150 {
bob_tpc 3:e8cc286f9b2e 151 if (end_mark == FALSE) return ERR_UART_NO_TX_ENDMARK; // no end mark detected
bob_tpc 3:e8cc286f9b2e 152 break;
bob_tpc 3:e8cc286f9b2e 153 }
bob_tpc 3:e8cc286f9b2e 154 }
bob_tpc 3:e8cc286f9b2e 155
bob_tpc 3:e8cc286f9b2e 156 end_mark = FALSE;
bob_tpc 3:e8cc286f9b2e 157 //wait(0.5); // debug
bob_tpc 3:e8cc286f9b2e 158 while(!uart.readable()); // wait for data from rfid
bob_tpc 3:e8cc286f9b2e 159 crcCount = sizeof(uart_buffer_rx); // use rx buffer size to start
bob_tpc 3:e8cc286f9b2e 160 for (i = 0; i < sizeof(uart_buffer_rx); i++)
bob_tpc 3:e8cc286f9b2e 161 {
bob_tpc 3:e8cc286f9b2e 162 uart_buffer_rx[i] = uart.getc(); // read a character
bob_tpc 3:e8cc286f9b2e 163 // cdc.printf("%d, 0x%X\n\r", i, uart_buffer_rx[i]); // debug
bob_tpc 3:e8cc286f9b2e 164
bob_tpc 3:e8cc286f9b2e 165 if (uart_buffer_rx[i] == 0x7E) // check for rfid end mark in inbound message
bob_tpc 3:e8cc286f9b2e 166 {
bob_tpc 3:e8cc286f9b2e 167 crcCount = 2; // two more bytes for crc
bob_tpc 3:e8cc286f9b2e 168 end_mark = TRUE; // end mark was reached
bob_tpc 3:e8cc286f9b2e 169 }
bob_tpc 3:e8cc286f9b2e 170 if (crcCount-- == 0) // end of message
bob_tpc 3:e8cc286f9b2e 171 {
bob_tpc 3:e8cc286f9b2e 172 if (end_mark == FALSE) return ERR_UART_NO_RX_ENDMARK;
bob_tpc 3:e8cc286f9b2e 173 break;
bob_tpc 3:e8cc286f9b2e 174 }
bob_tpc 3:e8cc286f9b2e 175 }
bob_tpc 3:e8cc286f9b2e 176 return ERR_NONE;
bob_tpc 0:8604e9cc07f2 177 return ERR_NONE;
bob_tpc 0:8604e9cc07f2 178 }
bob_tpc 0:8604e9cc07f2 179
bob_tpc 0:8604e9cc07f2 180 int gpio_msg()
bob_tpc 0:8604e9cc07f2 181 {
bob_tpc 0:8604e9cc07f2 182 return ERR_NONE;
bob_tpc 0:8604e9cc07f2 183 }
bob_tpc 0:8604e9cc07f2 184
bob_tpc 1:bd988d267998 185 int eeprom_msg() // eeprom to be implemented along with next hardware prototype
bob_tpc 0:8604e9cc07f2 186 {
bob_tpc 0:8604e9cc07f2 187 return ERR_NONE;
bob_tpc 0:8604e9cc07f2 188 }
bob_tpc 0:8604e9cc07f2 189
bob_tpc 0:8604e9cc07f2 190 int main()
bob_tpc 0:8604e9cc07f2 191 {
bob_tpc 0:8604e9cc07f2 192 // initialize everything
bob_tpc 0:8604e9cc07f2 193
bob_tpc 3:e8cc286f9b2e 194 wait(3.0); // debug - gives some time to start terminal program and open COM port
bob_tpc 3:e8cc286f9b2e 195
bob_tpc 0:8604e9cc07f2 196 init_periph();
bob_tpc 0:8604e9cc07f2 197
bob_tpc 3:e8cc286f9b2e 198 //cdc.printf("Starting...\n\r"); // debug
bob_tpc 0:8604e9cc07f2 199
bob_tpc 2:efaf8aee55df 200 while(!cdc.readable()); // spin here until a message comes in from the host PC
bob_tpc 0:8604e9cc07f2 201 bool end_mark = FALSE;
bob_tpc 2:efaf8aee55df 202 uint8_t crcCount = sizeof(cdc_buffer_rx); // use tx buffer size to start
bob_tpc 3:e8cc286f9b2e 203 //cdc.printf("\n\rCDC Input: "); // debug
bob_tpc 0:8604e9cc07f2 204 for (i = 0; i < sizeof(cdc_buffer_rx); i++)
bob_tpc 0:8604e9cc07f2 205 {
bob_tpc 2:efaf8aee55df 206 cdc_buffer_rx[i] = cdc.getc(); // read data from USB side
bob_tpc 0:8604e9cc07f2 207
bob_tpc 2:efaf8aee55df 208 //cdc.printf("%X, ",cdc_buffer_rx[i]); // debug
bob_tpc 0:8604e9cc07f2 209
bob_tpc 2:efaf8aee55df 210 if (cdc_buffer_rx[i] == 0x7E) // check for rfid end mark in outbound message
bob_tpc 0:8604e9cc07f2 211 {
bob_tpc 2:efaf8aee55df 212 crcCount = 2; // two more bytes for CRC
bob_tpc 2:efaf8aee55df 213 end_mark = TRUE; // end mark was reached
bob_tpc 0:8604e9cc07f2 214 }
bob_tpc 2:efaf8aee55df 215 if (crcCount-- == 0) // end of message
bob_tpc 0:8604e9cc07f2 216 {
bob_tpc 2:efaf8aee55df 217 if (end_mark == FALSE) return ERR_UART_NO_TX_ENDMARK; // no end mark detected
bob_tpc 0:8604e9cc07f2 218 break;
bob_tpc 0:8604e9cc07f2 219 }
bob_tpc 0:8604e9cc07f2 220 }
bob_tpc 0:8604e9cc07f2 221
bob_tpc 0:8604e9cc07f2 222 switch(cdc_buffer_rx[0])
bob_tpc 0:8604e9cc07f2 223 {
bob_tpc 2:efaf8aee55df 224 case 0xBB: // RFID-FE
bob_tpc 0:8604e9cc07f2 225 for (i = 0; i < sizeof(cdc_buffer_rx); i++)
bob_tpc 0:8604e9cc07f2 226 {
bob_tpc 2:efaf8aee55df 227 uart_buffer_tx[i] = cdc_buffer_rx[i]; // copy USB message to UART for RFID
bob_tpc 0:8604e9cc07f2 228 }
bob_tpc 0:8604e9cc07f2 229
bob_tpc 2:efaf8aee55df 230 status = rfid_msg(); // send buffer to RFID and get response according to RFID board
bob_tpc 0:8604e9cc07f2 231
bob_tpc 0:8604e9cc07f2 232 for (i = 0; i < sizeof(cdc_buffer_tx); i++)
bob_tpc 0:8604e9cc07f2 233 {
bob_tpc 2:efaf8aee55df 234 cdc_buffer_tx[i] = uart_buffer_rx[i]; // copy RFID response back to USB buffer
bob_tpc 0:8604e9cc07f2 235 }
bob_tpc 0:8604e9cc07f2 236
bob_tpc 2:efaf8aee55df 237 //cdc.printf("\n\rRFID Response: "); // debug
bob_tpc 0:8604e9cc07f2 238
bob_tpc 0:8604e9cc07f2 239 for (i = 0; i < sizeof(cdc_buffer_tx); i++)
bob_tpc 0:8604e9cc07f2 240 {
bob_tpc 3:e8cc286f9b2e 241 cdc.putc(), cdc_buffer_tx[i]); // send message back to PC
bob_tpc 0:8604e9cc07f2 242
bob_tpc 2:efaf8aee55df 243 if (cdc_buffer_tx[i] == 0x7E) // check for rfid end mark in outbound message
bob_tpc 0:8604e9cc07f2 244 {
bob_tpc 2:efaf8aee55df 245 crcCount = 2; // two more bytes for CRC
bob_tpc 2:efaf8aee55df 246 end_mark = TRUE; // end mark was reached
bob_tpc 0:8604e9cc07f2 247 }
bob_tpc 2:efaf8aee55df 248 if (crcCount-- == 0) // end of message
bob_tpc 0:8604e9cc07f2 249 {
bob_tpc 0:8604e9cc07f2 250 if (end_mark == FALSE) return ERR_CDC_NO_TX_ENDMARK; // no end mark detected
bob_tpc 0:8604e9cc07f2 251 break;
bob_tpc 0:8604e9cc07f2 252 }
bob_tpc 0:8604e9cc07f2 253 }
bob_tpc 0:8604e9cc07f2 254 break;
bob_tpc 2:efaf8aee55df 255 case 0xCC: // Proximity Sensor
bob_tpc 3:e8cc286f9b2e 256 for (i = 0; i < sizeof(cdc_buffer_rx); i++)
bob_tpc 3:e8cc286f9b2e 257 {
bob_tpc 3:e8cc286f9b2e 258 i2c_buffer_tx[i] = cdc_buffer_rx[i + 1]; // copy USB message to buffer for I2C
bob_tpc 3:e8cc286f9b2e 259 }
bob_tpc 3:e8cc286f9b2e 260
bob_tpc 3:e8cc286f9b2e 261 status = prox_msg(); // send buffer to RFID and get response according to RFID board
bob_tpc 3:e8cc286f9b2e 262
bob_tpc 3:e8cc286f9b2e 263 for (i = 0; i < sizeof(cdc_buffer_tx); i++)
bob_tpc 3:e8cc286f9b2e 264 {
bob_tpc 3:e8cc286f9b2e 265 cdc_buffer_tx[i] = uart_buffer_rx[i]; // copy RFID response back to USB buffer
bob_tpc 3:e8cc286f9b2e 266 }
bob_tpc 3:e8cc286f9b2e 267
bob_tpc 3:e8cc286f9b2e 268 //cdc.printf("\n\rRFID Response: "); // debug
bob_tpc 3:e8cc286f9b2e 269
bob_tpc 3:e8cc286f9b2e 270 for (i = 0; i < sizeof(cdc_buffer_tx); i++)
bob_tpc 3:e8cc286f9b2e 271 {
bob_tpc 3:e8cc286f9b2e 272 cdc.putc(), cdc_buffer_tx[i]); // send message back to PC
bob_tpc 3:e8cc286f9b2e 273
bob_tpc 3:e8cc286f9b2e 274 if (cdc_buffer_tx[i] == 0x7E) // check for rfid end mark in outbound message
bob_tpc 3:e8cc286f9b2e 275 {
bob_tpc 3:e8cc286f9b2e 276 crcCount = 2; // two more bytes for CRC
bob_tpc 3:e8cc286f9b2e 277 end_mark = TRUE; // end mark was reached
bob_tpc 3:e8cc286f9b2e 278 }
bob_tpc 3:e8cc286f9b2e 279 if (crcCount-- == 0) // end of message
bob_tpc 3:e8cc286f9b2e 280 {
bob_tpc 3:e8cc286f9b2e 281 if (end_mark == FALSE) return ERR_CDC_NO_TX_ENDMARK; // no end mark detected
bob_tpc 3:e8cc286f9b2e 282 break;
bob_tpc 3:e8cc286f9b2e 283 }
bob_tpc 3:e8cc286f9b2e 284 }
bob_tpc 3:e8cc286f9b2e 285
bob_tpc 0:8604e9cc07f2 286 break;
bob_tpc 2:efaf8aee55df 287 case 0xDD: // GPIO (LEDs and RFID-FE control
bob_tpc 0:8604e9cc07f2 288 gpio_msg();
bob_tpc 0:8604e9cc07f2 289 break;
bob_tpc 2:efaf8aee55df 290 case 0xEE: // Read/write EEPROM
bob_tpc 0:8604e9cc07f2 291 eeprom_msg();
bob_tpc 0:8604e9cc07f2 292 break;
bob_tpc 0:8604e9cc07f2 293 default:
bob_tpc 0:8604e9cc07f2 294 return ERR_CDC_BAD_CMD;
bob_tpc 0:8604e9cc07f2 295 }
bob_tpc 0:8604e9cc07f2 296 }