Skip to content

Commit

Permalink
Merge branch 'ThingSet:main' into packetised-can-handle-overflows
Browse files Browse the repository at this point in the history
  • Loading branch information
garethpotter authored Oct 12, 2023
2 parents e4c8e72 + eb7add3 commit 179ad6d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
8 changes: 7 additions & 1 deletion include/thingset/can.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ struct thingset_can
uint8_t rx_buffer[CONFIG_THINGSET_CAN_RX_BUF_SIZE];
int64_t next_pub_time;
uint8_t node_addr;
bool pub_enable;
};

#ifdef CONFIG_THINGSET_CAN_MULTIPLE_INSTANCES
Expand Down Expand Up @@ -255,6 +254,13 @@ int thingset_can_send(uint8_t *tx_buf, size_t tx_len, uint8_t target_addr);
*/
int thingset_can_set_report_rx_callback(thingset_can_report_rx_callback_t rx_cb);

/**
* Get ThingSet CAN instance
*
* @returns Pointer to internal ThingSet CAN instance
*/
struct thingset_can *thingset_can_get_inst();

#endif /* CONFIG_THINGSET_CAN_MULTIPLE_INSTANCES */

#ifdef __cplusplus
Expand Down
13 changes: 12 additions & 1 deletion src/can.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,9 +609,20 @@ int thingset_can_set_report_rx_callback(thingset_can_report_rx_callback_t rx_cb)
return thingset_can_set_report_rx_callback_inst(&ts_can_single, rx_cb);
}

struct thingset_can *thingset_can_get_inst()
{
return &ts_can_single;
}

static void thingset_can_thread()
{
thingset_can_init_inst(&ts_can_single, can_dev);
int err;

err = thingset_can_init_inst(&ts_can_single, can_dev);
if (err != 0) {
LOG_ERR("Failed to init ThingSet CAN: %d", err);
return;
}

while (true) {
thingset_can_process_inst(&ts_can_single, K_FOREVER);
Expand Down

0 comments on commit 179ad6d

Please sign in to comment.