aboutsummaryrefslogtreecommitdiffstats
path: root/src/generic/canbus.c
Commit message (Collapse)AuthorAgeFilesLines
* canbus: Rename canserial_send() to canbus_send()Kevin O'Connor2022-12-141-3/+3
| | | | | | | | Rename canserial_send() to canbus_send() and canserial_set_filter() to canbus_set_filter(). This makes it more clear where the code should reside. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canbus: Rename canbus_send() to canhw_send()Kevin O'Connor2022-12-141-3/+3
| | | | | | | | Rename canbus_send() to canhw_send() and rename canbus_set_filter() to canhw_set_filter(). This makes it more clear where the code should reside. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Improve canbus timingKevin O'Connor2022-07-291-0/+4
| | | | | | | Adjust timing based on the minimum transmission time of canbus messages. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canserial: Rename canbus.c to canserial.cKevin O'Connor2022-06-271-322/+12
| | | | | | | | | | Rename the canbus.c code to canserial.c and introduce new wrapper functions in canbus.c that connect the low-level canbus hardware code to the high-level canserial.c code. This is in preparation for adding "usb to canbus bridge mode". Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canbus: Move canbus uuid calculation to canbus.cKevin O'Connor2022-06-161-2/+6
| | | | | | | | Move the uuid hash calculation to canbus.c and call canbus_set_uuid() from src/stm32/chipid.c . This simplifies the low-level canbus hardware code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canbus: Use single method for reading canbus messagesKevin O'Connor2022-06-161-38/+64
| | | | | | | | | | | | Previously the code had canbus_read() which was called from task context (for admin messages), and canbus_process_data() which was called from irq context (used for data messages). Change that to a single canbus_process_data() function that is called from irq context (used for all messages). This simplifies the low-level hardware specific canbus code and should make it easier to support other hardware implementations. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canbus: Move global variables into a structKevin O'Connor2022-06-161-55/+65
| | | | | | | | Create a single CanData global variable to track the canbus state. ARM micro-controllers generally produce better code when global variables are in a struct. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* armcm_reset: Add a armcm_reset.h header file for try_request_canboot()Kevin O'Connor2022-06-041-4/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canbus: use "try_request_canboot" methodEric Callahan2022-06-031-15/+1
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* misc: Import misc.h in all files defining console_sendf()Kevin O'Connor2022-05-131-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canbus: Rename CANBUS_CMD_SET_NODEID to CANBUS_CMD_SET_KLIPPER_NODEIDKevin O'Connor2022-05-101-5/+5
| | | | | | | Rename the command name for consistency with the canbus_query.py script. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canbus: send 8 bytes in the id responseEric Callahan2022-05-101-1/+2
| | | | | | | The last byte contains the "node id" command, which is used to identify the application. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* canbus: add bootloader supportEric Callahan2022-05-101-0/+27
| | | | | | | | | This adds a command which allows an external script to broadcast a bootloader request, using a supplied UUID to match the request. Included is a method to process requests to enter the canboot bootloader. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* canbus: Support reading CAN packets directly from IRQ handlerKevin O'Connor2021-03-181-14/+42
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canbus: Rework CAN command protocolKevin O'Connor2021-03-131-51/+82
| | | | | | | Rework the micro-controller command protocol so that it supports direct communication with the serialqueue.c code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canbus: Call can_notify_rx() at startup so low-level code does not need toKevin O'Connor2021-02-091-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canbus: Rename canbus_set_dataport() to canbus_set_filter() and simplifyKevin O'Connor2021-02-091-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canbus: Move high-level CAN code to new src/generic/canbus.cKevin O'Connor2021-02-021-0/+227
Separate out the high-level command processing logic from the low-level transmission code. Place the high-level code in src/generic/canbus.c . This also removes the CAN dependency on serial_irq.c . Signed-off-by: Kevin O'Connor <kevin@koconnor.net>