Prepared handling of CAN-frames in lisp

This commit is contained in:
Benjamin Vedder 2022-01-31 09:12:27 +01:00
parent 5fbb0a328c
commit 66f6c2e2f0
3 changed files with 22 additions and 1 deletions

14
comm_can.c Normal file → Executable file
View File

@ -38,6 +38,9 @@
#include "mempools.h"
#include "shutdown.h"
#include "bms.h"
#ifdef USE_LISPBM
#include "lispif.h"
#endif
// Settings
#define RX_FRAMES_SIZE 100
@ -1212,6 +1215,9 @@ static THD_FUNCTION(cancom_process_thread, arg) {
if (!eid_cb_used) {
if (!bms_process_can_frame(rxmsg.EID, rxmsg.data8, rxmsg.DLC, true)) {
decode_msg(rxmsg.EID, rxmsg.data8, rxmsg.DLC, false);
#ifdef USE_LISPBM
lispif_process_can(rxmsg.EID, rxmsg.data8, rxmsg.DLC, true);
#endif
}
}
} else {
@ -1221,8 +1227,14 @@ static THD_FUNCTION(cancom_process_thread, arg) {
}
if (!sid_cb_used) {
bms_process_can_frame(rxmsg.SID, rxmsg.data8, rxmsg.DLC, false);
sid_cb_used = bms_process_can_frame(rxmsg.SID, rxmsg.data8, rxmsg.DLC, false);
}
#ifdef USE_LISPBM
if (!sid_cb_used) {
lispif_process_can(rxmsg.EID, rxmsg.data8, rxmsg.DLC, true);
}
#endif
}
}
}

View File

@ -171,6 +171,11 @@ void lispif_process_cmd(unsigned char *data, unsigned int len,
}
}
void lispif_process_can(uint32_t can_id, uint8_t *data8, int len, bool is_ext) {
(void)can_id; (void)data8; (void)len; (void)is_ext;
}
static bool start_lisp(bool print) {
bool res = false;

View File

@ -21,10 +21,14 @@
#ifndef LISPBM_LISPIF_H_
#define LISPBM_LISPIF_H_
#include <stdint.h>
#include <stdbool.h>
// Functions
void lispif_init(void);
void lispif_load_vesc_extensions(void);
void lispif_process_cmd(unsigned char *data, unsigned int len,
void(*reply_func)(unsigned char *data, unsigned int len));
void lispif_process_can(uint32_t can_id, uint8_t *data8, int len, bool is_ext);
#endif /* LISPBM_LISPIF_H_ */