Fork to see if I can get working

Dependencies:   BufferedSerial OneWire WinbondSPIFlash libxDot-dev-mbed5-deprecated

Fork of xDotBridge_update_test20180823 by Matt Briggs

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers util.h Source File

util.h

00001 /*
00002  * util.h
00003  *
00004  *  Created on: Mar 14, 2017
00005  *      Author: mbriggs
00006  */
00007 
00008 #ifndef XDOTBRIDGE_INC_UTIL_H_
00009 #define XDOTBRIDGE_INC_UTIL_H_
00010 
00011 #include <vector>
00012 
00013 void appendUint16ToVector (std::vector<uint8_t> &dest, uint16_t in)
00014 {
00015     dest.push_back((in & 0xFF00) >> 8); // High data byte
00016     dest.push_back((in & 0x00FF)); // Low data byte
00017 }
00018 void appendUint32ToVector (std::vector<uint8_t> &dest, uint32_t in)
00019 {
00020     dest.push_back((in & 0xFF000000) >> 24);
00021     dest.push_back((in & 0x00FF0000) >> 16);
00022     dest.push_back((in & 0x0000FF00) >> 8);
00023     dest.push_back((in & 0x000000FF));
00024 }
00025 
00026 
00027 
00028 #endif /* XDOTBRIDGE_INC_UTIL_H_ */