Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/CMRI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,19 @@ void CMRI::set_init_handler(void (*handler)(const uint8_t *, int))

// reads in serial data, decodes packets
// automatically responds to POLL requests
// returns packet type so if we got a SET request you know to update your outputs
bool CMRI::process()
// returns the packet type (CMRI::INIT, CMRI::SET or CMRI::POLL) so if we got a
// SET request you know to update your outputs, or NULL if no valid packet was
// received
char CMRI::process()
{
while (_serial.available() > 0)
{
if (process_char(_serial.read()))
{
return true;
return _rx_packet_type;
}
}
return false;
return NOOP;
}

bool CMRI::process_char(char c)
Expand Down
2 changes: 1 addition & 1 deletion src/CMRI.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CMRI
void set_address(unsigned int address);
void set_init_handler(void (*handler)(const uint8_t *data, int len));

bool process();
char process();
bool process_char(char c);
void transmit();

Expand Down