2023-08-23 15:16:39 +00:00
|
|
|
|
/**
|
|
|
|
|
* @author R<EFBFBD>mi Heredero
|
|
|
|
|
* @version. 0.0.0
|
|
|
|
|
* @date August 2023
|
|
|
|
|
* @file car.h
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef CAR_H
|
|
|
|
|
#define CAR_H
|
|
|
|
|
|
|
|
|
|
/*************
|
|
|
|
|
* MODULE ID *
|
|
|
|
|
*************/
|
|
|
|
|
#define ID_CONTROL 1 // Control the three-wheeler
|
|
|
|
|
#define ID_JOYSTICK 2 // Inform control avout current joystick state
|
|
|
|
|
#define ID_DISPLAY 3 // User interface to display informations
|
|
|
|
|
#define ID_DRIVE 4 // Drive power motor of the three-wheeler
|
|
|
|
|
#define ID_STEERING 5 // Drive the direction motor og the three-wheeler
|
|
|
|
|
#define ID_SUPPLY 6 // Information about batteries, current, ...
|
|
|
|
|
#define ID_BROADCAST 0 // Message to and from any module
|
|
|
|
|
#define ID_DEBUG 0 // Message to and from any module
|
|
|
|
|
|
2023-08-24 13:26:12 +00:00
|
|
|
|
/*******************
|
|
|
|
|
* MEMORY ADRESSES *
|
|
|
|
|
*******************/
|
2023-08-25 16:23:36 +00:00
|
|
|
|
#define MEMADD_CONTROL_STEERING_MODE 0x01
|
|
|
|
|
#define MEMADD_CONTROL_ALIVE_TIME 0x02
|
|
|
|
|
#define MEMADD_CONTROL_SPEED_FACTOR 0x03
|
|
|
|
|
#define MEMADD_CONTROL_POWER_FACTOR 0x07
|
|
|
|
|
#define MEMADD_CONTROL_STEERING_FACTOR 0x0B
|
|
|
|
|
#define MEMADD_CONTROL_MAX_SPEED_FW 0x0F
|
|
|
|
|
#define MEMADD_CONTROL_MAX_SPEED_BW 0x10
|
|
|
|
|
#define MEMADD_JOYSTICK_MODE 0x11
|
|
|
|
|
#define MEMADD_JOYSTICK_PARAM1 0x12
|
|
|
|
|
#define MEMADD_JOYSTICK_PARAM2 0x13
|
|
|
|
|
#define MEMADD_JOYSTICK_ALIVE_TIME 0x14
|
2023-08-28 10:57:16 +00:00
|
|
|
|
#define MEMADD_DISPLAY_ALIVE_TIME 0x15
|
|
|
|
|
#define MEMADD_DRIVE_SPEED_TIME 0x16
|
|
|
|
|
#define MEMADD_DRIVE_STOP_TIME 0x17
|
|
|
|
|
#define MEMADD_DRIVE_ALIVE_TIME 0x18
|
|
|
|
|
#define MEMADD_STEERING_ALIVE_TIME 0x19
|
|
|
|
|
#define MEMADD_BATTERY_VOLT_TIME 0x1A
|
|
|
|
|
#define MEMADD_BATTERY_CURRENT_TIME 0x1B
|
|
|
|
|
#define MEMADD_BATTERY_ENERGY_TIME 0x1C
|
|
|
|
|
#define MEMADD_BATTERY_ALIVE_TIME 0x1D
|
2023-08-24 13:26:12 +00:00
|
|
|
|
|
2023-08-23 15:16:39 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
uint8_t CONTROL_STEERING_MODE;
|
|
|
|
|
uint8_t CONTROL_ALIVE_TIME;
|
|
|
|
|
uint32_t CONTROL_SPEED_FACTOR;
|
|
|
|
|
uint32_t CONTROL_POWER_FACTOR;
|
|
|
|
|
uint32_t CONTROL_STEERING_FACTOR;
|
|
|
|
|
uint8_t CONTROL_MAX_SPEED_FW;
|
|
|
|
|
uint8_t CONTROL_MAX_SPEED_BW;
|
2023-08-25 16:23:36 +00:00
|
|
|
|
uint8_t JOYSTICK_MODE;
|
|
|
|
|
uint8_t JOYSTICK_PARAM1;
|
|
|
|
|
uint8_t JOYSTICK_PARAM2;
|
2023-08-23 15:16:39 +00:00
|
|
|
|
uint8_t JOYSTICK_ALIVE_TIME;
|
|
|
|
|
uint8_t DISPLAY_ALIVE_TIME;
|
|
|
|
|
uint8_t DRIVE_SPEED_TIME;
|
|
|
|
|
uint8_t DRIVE_STOP_TIME;
|
|
|
|
|
uint8_t DRIVE_ALIVE_TIME;
|
|
|
|
|
uint8_t STEERING_ALIVE_TIME;
|
2023-08-28 10:57:16 +00:00
|
|
|
|
uint8_t BATTERY_VOLT_TIME;
|
|
|
|
|
uint8_t BATTERY_CURRENT_TIME;
|
|
|
|
|
uint8_t BATTERY_ENERGY_TIME;
|
2023-08-23 15:16:39 +00:00
|
|
|
|
uint8_t BATTERY_ALIVE_TIME;
|
2023-08-30 13:37:53 +00:00
|
|
|
|
} KART_CST_TYPE;
|
|
|
|
|
KART_CST_TYPE KART_CST;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2023-08-31 11:42:31 +00:00
|
|
|
|
int16_t torque; //
|
|
|
|
|
uint32_t center; //
|
|
|
|
|
uint32_t position; //
|
|
|
|
|
uint8_t speed; // 100m/h
|
2023-08-30 13:37:53 +00:00
|
|
|
|
} KART_VAR_TYPE;
|
|
|
|
|
KART_VAR_TYPE eKart;
|
2023-08-23 15:16:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* CAR_H */
|
|
|
|
|
|