PDU_Code/Core/Inc/Channel_Control.h

57 lines
1.2 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; // name it according to power stage
uint8_t en2 : 1;
uint8_t en1 : 1;
uint8_t en4 : 1;
uint8_t en11 : 1;
uint8_t en8 : 1;
uint8_t alwayson : 1; // en7 ist always on
};
uint8_t porta;
} gpio_port_a;
typedef union {
struct {
uint8_t en15: 1;
uint8_t en12 : 1;
uint8_t NC : 1;
uint8_t en3 : 1;
uint8_t en6 : 1;
uint8_t en5 : 1;
uint8_t en14 : 1;
uint8_t en16 : 1;
};
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 tsacfans , uint8_t pwmaggregat,
uint8_t pwmpumps);
#endif /* INC_CHANNEL_CONTROL_H_ */