MCPcopy Create free account
hub / github.com/ArduPilot/ArduRemoteID / init_once

Method init_once

RemoteIDModule/CANDriver.cpp:54–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52 };
53
54void CANDriver::init_once(bool enable_irq)
55{
56 if (twai_driver_install(&g_config, &t_config, &f_config) == ESP_OK)
57 {
58 Serial.printf("CAN/TWAI Driver installed\n");
59 }
60 else
61 {
62 Serial.printf("Failed to install CAN/TWAI driver\n");
63 return;
64 }
65
66 //Reconfigure alerts to detect rx-related stuff only...
67 uint32_t alerts_to_enable = TWAI_ALERT_RX_DATA | TWAI_ALERT_RX_QUEUE_FULL;
68 if (twai_reconfigure_alerts(alerts_to_enable, NULL) == ESP_OK) {
69 Serial.printf("CAN/TWAI Alerts reconfigured\n");
70 } else {
71 Serial.printf("Failed to reconfigure CAN/TWAI alerts");
72 }
73
74 //Start TWAI driver
75 if (twai_start() == ESP_OK)
76 {
77 Serial.printf("CAN/TWAI Driver started\n");
78 }
79 else
80 {
81 Serial.printf("Failed to start CAN/TWAI driver\n");
82 return;
83 }
84}
85
86bool CANDriver::init_bus(const uint32_t _bitrate)
87{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected