Skip to content

Latest commit

 

History

History
56 lines (48 loc) · 3.71 KB

README.md

File metadata and controls

56 lines (48 loc) · 3.71 KB

107-Arduino-UAVCAN

Unit Tests codecov Compile Examples Arduino Lint keywords.txt Checks General Formatting Checks Spell Check

Arduino library for providing a convenient C++ interface for accessing UAVCAN (v1.0-beta) utilizing libcanard.

This library works for

Reference-Implementation UAVCAN on Arduino

Example

#include <ArduinoUAVCAN.h>
/* ... */
ArduinoUAVCAN uavcan(13, transmitCanFrame);
Heartbeat_1_0 hb;
/* ... */
void loop() {
  /* Update the heartbeat object */
  hb.uptime(millis() / 1000);
  hb.mode = Heartbeat_1_0::Mode::OPERATIONAL;

  /* Publish the heartbeat once/second */
  static unsigned long prev = 0;
  unsigned long const now = millis();
  if(now - prev > 1000) {
    uavcan.publish(hb);
    prev = now;
  }

  /* Transmit all enqeued CAN frames */
  while(uavcan.transmitCanFrame()) { }
}
/* ... */
bool transmitCanFrame(CanardFrame const & frame) {
  /* ... */
}

Contribution

Please take a look at the wiki for notes pertaining development of 107-Arduino-UAVCAN.