aboutsummaryrefslogtreecommitdiffstats
path: root/lib/can2040/can2040.h
diff options
context:
space:
mode:
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;