aboutsummaryrefslogtreecommitdiffstats
path: root/lib/can2040/can2040.h
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2023-10-03 23:24:18 -0400
committerKevin O'Connor <kevin@koconnor.net>2023-10-03 23:24:18 -0400
commitaa726cb7cbf6c58607885efe8f0cb07d009d5546 (patch)
tree1482c3806b18697b6bace4d31dd56b1baedacc4c /lib/can2040/can2040.h
parent7bd32994d4ee7eff613413d7a813bb3b17b8f6d3 (diff)
downloadkutter-aa726cb7cbf6c58607885efe8f0cb07d009d5546.tar.gz
kutter-aa726cb7cbf6c58607885efe8f0cb07d009d5546.tar.xz
kutter-aa726cb7cbf6c58607885efe8f0cb07d009d5546.zip
lib: Update to latest can2040 code
Add support for can2040_stop() Add data_state_go_error() helper Add new can2040_get_statistics() API function Call report_note_discarding() after setting MS_DISCARD state Convert report_is_rx_eof_pending() to report_is_not_in_tx() Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'lib/can2040/can2040.h')
-rw-r--r--lib/can2040/can2040.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/can2040/can2040.h b/lib/can2040/can2040.h
index fc0bdd62..7dbee116 100644
--- a/lib/can2040/can2040.h
+++ b/lib/can2040/can2040.h
@@ -26,11 +26,18 @@ struct can2040;
typedef void (*can2040_rx_cb)(struct can2040 *cd, uint32_t notify
, struct can2040_msg *msg);
+struct can2040_stats {
+ uint32_t rx_total, tx_total;
+ uint32_t tx_attempt;
+ uint32_t parse_error;
+};
+
void can2040_setup(struct can2040 *cd, uint32_t pio_num);
void can2040_callback_config(struct can2040 *cd, can2040_rx_cb rx_cb);
void can2040_start(struct can2040 *cd, uint32_t sys_clock, uint32_t bitrate
, uint32_t gpio_rx, uint32_t gpio_tx);
-void can2040_shutdown(struct can2040 *cd);
+void can2040_stop(struct can2040 *cd);
+void can2040_get_statistics(struct can2040 *cd, struct can2040_stats *stats);
void can2040_pio_irq_handler(struct can2040 *cd);
int can2040_check_transmit(struct can2040 *cd);
int can2040_transmit(struct can2040 *cd, struct can2040_msg *msg);
@@ -56,6 +63,7 @@ struct can2040 {
void *pio_hw;
uint32_t gpio_rx, gpio_tx;
can2040_rx_cb rx_cb;
+ struct can2040_stats stats;
// Bit unstuffing
struct can2040_bitunstuffer unstuf;