Working CAN (#35)
* Minor fix in documentation * Make CAN compile again * Now able to disable uart_serial * Boots and runs CAN Requires matching thingset-cpp library The placement of the ts_can.process_asap/process_1s is a little hack, but I did want to add even more ifdefs in the main method. Renaming the functions could do the trick. BTW, serial and CAN thingset can be run at the same time, no problems. * Some cleanups in the CAN interface
This commit is contained in:
+18
-1
@@ -41,6 +41,11 @@ extern ThingSet ts;
|
||||
extern ts_pub_channel_t pub_channels[];
|
||||
extern const int pub_channel_serial;
|
||||
|
||||
#ifdef CAN_ENABLED
|
||||
#include "thingset_can.h"
|
||||
#endif
|
||||
|
||||
|
||||
void thingset_serial_init(Serial* s)
|
||||
{
|
||||
#ifdef UART_SERIAL_ENABLED
|
||||
@@ -59,8 +64,12 @@ void thingset_serial_process_asap()
|
||||
#ifdef USB_SERIAL_ENABLED
|
||||
usb_serial_process();
|
||||
#endif
|
||||
#ifdef CAN_ENABLED
|
||||
ts_can.process_asap();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void thingset_serial_process_1s()
|
||||
{
|
||||
#ifdef UART_SERIAL_ENABLED
|
||||
@@ -70,6 +79,10 @@ void thingset_serial_process_1s()
|
||||
usb_serial_pub();
|
||||
#endif
|
||||
|
||||
#ifdef CAN_ENABLED
|
||||
ts_can.process_1s();
|
||||
#endif
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
@@ -101,12 +114,16 @@ void uart_serial_isr()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef UART_SERIAL_ENABLED
|
||||
void uart_serial_init(Serial* s)
|
||||
{
|
||||
ser_uart = s;
|
||||
s->attach(uart_serial_isr);
|
||||
}
|
||||
#endif
|
||||
#ifdef UART_SERIAL_ENABLED
|
||||
extern const int PUB_CHANNEL_SERIAL;
|
||||
|
||||
void uart_serial_pub()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user