template<class Handle>
class stm32rcos::peripheral::Can< Handle >
#include <cstdio>
extern UART_HandleTypeDef huart2;
extern FDCAN_HandleTypeDef hfdcan1;
extern "C" void main_thread(void *) {
.id = 0x0,
.mask = 0x0,
.ide = false,
};
can1.attach_rx_queue(rx_filter, rx_queue);
can1.start();
.id = 0x3,
.ide = false,
.dlc = 1,
.data = {0x0},
};
for (int i = 0; i < 10; ++i) {
can1.transmit(tx_message, osWaitForever);
}
while (true) {
CanMessage rx_message;
if (rx_queue.pop(rx_message, osWaitForever)) {
printf(
"id: %d, data: %d\r\n", (
int)rx_message.
id,
(
int)rx_message.
data[0]);
}
osDelay(10);
}
}
bool enable_stdout(UartBase &uart)
Definition can_filter.hpp:8
Definition can_message.hpp:9
std::array< uint8_t, 8 > data
Definition can_message.hpp:13
uint32_t id
Definition can_message.hpp:10