diff --git a/src/generic/canbus.c b/src/generic/canbus.c index 0c7fc82d..1be0ead5 100644 --- a/src/generic/canbus.c +++ b/src/generic/canbus.c @@ -6,19 +6,19 @@ #include "autoconf.h" // CONFIG_CANBUS_FREQUENCY #include "canbus.h" // canhw_send -#include "canserial.h" // canserial_send +#include "canserial.h" // canserial_notify_tx #include "command.h" // DECL_CONSTANT DECL_CONSTANT("CANBUS_FREQUENCY", CONFIG_CANBUS_FREQUENCY); int -canserial_send(struct canbus_msg *msg) +canbus_send(struct canbus_msg *msg) { return canhw_send(msg); } void -canserial_set_filter(uint32_t id) +canbus_set_filter(uint32_t id) { canhw_set_filter(id); } diff --git a/src/generic/canbus.h b/src/generic/canbus.h index cd592b74..f21a7cc4 100644 --- a/src/generic/canbus.h +++ b/src/generic/canbus.h @@ -22,6 +22,8 @@ int canhw_send(struct canbus_msg *msg); void canhw_set_filter(uint32_t id); // canbus.c +int canbus_send(struct canbus_msg *msg); +void canbus_set_filter(uint32_t id); void canbus_notify_tx(void); void canbus_process_data(struct canbus_msg *msg); diff --git a/src/generic/canserial.c b/src/generic/canserial.c index 8062cfe3..fa46a6d2 100644 --- a/src/generic/canserial.c +++ b/src/generic/canserial.c @@ -10,7 +10,7 @@ #include "board/io.h" // readb #include "board/irq.h" // irq_save #include "board/misc.h" // console_sendf -#include "canbus.h" // canbus_set_uuid +#include "canbus.h" // canbus_send #include "canserial.h" // canserial_notify_tx #include "command.h" // DECL_CONSTANT #include "fasthash.h" // fasthash64 @@ -68,7 +68,7 @@ canserial_tx_task(void) break; msg.dlc = now; memcpy(msg.data, &CanData.transmit_buf[tpos], now); - int ret = canserial_send(&msg); + int ret = canbus_send(&msg); if (ret <= 0) break; tpos += now; @@ -152,7 +152,7 @@ can_process_query_unassigned(struct canbus_msg *msg) send.data[7] = CANBUS_CMD_SET_KLIPPER_NODEID; // Send with retry for (;;) { - int ret = canserial_send(&send); + int ret = canbus_send(&send); if (ret >= 0) return; } @@ -162,7 +162,7 @@ static void can_id_conflict(void) { CanData.assigned_id = 0; - canserial_set_filter(CanData.assigned_id); + canbus_set_filter(CanData.assigned_id); shutdown("Another CAN node assigned this ID"); } @@ -175,7 +175,7 @@ can_process_set_klipper_nodeid(struct canbus_msg *msg) if (can_check_uuid(msg)) { if (newid != CanData.assigned_id) { CanData.assigned_id = newid; - canserial_set_filter(CanData.assigned_id); + canbus_set_filter(CanData.assigned_id); } } else if (newid == CanData.assigned_id) { can_id_conflict(); diff --git a/src/generic/canserial.h b/src/generic/canserial.h index e2f55521..e8f3767f 100644 --- a/src/generic/canserial.h +++ b/src/generic/canserial.h @@ -6,13 +6,9 @@ #define CANBUS_ID_ADMIN 0x3f0 #define CANBUS_ID_ADMIN_RESP 0x3f1 -// callbacks provided by board specific code -struct canbus_msg; -int canserial_send(struct canbus_msg *msg); -void canserial_set_filter(uint32_t id); - // canserial.c void canserial_notify_tx(void); +struct canbus_msg; int canserial_process_data(struct canbus_msg *msg); void canserial_set_uuid(uint8_t *raw_uuid, uint32_t raw_uuid_len); diff --git a/src/generic/usb_canbus.c b/src/generic/usb_canbus.c index 10f23ab9..3cb4bdd0 100644 --- a/src/generic/usb_canbus.c +++ b/src/generic/usb_canbus.c @@ -254,7 +254,7 @@ usbcan_task(void) DECL_TASK(usbcan_task); int -canserial_send(struct canbus_msg *msg) +canbus_send(struct canbus_msg *msg) { int ret = drain_hw_queue(); if (ret < 0) @@ -270,7 +270,7 @@ retry_later: } void -canserial_set_filter(uint32_t id) +canbus_set_filter(uint32_t id) { UsbCan.assigned_id = id; }