Mangue Baja team's code to frontal ECU

Committer:
einsteingustavo
Date:
Wed Jul 24 20:03:52 2019 +0000
Revision:
0:12fb9cbcabcc
Mangue Baja team's code to frontal ECU

Who changed what in which revision?

UserRevisionLine numberNew contents of line
einsteingustavo 0:12fb9cbcabcc 1 #ifndef DEFINITIONS_H
einsteingustavo 0:12fb9cbcabcc 2 #define DEFINITIONS_H
einsteingustavo 0:12fb9cbcabcc 3
einsteingustavo 0:12fb9cbcabcc 4 #ifndef MBED_H
einsteingustavo 0:12fb9cbcabcc 5 #include "mbed.h"
einsteingustavo 0:12fb9cbcabcc 6 #define MBED_H
einsteingustavo 0:12fb9cbcabcc 7 #endif
einsteingustavo 0:12fb9cbcabcc 8
einsteingustavo 0:12fb9cbcabcc 9 #define CAN_IER (*((volatile unsigned long *)0x40006414))
einsteingustavo 0:12fb9cbcabcc 10
einsteingustavo 0:12fb9cbcabcc 11 #define BUFFER_SIZE 50
einsteingustavo 0:12fb9cbcabcc 12 #define THROTTLE_MID 0x00
einsteingustavo 0:12fb9cbcabcc 13 #define THROTTLE_RUN 0x01
einsteingustavo 0:12fb9cbcabcc 14 #define THROTTLE_CHOKE 0x02
einsteingustavo 0:12fb9cbcabcc 15
einsteingustavo 0:12fb9cbcabcc 16 #define SYNC_ID 0x001 // message for bus sync
einsteingustavo 0:12fb9cbcabcc 17 #define THROTTLE_ID 0x100 // 1by = throttle state (0x00, 0x01 or 0x02)
einsteingustavo 0:12fb9cbcabcc 18 #define FLAGS_ID 0x101 // 1by
einsteingustavo 0:12fb9cbcabcc 19 #define IMU_ACC_ID 0x200 // 8by = accelerometer data (3D) + timestamp
einsteingustavo 0:12fb9cbcabcc 20 #define IMU_DPS_ID 0x201 // 8by = gyroscope data (3D) + timestamp
einsteingustavo 0:12fb9cbcabcc 21 #define SPEED_ID 0x300 // 4by = speed + timestamp
einsteingustavo 0:12fb9cbcabcc 22 #define RPM_ID 0x304 // 4by = rpm + timestamp
einsteingustavo 0:12fb9cbcabcc 23 #define TEMPERATURE_ID 0x400 // 4by = engine temp. + cvt temp. + timestamp
einsteingustavo 0:12fb9cbcabcc 24 #define FUEL_ID 0x500 // 3by = fuel level + timestamp
einsteingustavo 0:12fb9cbcabcc 25
einsteingustavo 0:12fb9cbcabcc 26
einsteingustavo 0:12fb9cbcabcc 27 typedef struct
einsteingustavo 0:12fb9cbcabcc 28 {
einsteingustavo 0:12fb9cbcabcc 29 int16_t acc_x;
einsteingustavo 0:12fb9cbcabcc 30 int16_t acc_y;
einsteingustavo 0:12fb9cbcabcc 31 int16_t acc_z;
einsteingustavo 0:12fb9cbcabcc 32 int16_t dps_x;
einsteingustavo 0:12fb9cbcabcc 33 int16_t dps_y;
einsteingustavo 0:12fb9cbcabcc 34 int16_t dps_z;
einsteingustavo 0:12fb9cbcabcc 35 } imu_t;
einsteingustavo 0:12fb9cbcabcc 36
einsteingustavo 0:12fb9cbcabcc 37 typedef struct
einsteingustavo 0:12fb9cbcabcc 38 {
einsteingustavo 0:12fb9cbcabcc 39 imu_t imu[4];
einsteingustavo 0:12fb9cbcabcc 40 uint16_t rpm;
einsteingustavo 0:12fb9cbcabcc 41 uint16_t speed;
einsteingustavo 0:12fb9cbcabcc 42 uint8_t temperature;
einsteingustavo 0:12fb9cbcabcc 43 uint8_t flags; // MSB - BOX | BUFFER FULL | NC | NC | FUEL_LEVEL | SERVO_ERROR | CHK | RUN - LSB
einsteingustavo 0:12fb9cbcabcc 44 uint32_t timestamp;
einsteingustavo 0:12fb9cbcabcc 45 } packet_t;
einsteingustavo 0:12fb9cbcabcc 46
einsteingustavo 0:12fb9cbcabcc 47 #endif
einsteingustavo 0:12fb9cbcabcc 48