Skip to content

Latest commit

 

History

History
37 lines (29 loc) · 782 Bytes

README.md

File metadata and controls

37 lines (29 loc) · 782 Bytes

CANfetti

License: MIT

A CANopen stack by Scythe 🎊

Currently supported platforms:

Examples

Teensy Example

static constexpr uint8_t MyNodeId = 1;
static float temperatureC = 0.f;
static canfetti::TyCoDev canDevice;
static canfetti::TyCo co(canDevice, MyNodeId, "MyNodeName");

void setup()
{
  tempmon_init();

  co.init();
  co.setHeartbeatPeriod(1000); // Send a NMT heartbeat @ 1Hz

  // TPDO1 @ 10Hz
  co.autoAddTPDO(1, 0x181, 100, canfetti::_p(temperatureC));
}

void loop() {
  co.service(); // Runs the CANopen stack
  ...
  temperatureC = tempmonGetTemp();
  ...
}