100 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			100 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /**
 | |
|  * @author Rémi Heredero
 | |
|  * @version 1.0.0
 | |
|  * @date August 2023
 | |
|  * @file can_message.h
 | |
|  */
 | |
| 
 | |
| #ifndef CAN_MESSAGE_H
 | |
| #define CAN_MESSAGE_H
 | |
| 
 | |
| #include <stdint.h>         // usage of standard types
 | |
| #include <stdbool.h>        // usage of boolean types
 | |
| #include "../mcc_generated_files/mcc.h"
 | |
| 
 | |
| 
 | |
| /**
 | |
|  * Process an incoming message
 | |
|  * @param idSender id of the sender
 | |
|  * @param idMsg is of the message
 | |
|  * @param data data of the message
 | |
|  */
 | |
| void CM_processIncome(uint8_t idSender, uint8_t idMsg, bool rtr, uint32_t data);
 | |
| 
 | |
| /**
 | |
|  * Send alive message from controller
 | |
|  * @param p have to be NULL
 | |
|  */
 | |
| void CM_CONTROLLER_ALIVE(void* p);
 | |
| 
 | |
| /**
 | |
|  * Send setup to the joystick (settings from memory)
 | |
|  * @param p have to be NULL
 | |
|  */
 | |
| void CM_JOY_SETUP(void* p);
 | |
| 
 | |
| /**
 | |
|  * Send setup to the display (settings from memory)
 | |
|  * @param p have to be NULL
 | |
|  */
 | |
| void CM_DISPLAY_SETUP(void* p);
 | |
| 
 | |
| /**
 | |
|  * Send speed to display
 | |
|  * @param p the speed in 100m/h (max 255 m/h)
 | |
|  */
 | |
| void CM_DISPLAY_SPEED(void* p);
 | |
| 
 | |
| /**
 | |
|  * 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)
 | |
|  */
 | |
| void CM_DISPLAY_DIRECTION(void* p);
 | |
| 
 | |
| /**
 | |
|  * Send setup to the drive
 | |
|  * use with reset in parameter
 | |
|  * other settings from memory
 | |
|  * @param p 1 if reset/init 0 else
 | |
|  */
 | |
| void CM_DRIVE_SETUP(void* p);
 | |
| 
 | |
| /**
 | |
|  * Send power to the drive
 | |
|  * @param p the torque (int16_t*)
 | |
|  */
 | |
| void CM_DRIVE_POWER(void* p);
 | |
| 
 | |
| /**
 | |
|  * 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
 | |
|  */
 | |
| void CM_STEERING_SETUP(void* p);
 | |
| 
 | |
| /**
 | |
|  * Send position for steering
 | |
|  * no negative value because 0 is home (sensor)
 | |
|  * @param p the position (uint32_t*)
 | |
|  */
 | |
| void CM_STEERING_SET(void* p);
 | |
| 
 | |
| /**
 | |
|  * Send setup to the supply (settings from memory)
 | |
|  * @param p have to be NULL
 | |
|  */
 | |
| void CM_SUPPLY_SETUP(void* p);
 | |
| 
 | |
| /**
 | |
|  * Send headlights on or off
 | |
|  * @param p true if on, false if off;
 | |
|  */
 | |
| void CM_HEADLIGHTS(void* p);
 | |
| 
 | |
| 
 | |
| #endif	/* CAN_MESSAGE_H */
 | |
| 
 |