Framework for reading and writing variables in real time on any MBED platform.

DistantIO

This is the C implementation of the DistantIO slave framework.

Library is working but slight API breaks may occur in the future. C++ version is also in development.

To get the master-side implementation, see https://github.com/Overdrivr/DistantIO

Committer:
Overdrivr
Date:
Thu Oct 08 12:27:20 2015 +0000
Revision:
1:aaffeb93f99b
Parent:
0:c4676d32d381
Child:
2:f2c816b681e3
commit for publish

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Overdrivr 1:aaffeb93f99b 1 // Copyright (C) 2015 Rémi Bèges
Overdrivr 1:aaffeb93f99b 2 // For conditions of distribution and use, see copyright notice in the LICENSE.md file
Overdrivr 0:c4676d32d381 3
Overdrivr 0:c4676d32d381 4 #include "distantio.h"
Overdrivr 0:c4676d32d381 5 #include "crc.h"
Overdrivr 0:c4676d32d381 6 #include "string.h"
Overdrivr 0:c4676d32d381 7 #include "protocol.h"
Overdrivr 0:c4676d32d381 8
Overdrivr 1:aaffeb93f99b 9
Overdrivr 0:c4676d32d381 10
Overdrivr 0:c4676d32d381 11 static log Log;
Overdrivr 0:c4676d32d381 12 uint32_t tmp;
Overdrivr 0:c4676d32d381 13
Overdrivr 0:c4676d32d381 14 void send_variable(uint16_t index);
Overdrivr 0:c4676d32d381 15 uint16_t get_size(dio_type type);
Overdrivr 0:c4676d32d381 16 void send_descriptor(uint16_t index);
Overdrivr 0:c4676d32d381 17 void send_group_descriptor(uint16_t index);
Overdrivr 0:c4676d32d381 18
Overdrivr 0:c4676d32d381 19 /**
Overdrivr 0:c4676d32d381 20 * Inits the distant io framework
Overdrivr 0:c4676d32d381 21 */
Overdrivr 0:c4676d32d381 22 void init_distantio()
Overdrivr 0:c4676d32d381 23 {
Overdrivr 0:c4676d32d381 24 uint16_t i;
Overdrivr 0:c4676d32d381 25 char default_name[] = {"undef. "};
Overdrivr 0:c4676d32d381 26 Log.amount = 0;
Overdrivr 0:c4676d32d381 27 for(i = 0 ; i < VARIABLES_AMOUNT ; i++)
Overdrivr 0:c4676d32d381 28 {
Overdrivr 0:c4676d32d381 29 Log.variables[i].size = 0;
Overdrivr 0:c4676d32d381 30 Log.variables[i].ptr = 0;
Overdrivr 0:c4676d32d381 31 Log.variables[i].writeable = 0;
Overdrivr 0:c4676d32d381 32 Log.variables[i].id = i;
Overdrivr 0:c4676d32d381 33 strcpy(Log.variables[i].name,default_name);
Overdrivr 0:c4676d32d381 34 Log.variables[i].send = 0;
Overdrivr 0:c4676d32d381 35 Log.variables[i].groupID = 0;
Overdrivr 0:c4676d32d381 36 }
Overdrivr 0:c4676d32d381 37 tmp=0;
Overdrivr 0:c4676d32d381 38 Log.current_group_id = 0;
Overdrivr 0:c4676d32d381 39 strcpy(Log.groups[0].name,"default");
Overdrivr 0:c4676d32d381 40 }
Overdrivr 0:c4676d32d381 41
Overdrivr 0:c4676d32d381 42 /**
Overdrivr 0:c4676d32d381 43 * Register a variable exchanged with the computer
Overdrivr 0:c4676d32d381 44 */
Overdrivr 0:c4676d32d381 45 uint8_t register_var(void* ptr, uint16_t size, dio_type type, uint8_t writeable, char* name)
Overdrivr 0:c4676d32d381 46 {
Overdrivr 0:c4676d32d381 47 // Too many variables, aborting
Overdrivr 0:c4676d32d381 48 if(Log.amount >= VARIABLES_AMOUNT)
Overdrivr 0:c4676d32d381 49 return 1;
Overdrivr 0:c4676d32d381 50
Overdrivr 0:c4676d32d381 51 Log.variables[Log.amount].ptr = (uint8_t*) ptr;
Overdrivr 0:c4676d32d381 52 Log.variables[Log.amount].size = get_size(type);
Overdrivr 0:c4676d32d381 53 Log.variables[Log.amount].writeable = writeable;
Overdrivr 0:c4676d32d381 54 Log.variables[Log.amount].type = type;
Overdrivr 0:c4676d32d381 55 Log.variables[Log.amount].groupID = Log.current_group_id;
Overdrivr 0:c4676d32d381 56 strcpy(Log.variables[Log.amount].name,name);
Overdrivr 0:c4676d32d381 57
Overdrivr 0:c4676d32d381 58 Log.amount++;
Overdrivr 0:c4676d32d381 59
Overdrivr 0:c4676d32d381 60 return 0;
Overdrivr 0:c4676d32d381 61 }
Overdrivr 0:c4676d32d381 62
Overdrivr 0:c4676d32d381 63 void start_group(char* groupname)
Overdrivr 0:c4676d32d381 64 {
Overdrivr 0:c4676d32d381 65 Log.current_group_id++;
Overdrivr 0:c4676d32d381 66 strcpy(Log.groups[Log.current_group_id].name,groupname);
Overdrivr 0:c4676d32d381 67 }
Overdrivr 0:c4676d32d381 68
Overdrivr 0:c4676d32d381 69 /**
Overdrivr 0:c4676d32d381 70 * Send var descriptor
Overdrivr 0:c4676d32d381 71 */
Overdrivr 0:c4676d32d381 72
Overdrivr 0:c4676d32d381 73 void send_descriptor(uint16_t index)
Overdrivr 0:c4676d32d381 74 {
Overdrivr 0:c4676d32d381 75 if(index >= Log.amount)
Overdrivr 0:c4676d32d381 76 return;
Overdrivr 0:c4676d32d381 77
Overdrivr 0:c4676d32d381 78 static uint8_t buffer[PAYLOAD_SIZE];
Overdrivr 0:c4676d32d381 79 uint8_t type;
Overdrivr 0:c4676d32d381 80
Overdrivr 0:c4676d32d381 81 // Respond returned-descriptor
Overdrivr 0:c4676d32d381 82 buffer[0] = 0x00;
Overdrivr 0:c4676d32d381 83
Overdrivr 0:c4676d32d381 84 // Write id
Overdrivr 0:c4676d32d381 85 uint16_t ID = ((Log.variables[index].groupID & 0x003F) << 10) + (index & 0x3FF);
Overdrivr 0:c4676d32d381 86 uint8_t * temp_ptr = (uint8_t*)(&ID);
Overdrivr 0:c4676d32d381 87 buffer[1] = *(temp_ptr + 1);
Overdrivr 0:c4676d32d381 88 buffer[2] = *(temp_ptr );
Overdrivr 0:c4676d32d381 89
Overdrivr 0:c4676d32d381 90 // Write type & writeable
Overdrivr 0:c4676d32d381 91
Overdrivr 0:c4676d32d381 92 type = (uint8_t)(Log.variables[index].type);
Overdrivr 0:c4676d32d381 93
Overdrivr 0:c4676d32d381 94 if(Log.variables[index].writeable)
Overdrivr 0:c4676d32d381 95 type += 0xF0;
Overdrivr 0:c4676d32d381 96
Overdrivr 0:c4676d32d381 97 buffer[3] = type;
Overdrivr 0:c4676d32d381 98
Overdrivr 0:c4676d32d381 99 //Write name
Overdrivr 0:c4676d32d381 100 uint16_t i = 4;
Overdrivr 0:c4676d32d381 101 for(uint16_t k = 0 ; k < 8 ; k++)
Overdrivr 0:c4676d32d381 102 {
Overdrivr 0:c4676d32d381 103 if(k < strlen(Log.variables[index].name))
Overdrivr 0:c4676d32d381 104 {
Overdrivr 0:c4676d32d381 105 buffer[i] = Log.variables[index].name[k];
Overdrivr 0:c4676d32d381 106 i++;
Overdrivr 0:c4676d32d381 107 }
Overdrivr 0:c4676d32d381 108 else
Overdrivr 0:c4676d32d381 109 buffer[i++] = 0;
Overdrivr 0:c4676d32d381 110 }
Overdrivr 0:c4676d32d381 111
Overdrivr 0:c4676d32d381 112 // Compute crc
Overdrivr 0:c4676d32d381 113 uint16_t crc_value = crc16(buffer,i);
Overdrivr 0:c4676d32d381 114
Overdrivr 0:c4676d32d381 115 // Write crc into buffer's last byte
Overdrivr 0:c4676d32d381 116 buffer[i++] = (crc_value >> 8) & 0xFF;
Overdrivr 0:c4676d32d381 117 buffer[i++] = crc_value & 0xFF;
Overdrivr 0:c4676d32d381 118
Overdrivr 0:c4676d32d381 119 // Encode frame
Overdrivr 0:c4676d32d381 120 encode(buffer,i);
Overdrivr 0:c4676d32d381 121 }
Overdrivr 0:c4676d32d381 122
Overdrivr 0:c4676d32d381 123 void send_group_descriptor(uint16_t index)
Overdrivr 0:c4676d32d381 124 {
Overdrivr 0:c4676d32d381 125 if(index > Log.current_group_id)
Overdrivr 0:c4676d32d381 126 return;
Overdrivr 0:c4676d32d381 127
Overdrivr 0:c4676d32d381 128 static uint8_t buffer[PAYLOAD_SIZE];
Overdrivr 0:c4676d32d381 129
Overdrivr 0:c4676d32d381 130 // Respond returned-descriptor
Overdrivr 0:c4676d32d381 131 buffer[0] = 0x00;
Overdrivr 0:c4676d32d381 132
Overdrivr 0:c4676d32d381 133 // Write id
Overdrivr 0:c4676d32d381 134 uint16_t ID = (index & 0x3F) << 10;
Overdrivr 0:c4676d32d381 135 uint8_t * temp_ptr = (uint8_t*)(&ID);
Overdrivr 0:c4676d32d381 136 buffer[1] = *(temp_ptr + 1);
Overdrivr 0:c4676d32d381 137 buffer[2] = *(temp_ptr);
Overdrivr 0:c4676d32d381 138
Overdrivr 0:c4676d32d381 139 // Write type
Overdrivr 0:c4676d32d381 140 buffer[3] = 0x07;
Overdrivr 0:c4676d32d381 141
Overdrivr 0:c4676d32d381 142 //Write name
Overdrivr 0:c4676d32d381 143 uint16_t i = 4;
Overdrivr 0:c4676d32d381 144 for(uint16_t k = 0 ; k < 8 ; k++)
Overdrivr 0:c4676d32d381 145 {
Overdrivr 0:c4676d32d381 146 if(k < strlen(Log.groups[index].name))
Overdrivr 0:c4676d32d381 147 {
Overdrivr 0:c4676d32d381 148 buffer[i] = Log.groups[index].name[k];
Overdrivr 0:c4676d32d381 149 i++;
Overdrivr 0:c4676d32d381 150 }
Overdrivr 0:c4676d32d381 151 else
Overdrivr 0:c4676d32d381 152 buffer[i++] = 0;
Overdrivr 0:c4676d32d381 153 }
Overdrivr 0:c4676d32d381 154
Overdrivr 0:c4676d32d381 155 // Compute crc
Overdrivr 0:c4676d32d381 156 uint16_t crc_value = crc16(buffer,i);
Overdrivr 0:c4676d32d381 157
Overdrivr 0:c4676d32d381 158 // Write crc into buffer's last byte
Overdrivr 0:c4676d32d381 159 buffer[i++] = (crc_value >> 8) & 0xFF;
Overdrivr 0:c4676d32d381 160 buffer[i++] = crc_value & 0xFF;
Overdrivr 0:c4676d32d381 161
Overdrivr 0:c4676d32d381 162 // Encode frame
Overdrivr 0:c4676d32d381 163 encode(buffer,i);
Overdrivr 0:c4676d32d381 164 }
Overdrivr 0:c4676d32d381 165
Overdrivr 0:c4676d32d381 166 void distantio_decode(uint8_t* data,uint16_t datasize)
Overdrivr 0:c4676d32d381 167 {
Overdrivr 0:c4676d32d381 168 // First check data size
Overdrivr 0:c4676d32d381 169 // 1 byte cmd + 2 bytes id + 1 byte type + FRAME_SIZE + 2 byte CRC
Overdrivr 0:c4676d32d381 170 if(datasize != PAYLOAD_SIZE)
Overdrivr 0:c4676d32d381 171 return;
Overdrivr 0:c4676d32d381 172
Overdrivr 0:c4676d32d381 173 // Second, check CRC
Overdrivr 0:c4676d32d381 174 uint16_t crc_value = crc16(data,PAYLOAD_SIZE-2);
Overdrivr 0:c4676d32d381 175 uint16_t crc_rx = ((uint16_t)data[PAYLOAD_SIZE-2] << 8) | data[PAYLOAD_SIZE-1];
Overdrivr 0:c4676d32d381 176
Overdrivr 0:c4676d32d381 177 if(crc_value != crc_rx)
Overdrivr 0:c4676d32d381 178 return;
Overdrivr 0:c4676d32d381 179
Overdrivr 0:c4676d32d381 180 // Process frame
Overdrivr 0:c4676d32d381 181 // First, identify command
Overdrivr 0:c4676d32d381 182 uint8_t command = data[0];
Overdrivr 0:c4676d32d381 183
Overdrivr 0:c4676d32d381 184 // Second, identify variable ID
Overdrivr 0:c4676d32d381 185 uint16_t ID = data[2] + (data[1] << 8);
Overdrivr 0:c4676d32d381 186 ID = (ID & 0x3FF);
Overdrivr 0:c4676d32d381 187
Overdrivr 0:c4676d32d381 188 // Third, identify data type
Overdrivr 0:c4676d32d381 189 uint8_t type = data[3];
Overdrivr 0:c4676d32d381 190
Overdrivr 0:c4676d32d381 191 switch(command)
Overdrivr 0:c4676d32d381 192 {
Overdrivr 0:c4676d32d381 193 // User requested descriptors
Overdrivr 0:c4676d32d381 194 case 0x02:
Overdrivr 0:c4676d32d381 195 // Send variables
Overdrivr 0:c4676d32d381 196 for(uint16_t i = 0 ; i < Log.amount ; i++)
Overdrivr 0:c4676d32d381 197 send_descriptor(i);
Overdrivr 0:c4676d32d381 198 // Send groups
Overdrivr 0:c4676d32d381 199 for(uint16_t i = 0 ; i <= Log.current_group_id ; i++)
Overdrivr 0:c4676d32d381 200 send_group_descriptor(i);
Overdrivr 0:c4676d32d381 201 break;
Overdrivr 0:c4676d32d381 202
Overdrivr 0:c4676d32d381 203 // User provided value to write
Overdrivr 0:c4676d32d381 204 case 0x04:
Overdrivr 0:c4676d32d381 205 if(ID >= Log.amount)
Overdrivr 0:c4676d32d381 206 return;
Overdrivr 0:c4676d32d381 207
Overdrivr 0:c4676d32d381 208 if(Log.variables[ID].writeable == 0x00)
Overdrivr 0:c4676d32d381 209 return;
Overdrivr 0:c4676d32d381 210
Overdrivr 0:c4676d32d381 211 if(Log.variables[ID].type != type)
Overdrivr 0:c4676d32d381 212 return;
Overdrivr 0:c4676d32d381 213
Overdrivr 0:c4676d32d381 214 uint16_t start_address = 4 + DATA_SIZE - 1;
Overdrivr 0:c4676d32d381 215
Overdrivr 0:c4676d32d381 216 // Copy contents directly into variable
Overdrivr 0:c4676d32d381 217 for(uint16_t i = 0 ; i < Log.variables[ID].size ; i++)
Overdrivr 0:c4676d32d381 218 {
Overdrivr 0:c4676d32d381 219 // Packet is big-endian, convert to little-endian
Overdrivr 0:c4676d32d381 220 uint8_t offset = start_address - i;
Overdrivr 0:c4676d32d381 221 *(Log.variables[ID].ptr + i) = *(data + offset);
Overdrivr 0:c4676d32d381 222 }
Overdrivr 0:c4676d32d381 223 break;
Overdrivr 0:c4676d32d381 224
Overdrivr 0:c4676d32d381 225 // User requested variable read
Overdrivr 0:c4676d32d381 226 case 0x05:
Overdrivr 0:c4676d32d381 227 if(ID >= Log.amount)
Overdrivr 0:c4676d32d381 228 return;
Overdrivr 0:c4676d32d381 229
Overdrivr 0:c4676d32d381 230 Log.variables[ID].send = 1;
Overdrivr 0:c4676d32d381 231 break;
Overdrivr 0:c4676d32d381 232
Overdrivr 0:c4676d32d381 233 // User requested stop variable read
Overdrivr 0:c4676d32d381 234 case 0x06:
Overdrivr 0:c4676d32d381 235 if(ID >= Log.amount)
Overdrivr 0:c4676d32d381 236 return;
Overdrivr 0:c4676d32d381 237 Log.variables[ID].send = 0;
Overdrivr 0:c4676d32d381 238 break;
Overdrivr 0:c4676d32d381 239
Overdrivr 0:c4676d32d381 240 }
Overdrivr 0:c4676d32d381 241 }
Overdrivr 0:c4676d32d381 242
Overdrivr 0:c4676d32d381 243 void send_variables()
Overdrivr 0:c4676d32d381 244 {
Overdrivr 0:c4676d32d381 245 for(uint16_t i = 0 ; i < Log.amount ; i++)
Overdrivr 0:c4676d32d381 246 {
Overdrivr 0:c4676d32d381 247 if(Log.variables[i].send == 0)
Overdrivr 0:c4676d32d381 248 continue;
Overdrivr 0:c4676d32d381 249
Overdrivr 0:c4676d32d381 250 send_variable(i);
Overdrivr 0:c4676d32d381 251 }
Overdrivr 0:c4676d32d381 252 }
Overdrivr 0:c4676d32d381 253
Overdrivr 0:c4676d32d381 254 void send_variable(uint16_t index)
Overdrivr 0:c4676d32d381 255 {
Overdrivr 0:c4676d32d381 256 if(index >= Log.amount)
Overdrivr 0:c4676d32d381 257 return;
Overdrivr 0:c4676d32d381 258
Overdrivr 0:c4676d32d381 259 static uint8_t buffer[PAYLOAD_SIZE];
Overdrivr 0:c4676d32d381 260
Overdrivr 0:c4676d32d381 261 // Response code 0x01
Overdrivr 0:c4676d32d381 262 buffer[0] = 0x01;
Overdrivr 0:c4676d32d381 263
Overdrivr 0:c4676d32d381 264 // Write variable ID
Overdrivr 0:c4676d32d381 265 uint16_t ID = ((Log.variables[index].groupID & 0x003F) << 10) + (index & 0x3FF);
Overdrivr 0:c4676d32d381 266 uint8_t * temp_ptr = (uint8_t*)(&ID);
Overdrivr 0:c4676d32d381 267 buffer[1] = *(temp_ptr + 1);
Overdrivr 0:c4676d32d381 268 buffer[2] = *(temp_ptr);
Overdrivr 0:c4676d32d381 269
Overdrivr 0:c4676d32d381 270 // Write variable type
Overdrivr 0:c4676d32d381 271 buffer[3] = Log.variables[index].type;
Overdrivr 0:c4676d32d381 272 //TODO writeable
Overdrivr 0:c4676d32d381 273
Overdrivr 0:c4676d32d381 274 uint16_t i = 4;
Overdrivr 0:c4676d32d381 275
Overdrivr 0:c4676d32d381 276 // Write data
Overdrivr 0:c4676d32d381 277 for(uint16_t k = 0 ; k < DATA_SIZE ; k++)
Overdrivr 0:c4676d32d381 278 {
Overdrivr 0:c4676d32d381 279 uint16_t off = DATA_SIZE - 1 - k;
Overdrivr 0:c4676d32d381 280
Overdrivr 0:c4676d32d381 281 // Fill buffer with data
Overdrivr 0:c4676d32d381 282 if(off < Log.variables[index].size)
Overdrivr 0:c4676d32d381 283 {
Overdrivr 0:c4676d32d381 284 temp_ptr = Log.variables[index].ptr + off ;
Overdrivr 0:c4676d32d381 285 buffer[i++] = *temp_ptr;
Overdrivr 0:c4676d32d381 286 }
Overdrivr 0:c4676d32d381 287 // Fill remaining bits with 0
Overdrivr 0:c4676d32d381 288 else
Overdrivr 0:c4676d32d381 289 {
Overdrivr 0:c4676d32d381 290 buffer[i++] = 0;
Overdrivr 0:c4676d32d381 291 }
Overdrivr 0:c4676d32d381 292 }
Overdrivr 0:c4676d32d381 293
Overdrivr 0:c4676d32d381 294 // Compute crc
Overdrivr 0:c4676d32d381 295 uint16_t crc_value = crc16(buffer,i);
Overdrivr 0:c4676d32d381 296
Overdrivr 0:c4676d32d381 297 // Write crc into buffer's last byte
Overdrivr 0:c4676d32d381 298 buffer[i++] = (crc_value >> 8) & 0xFF;
Overdrivr 0:c4676d32d381 299 buffer[i++] = crc_value & 0xFF;
Overdrivr 0:c4676d32d381 300
Overdrivr 0:c4676d32d381 301 // Encode frame
Overdrivr 0:c4676d32d381 302 encode(buffer,i);
Overdrivr 0:c4676d32d381 303 }
Overdrivr 0:c4676d32d381 304
Overdrivr 0:c4676d32d381 305 void send_alive()
Overdrivr 0:c4676d32d381 306 {
Overdrivr 0:c4676d32d381 307 static uint8_t buffer[PAYLOAD_SIZE] = {0x03,0x00,0x10,0x00,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x00,0x00};
Overdrivr 0:c4676d32d381 308
Overdrivr 0:c4676d32d381 309 uint16_t index = 1;
Overdrivr 0:c4676d32d381 310 uint16_t group = 0;
Overdrivr 0:c4676d32d381 311 uint16_t ID = ((group & 0x003F) << 10) + (index & 0x3FF);
Overdrivr 0:c4676d32d381 312 uint8_t * temp_ptr = (uint8_t*)(&ID);
Overdrivr 0:c4676d32d381 313 buffer[1] = *(temp_ptr + 1);
Overdrivr 0:c4676d32d381 314 buffer[2] = *(temp_ptr );
Overdrivr 0:c4676d32d381 315
Overdrivr 0:c4676d32d381 316 // Compute crc
Overdrivr 0:c4676d32d381 317 uint16_t crc_value = crc16(buffer,PAYLOAD_SIZE - 2);
Overdrivr 0:c4676d32d381 318
Overdrivr 0:c4676d32d381 319 // Write crc into buffer's last byte
Overdrivr 0:c4676d32d381 320 buffer[PAYLOAD_SIZE - 1] = crc_value & 0xFF;
Overdrivr 0:c4676d32d381 321 buffer[PAYLOAD_SIZE - 2] = (crc_value >> 8) & 0xFF;
Overdrivr 0:c4676d32d381 322
Overdrivr 0:c4676d32d381 323 // Send frame to encoding
Overdrivr 0:c4676d32d381 324 encode(buffer,PAYLOAD_SIZE);
Overdrivr 0:c4676d32d381 325 }
Overdrivr 0:c4676d32d381 326
Overdrivr 0:c4676d32d381 327
Overdrivr 0:c4676d32d381 328 /**
Overdrivr 0:c4676d32d381 329 * Returns the size in byte for each variable
Overdrivr 0:c4676d32d381 330 */
Overdrivr 0:c4676d32d381 331
Overdrivr 0:c4676d32d381 332 uint16_t get_size(dio_type type)
Overdrivr 0:c4676d32d381 333 {
Overdrivr 0:c4676d32d381 334 switch(type)
Overdrivr 0:c4676d32d381 335 {
Overdrivr 0:c4676d32d381 336 case dio_type_FLOAT:
Overdrivr 0:c4676d32d381 337 case dio_type_UINT32:
Overdrivr 0:c4676d32d381 338 case dio_type_INT32:
Overdrivr 0:c4676d32d381 339 return 4;
Overdrivr 0:c4676d32d381 340
Overdrivr 0:c4676d32d381 341 case dio_type_UINT16:
Overdrivr 0:c4676d32d381 342 case dio_type_INT16:
Overdrivr 0:c4676d32d381 343 return 2;
Overdrivr 0:c4676d32d381 344
Overdrivr 0:c4676d32d381 345 case dio_type_UINT8:
Overdrivr 0:c4676d32d381 346 case dio_type_INT8:
Overdrivr 0:c4676d32d381 347 default:
Overdrivr 0:c4676d32d381 348 return 1;
Overdrivr 0:c4676d32d381 349 }
Overdrivr 0:c4676d32d381 350 }
Overdrivr 0:c4676d32d381 351