Complete new CAN mappings
This commit is contained in:
parent
298fd8709c
commit
8f6b924865
@ -1,8 +1,9 @@
|
||||
#ifndef MAPPINGS_H
|
||||
#define MAPPINGS_H
|
||||
|
||||
// CHOOSE ONE, comment the other
|
||||
#define SN_FRONT
|
||||
//#define SN_REAR
|
||||
#define SN_REAR
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -64,9 +65,9 @@ typedef enum {
|
||||
|
||||
typedef enum {
|
||||
NONE = 0, // Not used
|
||||
AIN = 1, // Analog in
|
||||
DIN = 2, // Digital in
|
||||
FIN = 3, // Frequency in
|
||||
AIN = 1, // Analog in
|
||||
DIN = 2, // Digital in
|
||||
FIN = 3, // Frequency in
|
||||
DOUT = 4, // Digital out
|
||||
POUT = 5, // PWM out
|
||||
} signal_type_t;
|
||||
@ -74,56 +75,106 @@ typedef enum {
|
||||
typedef struct {
|
||||
signal_type_t type;
|
||||
|
||||
// CAN INFO
|
||||
uint8_t start; // start byte
|
||||
uint8_t length; // in bytes
|
||||
|
||||
// PERIPHERY INFO
|
||||
uint8_t channel; // ADC or PWM or Freq channel
|
||||
uint8_t dio_map[8]; // Up to 8 bits mappable to DIOs
|
||||
|
||||
// CAN INFO
|
||||
uint8_t start; // start bit
|
||||
uint8_t length; // in bits
|
||||
|
||||
// METADATA
|
||||
//float scale_factor; // (phys_max/can_scale)/adc_quants
|
||||
float factor; // (phys_range/can_scale)/adc_quants
|
||||
char name[16];
|
||||
} can_signal_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t can_id;
|
||||
uint8_t dlc;
|
||||
uint8_t num_signals;
|
||||
can_signal_t signals[8];
|
||||
int8_t num_signals; // -1 => packet disabled
|
||||
uint16_t period; // ms
|
||||
can_signal_t signals[9];
|
||||
} can_pkt_t;
|
||||
|
||||
#define ADQ (1<<12)
|
||||
|
||||
#ifdef SN_FRONT
|
||||
|
||||
static can_pkt_t CAN_SIGNAL_MAP[4] {
|
||||
{
|
||||
.can_id = 0x0D1, .dlc = 5, .num_signals = 2, .signals = {
|
||||
{ .type = AIN, .start = 0, .length = 2, .channel = RB, .name = "BPS F" },
|
||||
{ .type = AIN, .start = 2, .length = 2, .channel = L1, .name = "SAS" },
|
||||
{ .type = DIN, .start = 4, .length = 1, .dio_map = {L9, LC, R5, R6, R7}, .name = "SAS" }
|
||||
.can_id = 0x0D1, .dlc = 3, .num_signals = 7, .period = 100, .signals = {
|
||||
{ .type = DIN, .channel = L9, .start = 0, .length = 1, .factor = 1., .name = "LS L" },
|
||||
{ .type = DIN, .channel = LC, .start = 1, .length = 1, .factor = 1., .name = "LS R" },
|
||||
{ .type = DIN, .channel = R5, .start = 2, .length = 1, .factor = 1., .name = "SDC M pre BOTS" },
|
||||
{ .type = DIN, .channel = R6, .start = 3, .length = 1, .factor = 1., .name = "SDC M post INS" },
|
||||
{ .type = DIN, .channel = R7, .start = 4, .length = 1, .factor = 1., .name = "SDC M post BSPD" },
|
||||
|
||||
{ .type = AIN, .channel = RD, .start = 8, .length = 8, .factor = ((512./2)/ADQ), .name = "BDTS FL" },
|
||||
{ .type = AIN, .channel = RF, .start = 16, .length = 8, .factor = ((512./2)/ADQ), .name = "BDTS FR" },
|
||||
}
|
||||
},
|
||||
{
|
||||
.can_id = 0x0D2, .dlc = 4, .num_signals = 2, .signals = {
|
||||
{ .type = AIN, .start = 0, .length = 2, .channel = R9, .name = "APPS 1" },
|
||||
{ .type = AIN, .start = 2, .length = 2, .channel = L2, .name = "APPS 2" }
|
||||
.can_id = 0x0D3, .dlc = 7, .num_signals = 6, .period = 10, .signals = {
|
||||
{ .type = AIN, .channel = R9, .start = 0, .length = 8, .factor = (256./ADQ), .name = "APPS 1" },
|
||||
{ .type = AIN, .channel = L2, .start = 8, .length = 8, .factor = (256./ADQ), .name = "APPS 2" },
|
||||
{ .type = AIN, .channel = RB, .start = 16, .length = 8, .factor = ((512./2)/ADQ), .name = "BP F" },
|
||||
{ .type = AIN, .channel = L1, .start = 24, .length = 12, .factor = 1., .name = "SAS" },
|
||||
{ .type = FIN, .channel = LB, .start = 40, .length = 8, .factor = 1., .name = "WSS FL" },
|
||||
{ .type = FIN, .channel = R8, .start = 48, .length = 8, .factor = 1., .name = "WSS FR" },
|
||||
}
|
||||
},
|
||||
{
|
||||
.can_id = 0x0D3, .dlc = 8, .num_signals = 4, .signals = {
|
||||
{ .type = AIN, .start = 0, .length = 2, .channel = RA, .name = "DS FL" },
|
||||
{ .type = AIN, .start = 2, .length = 2, .channel = RC, .name = "DS FR" },
|
||||
{ .type = AIN, .start = 4, .length = 2, .channel = RE, .name = "SLS FL" },
|
||||
{ .type = AIN, .start = 6, .length = 2, .channel = R0, .name = "SLS FR" }
|
||||
.can_id = 0x0D5, .dlc = 3, .num_signals = 2, .period = 10, .signals = {
|
||||
{ .type = AIN, .channel = RA, .start = 0, .length = 12, .factor = 1., .name = "DS FL" },
|
||||
{ .type = AIN, .channel = RC, .start = 12, .length = 12, .factor = 1., .name = "DS FR" },
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
.can_id = 0x0D4, .dlc = 8, .num_signals = 4, .signals = {
|
||||
{ .type = AIN, .start = 0, .length = 2, .channel = RD, .name = "BDTS FL" },
|
||||
{ .type = AIN, .start = 2, .length = 2, .channel = RF, .name = "BDTS FR" },
|
||||
{ .type = FIN, .start = 4, .length = 2, .channel = LB, .name = "WSS FL" },
|
||||
{ .type = FIN, .start = 6, .length = 2, .channel = R8, .name = "WSS FR" }
|
||||
.can_id = 0x0D7, .dlc = 3, .num_signals = 2, .period = 1, .signals = {
|
||||
{ .type = AIN, .channel = RE, .start = 0, .length = 12, .factor = 1., .name = "SLS FL" },
|
||||
{ .type = AIN, .channel = R0, .start = 12, .length = 12, .factor = 1., .name = "SLS FR" },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef SN_REAR
|
||||
|
||||
static can_pkt_t CAN_SIGNAL_MAP[4] {
|
||||
{
|
||||
.can_id = 0x0D2, .dlc = 7, .num_signals = 9, .period = 100, .signals = {
|
||||
{ .type = DIN, .channel = R7, .start = 0, .length = 1, .factor = 1., .name = "ExtTSOn" },
|
||||
{ .type = DIN, .channel = L9, .start = 1, .length = 1, .factor = 1., .name = "SDC M pre TSMS" },
|
||||
{ .type = DIN, .channel = LA, .start = 2, .length = 1, .factor = 1., .name = "SDC M post TSMS" },
|
||||
|
||||
{ .type = AIN, .channel = RD, .start = 8, .length = 8, .factor = ((512./2)/ADQ), .name = "BDTS RL" },
|
||||
{ .type = AIN, .channel = RF, .start = 16, .length = 8, .factor = ((512./2)/ADQ), .name = "BDTS RR" },
|
||||
|
||||
{ .type = AIN, .channel = R9, .start = 24, .length = 8, .factor = (256./ADQ), .name = "WT BAT" },
|
||||
{ .type = AIN, .channel = L1, .start = 32, .length = 8, .factor = (256./ADQ), .name = "WT DT" },
|
||||
{ .type = AIN, .channel = L2, .start = 40, .length = 8, .factor = (256./ADQ), .name = "WP BAT" },
|
||||
{ .type = AIN, .channel = L4, .start = 48, .length = 8, .factor = (256./ADQ), .name = "WP DT" },
|
||||
}
|
||||
},
|
||||
{
|
||||
.can_id = 0x0D4, .dlc = 8, .num_signals = 7, .period = 10, .signals = {
|
||||
{ .type = AIN, .channel = L3, .start = 0, .length = 8, .factor = ((25.6/.1)/ADQ), .name = "EBS APS 1" },
|
||||
{ .type = AIN, .channel = L6, .start = 8, .length = 8, .factor = ((25.6/.1)/ADQ), .name = "EBS APS 2" },
|
||||
{ .type = AIN, .channel = RB, .start = 16, .length = 8, .factor = ((512./2)/ADQ), .name = "BP F" },
|
||||
{ .type = FIN, .channel = LB, .start = 24, .length = 8, .factor = 1., .name = "WSS RL" },
|
||||
{ .type = FIN, .channel = R8, .start = 32, .length = 8, .factor = 1., .name = "WSS RR" },
|
||||
{ .type = AIN, .channel = RA, .start = 40, .length = 12, .factor = 1., .name = "DS RL" },
|
||||
{ .type = AIN, .channel = RC, .start = 52, .length = 12, .factor = 1., .name = "DS RR" },
|
||||
}
|
||||
},
|
||||
{
|
||||
.can_id = 0x0D6, .dlc = 0, .num_signals = 0, .period = 10, .signals = {}
|
||||
},
|
||||
{
|
||||
.can_id = 0x0D8, .dlc = 3, .num_signals = 2, .period = 1, .signals = {
|
||||
{ .type = AIN, .channel = RE, .start = 0, .length = 12, .factor = 1., .name = "SLS RL" },
|
||||
{ .type = AIN, .channel = R0, .start = 12, .length = 12, .factor = 1., .name = "SLS RR" },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user