Select Git revision
AudioCameraPositioner.cs.meta
sufst-openlogger_controller.ino 1.68 KiB
#define DEBUG_ECU_CAN 0
#define DEBUG_ECU_CAN_MINIMAL 0
#include "openLoggerController.h"
#include "ecuCan.h"
#include "can.h"
// Watchdog
#include <avr/wdt.h>
#define OPENLOGGER_SERIAL_BUAD_RATE 115200
uint8_t arduinoProcessSerial();
void setup()
{
// put your setup code here, to run once:
// Serial port for host pc communications
Serial.begin(115200);
Serial.println("BEGIN");
// Openlogger runs on uart port TX1 RX1 (Serial1)
openloggerBegin(OPENLOGGER_SERIAL_BUAD_RATE);
//canBegin();
}
void loop()
{
// put your main code here, to run repeatedly:
/*
* ALL PROCESSES *MUST* BE NON BLOCKING
*/
unsigned long currMs = millis();
static unsigned long lastSdWriteMs = millis();
static uint16_t cnt = 0;
static CanMsgTemplate emulateCanMsg;
emulateCanMsg.len = 8;
if ((currMs - lastSdWriteMs) >= 20) {
emulateCanMsg.timestamp = millis();
emulateCanMsg.data16[0] = cnt++;
emulateCanMsg.data16[1] = cnt++;
emulateCanMsg.data16[2] = cnt++;
emulateCanMsg.data16[3] = cnt++;
emulateCanMsg.id = 0x2000;
ecuCanMsg0x2000(&emulateCanMsg);
emulateCanMsg.id = 0x2002;
ecuCanMsg0x2002(&emulateCanMsg);
lastSdWriteMs = millis();
}
wdt_reset();
openloggerProcess();