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:
hogthrob
2019-06-23 00:41:01 +02:00
committed by Martin Jäger
parent 7d02c92c7d
commit 14faa1f0e8
8 changed files with 201 additions and 115 deletions
+10 -3
View File
@@ -40,6 +40,7 @@
#include "log.h" // log data (error memory, min/max measurements, etc.)
#include "data_objects.h" // for access to internal data via ThingSet
#include "thingset_serial.h" // UART or USB serial communication
#include "thingset_can.h" // CAN bus communication
Serial serial(PIN_SWD_TX, PIN_SWD_RX, "serial");
@@ -116,7 +117,7 @@ int main()
#else // MPPT
dcdc_init(&dcdc);
half_bridge_init(PWM_FREQUENCY, 300, 12 / dcdc.hs_voltage_max, 0.97); // lower duty limit might have to be adjusted dynamically depending on LS voltage
#endif
#endif
// Configuration from EEPROM
data_objects_read_eeprom();
@@ -133,9 +134,15 @@ int main()
calibrate_current_sensors();
// Communication interfaces
uart_serial_init(&serial);
uext_init();
#ifdef UART_SERIAL_ENABLED
thingset_serial_init(&serial);
#endif
#ifdef CAN_ENABLED
ts_can.enable();
#endif
uext_init();
init_watchdog(10); // 10s should be enough for communication ports
// Setup of DC/DC power stage