2023-08-25 12:13:51 +00:00
|
|
|
|
/**
|
|
|
|
|
* @author R<EFBFBD>mi Heredero
|
|
|
|
|
* @version 1.0.0
|
|
|
|
|
* @date August 2023
|
|
|
|
|
* @file can_message.h
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef CAN_MESSAGE_H
|
|
|
|
|
#define CAN_MESSAGE_H
|
|
|
|
|
|
2023-08-27 19:35:19 +00:00
|
|
|
|
#include <stdint.h> // usage of standard types
|
|
|
|
|
#include <stdbool.h> // usage of boolean types
|
|
|
|
|
#include "../mcc_generated_files/mcc.h"
|
2023-08-25 12:13:51 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
S R M
|
|
|
|
|
1 0 F CONTROL_ALIVE - - - -
|
|
|
|
|
1 2 0 JOY_SETUP Mode Param1 Param2 aliveTime
|
|
|
|
|
1 3 0 DISPLAY_SETUP reset - - aliveTime
|
|
|
|
|
1 3 2 DISPLAY_SPEED valH valL - -
|
|
|
|
|
1 3 3 DISPLAY_DIRECTION direction - - -
|
|
|
|
|
1 4 0 DRIVE_SETUP Reset/init speedTime stopTime aliveTime
|
|
|
|
|
1 4 1 DRIVE_POWER valH valL - -
|
|
|
|
|
1 5 0 STEERING_SETUP Reset/init homing setCenter aliveTime
|
|
|
|
|
1 5 1 STEERING_SET valHH valH valL valLL
|
|
|
|
|
1 6 0 SETUP_CONTROL batteryVoltTime batteryCurrentTime batteryEnergyTime aliveTime
|
|
|
|
|
*/
|
|
|
|
|
|
2023-08-30 13:37:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* Process an incoming message
|
|
|
|
|
* @param idSender id of the sender
|
|
|
|
|
* @param idMsg is of the message
|
|
|
|
|
* @param data data of the message
|
|
|
|
|
*/
|
2023-08-25 16:23:36 +00:00
|
|
|
|
void CM_processIncome(uint8_t idSender, uint8_t idMsg, uint32_t data);
|
2023-08-30 13:37:53 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Send alive message from controller
|
|
|
|
|
* @param p have to be NULL
|
|
|
|
|
*/
|
2023-08-25 16:23:36 +00:00
|
|
|
|
void CM_CONTROLLER_ALIVE(void* p);
|
2023-08-30 13:37:53 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Send setup to the joystick (settings from memory)
|
|
|
|
|
* @param p have to be NULL
|
|
|
|
|
*/
|
2023-08-25 16:23:36 +00:00
|
|
|
|
void CM_JOY_SETUP(void* p);
|
2023-08-30 13:37:53 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Send setup to the display (settings from memory)
|
|
|
|
|
* @param p have to be NULL
|
|
|
|
|
*/
|
2023-08-25 16:23:36 +00:00
|
|
|
|
void CM_DISPLAY_SETUP(void* p);
|
2023-08-30 13:37:53 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Send speed to display
|
|
|
|
|
* @param p the speed in 100m/h (max 255 m/h)
|
|
|
|
|
*/
|
2023-08-25 16:23:36 +00:00
|
|
|
|
void CM_DISPLAY_SPEED(void* p);
|
2023-08-30 13:37:53 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Send direction of the steering wheel
|
|
|
|
|
* 0 is straight forward
|
|
|
|
|
* positive value is going right
|
|
|
|
|
* negative value is going left
|
|
|
|
|
* @param p the direction (int 8)
|
|
|
|
|
*/
|
2023-08-25 16:23:36 +00:00
|
|
|
|
void CM_DISPLAY_DIRECTION(void* p);
|
2023-08-30 13:37:53 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Send setup to the drive
|
|
|
|
|
* use with reset in parameter
|
|
|
|
|
* other settings from memory
|
|
|
|
|
* @param p 1 if reset/init 0 else
|
|
|
|
|
*/
|
2023-08-25 16:23:36 +00:00
|
|
|
|
void CM_DRIVE_SETUP(void* p);
|
2023-08-30 13:37:53 +00:00
|
|
|
|
|
2023-08-25 16:23:36 +00:00
|
|
|
|
void CM_DRIVE_POWER(void* p);
|
2023-08-30 13:37:53 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Send setup to the steering
|
|
|
|
|
* can be use for reset (1), homing (2) and setCenter (3)
|
|
|
|
|
* @param p 0 for setup, 1 for reset, 2 for homing, 3 for setCenter
|
|
|
|
|
*/
|
2023-08-25 16:23:36 +00:00
|
|
|
|
void CM_STEERING_SETUP(void* p);
|
2023-08-30 13:37:53 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Send position for steering
|
|
|
|
|
* no negative value because 0 is home (sensor)
|
|
|
|
|
* @param p the position (uint32_t*)
|
|
|
|
|
*/
|
2023-08-25 16:23:36 +00:00
|
|
|
|
void CM_STEERING_SET(void* p);
|
2023-08-30 13:37:53 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Send setup to the supply (settings from memory)
|
|
|
|
|
* @param p have to be NULL
|
|
|
|
|
*/
|
|
|
|
|
void CM_SUPPLY_SETUP(void* p);
|
2023-08-25 16:23:36 +00:00
|
|
|
|
|
2023-08-25 12:13:51 +00:00
|
|
|
|
|
|
|
|
|
#endif /* CAN_MESSAGE_H */
|
|
|
|
|
|