src/slcan_decode.c
/**
 * 
 * This decodes byte data
 * 
 * @param buf    The buffer to use
 * @param length The number of characters to decode
 * @param data   The data buffer to put the byte data in
 * 
 * @return True if this was successfully decoded, false otherwise
 */
This decodes byte data

@param buf    The buffer to use
@param length The number of characters to decode
@param data   The data buffer to put the byte data in

@return True if this was successfully decoded, false otherwise
This decodes byte data @param buf The buffer to use @param length The number of characters to decode @param data The data buffer to put the byte data in @return True if this was successfully decoded false otherwise
bool decodeByteData(uint8_t *buf, uint8_t length, uint8_t *data)
{
    if ((buf == NULL) || (data == NULL)) {
        return false;
    }
    uint8_t i;
    uint8_t bytes = length / 2;
    for (i = 0; i < bytes; i++) {
        data[i] = (uint8_t)decodeNumber(&(buf[i * 2]), 2);
    }
    return true;
}
bool decodeByteData ( uint8_t * buf , uint8_t length , uint8_t * data ) { if ( ( buf == NULL ) || ( data == NULL ) ) { return false ; } uint8_t i ; uint8_t bytes = length / 2 ; for ( i = 0 ; i < bytes ; i ++ ) { data [ i ] = ( uint8_t ) decodeNumber ( & ( buf [ i * 2 ] ) , 2 ) ; } return true ; }
This decodes byte data
This decodes byte data
// Can't have null pointers