AEM
utilities.h File Reference
#include <Arduino.h>
#include "config.h"

Go to the source code of this file.

Functions

void encode (uint8_t &coded, const uint8_t &left, const uint8_t &right)
 
void decode (const uint8_t &coded, uint8_t &left, uint8_t &right)
 

Function Documentation

void decode ( const uint8_t &  coded,
uint8_t &  left,
uint8_t &  right 
)

decodes bits LLLLRRRR to LLLL, RRRR , max value to decode is 255

Parameters
&coded: a read only value containing the coded bits
&left: reference to variable for the left 4 decoded bits
&right: reference to variable for the right 4 decoded bits
void encode ( uint8_t &  coded,
const uint8_t &  left,
const uint8_t &  right 
)

encodes bits LLLL, RRRR to LLLLRRRR , max value to encode is 15

Parameters
&coded: a reference the encoded value that the function will create
&left: read only value for the left 4 bits
&right: read only value for the right 4 bits