gerði breytingar pi megin og þarf að pusha fyrir tölvuna

This commit is contained in:
2026-10-15 15:29:08 +00:00
parent b4f274a65c
commit 13a89d7311
5 changed files with 24 additions and 9 deletions
+8 -6
View File
@@ -7,25 +7,27 @@
/* Devicetree node selected by zephyr,canbus in the overlay */
#define CANBUS_NODE DT_CHOSEN(zephyr_canbus)
int main(void)
// L4.4 example. Built only with the can_frame_test environment
// (-D CAN_FRAME_TEST=1); main() in main.c calls this function.
void can_frame_test_main(void)
{
const struct device *dev = DEVICE_DT_GET(CANBUS_NODE);
if (!device_is_ready(dev)) {
printk("CAN device not ready\n");
return 0;
return;
}
int err = can_set_bitrate(dev, 125000);
if (err != 0) {
printk("Error setting CAN bitrate (err %d)\n", err);
return 0;
return;
}
err = can_start(dev);
if (err != 0) {
printk("Error starting CAN controller (err %d)\n", err);
return 0;
return;
}
struct can_frame frame = {
@@ -41,7 +43,7 @@ int main(void)
err = can_send(dev, &frame, K_MSEC(100), NULL, NULL);
if (err != 0) {
printk("Sending failed (err %d)\n", err);
return 0;
return;
}
}
}
}
+3
View File
@@ -2,11 +2,14 @@
void motor_application_main(void);
void can_send_test_main(void);
void can_frame_test_main(void);
int main(void)
{
#if CAN_SEND_TEST
can_send_test_main();
#elif CAN_FRAME_TEST
can_frame_test_main();
#else
motor_application_main();
#endif