Commit 1dfd2b54 authored by Antoine Lima's avatar Antoine Lima

[Useless] renamed RFMessage to Message

And abandonment of the Arduino part..
parent d399af75
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
#include "com.h"
#include <Arduino.h>
bool Com::addMessage(RFMessage::Type type, uint32_t content) {
RFMessage msg = {.type = type, .content=content};
bool Com::addMessage(Message::Type type, uint32_t content) {
Message msg = {.type = type, .content=content};
return _buffer.put(msg);
}
bool Com::sendRFID(uint32_t rfid) {
return addMessage(RFMessage::Type::RFID, rfid);
return addMessage(Message::Type::RFID, rfid);
}
bool Com::sendButton(uint8_t buttonID) {
return addMessage(RFMessage::Type::Butn, buttonID);
return addMessage(Message::Type::Butn, buttonID);
}
bool Com::sendGoal(uint8_t side) {
return addMessage(RFMessage::Type::Goal, side);
return addMessage(Message::Type::Goal, side);
}
bool Com::emitMessage() {
RFMessage msgToSend = {.type = RFMessage::Type::None, .content=0};
Message msgToSend = {.type = Message::Type::None, .content=0};
// Warning &?
if(_buffer.get(msgToSend)) {
Serial.print((uint8_t)msgToSend.type);
Serial.print(": ");
switch(msgToSend.type)
{
case Message::Type::RDID: Serial.print("rfid"); break;
case Message::Type::Butn: Serial.print("butn"); break;
case Message::Type::Goal: Serial.print("goal"); break;
}
Serial.print(":");
Serial.println(msgToSend.content, HEX);
return true;
}
......
......@@ -16,10 +16,10 @@ class Com
Type type;
uint32_t content;
} RFMessage;
} Message;
private:
CircularBuffer<RFMessage> _buffer;
bool addMessage(RFMessage::Type type, uint32_t content);
CircularBuffer<Message> _buffer;
bool addMessage(Message::Type type, uint32_t content);
public:
bool sendRFID(uint32_t rfid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment