32 #include "lib/sensors.h"
33 #include "dev/rs232.h"
35 #include "lib/simEnvChange.h"
39 const struct simInterface rs232_interface;
41 #define SERIAL_BUF_SIZE 1024
44 char simSerialReceivingData[SERIAL_BUF_SIZE];
45 int simSerialReceivingLength;
46 char simSerialReceivingFlag;
48 static int (* input_handler)(
unsigned char) =
NULL;
68 printf(
"%s", message);
72 slip_arch_writeb(
unsigned char c)
78 doInterfaceActionsBeforeTick(
void)
82 if (!simSerialReceivingFlag) {
86 if (simSerialReceivingLength == 0) {
88 simSerialReceivingFlag = 0;
93 if(input_handler !=
NULL) {
94 for (i=0; i < simSerialReceivingLength; i++) {
95 input_handler(simSerialReceivingData[i]);
99 for (i=0; i < simSerialReceivingLength; i++) {
100 serial_line_input_byte(simSerialReceivingData[i]);
102 serial_line_input_byte(0x0a);
105 simSerialReceivingLength = 0;
106 simSerialReceivingFlag = 0;
110 doInterfaceActionsAfterTick(
void)
115 SIM_INTERFACE(rs232_interface,
116 doInterfaceActionsBeforeTick,
117 doInterfaceActionsAfterTick);