23#define TIMER_RECEIVE_MICROS 2000
26static bool cont =
false;
27static bool init =
false;
28static bool receive =
true;
30static void toggleMirrorMode(
void) {
46#if CONF_ECU_POSITION == BACK_ECU
55static int getSerialByte() {
57 while (!Serial.available()) {
59 serialData = Serial.read();
60 Log.
d(ID,
"Data received:", serialData);
64static int getSerialInt() {
66 while (!Serial.available()) {
68 size_t count = Serial.readBytes((
char *)(&serialData), 4);
70 Log.
w(ID,
"Did not receive 4 bytes for integer", count);
73 Log.
d(ID,
"Data received:", serialData);
78#if CONF_ECU_POSITION == BACK_ECU
82 Log(ID,
"Mirror Mode Enabled");
84 Log(ID,
"Waiting for data");
85 int serialData = getSerialByte();
89 Log(ID,
"Waiting for a pin to set");
90 int pin = getSerialByte();
91 Log(ID,
"Waiting for the value to set it to");
92 int value = getSerialInt();
93 Log(ID,
"Setting pin:", pin);
94 Log(ID,
"To value:", value);
101 Log(ID,
"Mirror Mode Disabled");
102#if CONF_ECU_POSITION == BACK_ECU
Configure global build properties.
Make one ECU tell the other it is alive.
Special logging functionality.
const char * LOG_TAG
Type definition of logging tags This typedef is necessary to allow for easier manipulation of code by...
Logging::Log_t Log
The global logging object.
This module allows for the monitoring and modification of each GPIO pin on an ECU.
Update, set, and get predefined pin values.
#define COMMAND_TOGGLE_MIRROR_MODE
Command to enable mirror mode, for Mirror.h.
#define COMMAND_ENTER_MIRROR_SET
Command to listen for a pin to set, for Mirror.h.
SerialCommand functionality.
int receiveCommand(void)
receive any command from serial by matching incoming bytes to a callback
void setCommand(uint8_t command, CommandCallback callback)
attach a single callback to a byte value that will be received over serial
void addCallback(beatFunc func)
Add a callback to be run at each haertbeat.
Check and modify pin values over USB serial How to use - connect with a terminal that can both send a...
void setup(void)
Setup a listener for going into mirror mode, dependent on which ECU is compiled.
void enterMirrorMode(void)
Manually enter mirror mode, only returning when a set command is received.
void exitMirrorMode(void)
Manually exit mirror mode.
void setPinValue(uint8_t GPIO_Pin, int value)
Set the pin value of a predefined pin.
int getPinValue(uint8_t GPIO_Pin)
Get the pin value of a predefined pin.
void d(LOG_TAG TAG, LOG_MSG message)
Log a string using a debug tag.
void w(LOG_TAG TAG, LOG_MSG message)
Log a string using a warning tag.