PDU_Code/Core/Inc/Channel_Control.h

62 lines
1.3 KiB
C

/*
* Channel_Control.h
*
* Created on: 24. April, 2024
* Author: nived
*/
#ifndef INC_CHANNEL_CONTROL_H_
#define INC_CHANNEL_CONTROL_H_
#include "stm32f3xx_hal.h"
typedef union {
struct {
uint8_t NC : 1;
uint8_t en13 : 1; // inverters
uint8_t en2 : 1; //servos regler
uint8_t en1 : 1; //acu
uint8_t en4 : 1; // reserved
uint8_t en11 : 1; //lidar
uint8_t en8 : 1; // sdc
uint8_t alwayson : 1; // en7 ist always on
};
uint8_t porta;
} gpio_port_a;
typedef union {
struct {
uint8_t en15: 1; // epsc
uint8_t en12 : 1; // hyd aggregat
uint8_t NC : 1;
uint8_t en3 : 1; // ebs cs valve
uint8_t en6 : 1; // ebs valve b
uint8_t en5 : 1; //ebs valve a
uint8_t en14 : 1; //servos
uint8_t en16 : 1; //misc
};
uint8_t portb;
} gpio_port_b;
typedef union {
struct {
gpio_port_a porta;
gpio_port_b portb;
};
uint16_t gpios_bitmask;
} PortExtenderGPIO;
void ChannelControl_init(I2C_HandleTypeDef* hi2c, TIM_HandleTypeDef* timer3,
TIM_HandleTypeDef* timer2);
void ChannelControl_UpdateGPIOs(PortExtenderGPIO);
void ChannelControl_UpdatePWMs(
uint8_t radiatorfans,
uint8_t pwmpumps,
uint8_t tsacfans,
uint8_t pwmaggregat
);
#endif /* INC_CHANNEL_CONTROL_H_ */