added some message builder helpers. Optimized libray a bit using inline functions and macros.

Converted Dallas example to use new library api.
This commit is contained in:
Henrik Ekblad
2014-05-16 10:35:26 +02:00
parent 7080520a3f
commit 9291a97d45
6 changed files with 104 additions and 48 deletions
+6 -2
View File
@@ -100,8 +100,8 @@ typedef enum {
// Check and fetch data from special messages
#define isTimeResponse(_msg) (mGetCommand(_msg)==C_INTERN && _msg.type==I_TIME)
#define isConfigResponse(_msg) (mGetCommand(_msg)==C_INTERN && _msg.type==I_CONFIG)
#define isTimeResponse(_msg) (mGetCommand(_msg)==C_INTERNAL && _msg.type==I_TIME)
#define isConfigResponse(_msg) (mGetCommand(_msg)==C_INTERNAL && _msg.type==I_CONFIG)
#define mIsMetric(_msg) (_msg.getByte() == 'M')
@@ -126,6 +126,10 @@ public:
int getInt();
unsigned int getUInt();
// Setters for building message "on the fly"
MyMessage setType(uint8_t type);
MyMessage setSensor(uint8_t sensor);
MyMessage setDestination(uint8_t destination);
// Setters for payload
MyMessage set(void* payload, uint8_t length);