Enable tsacfans PWM channel

This commit is contained in:
Autobox 2024-06-11 16:41:00 +02:00
parent 687883c11e
commit 60ddc046d0
3 changed files with 18 additions and 11 deletions

View File

@ -50,7 +50,12 @@ typedef union {
void ChannelControl_init(I2C_HandleTypeDef* hi2c, TIM_HandleTypeDef* timer3,
TIM_HandleTypeDef* timer2);
void ChannelControl_UpdateGPIOs(PortExtenderGPIO);
void ChannelControl_UpdatePWMs(uint8_t radiatorfans, uint8_t pwmaggregat,
uint8_t pwmpumps);
void ChannelControl_UpdatePWMs(
uint8_t radiatorfans,
uint8_t pwmpumps,
uint8_t tsacfans,
uint8_t pwmaggregat
);
#endif /* INC_CHANNEL_CONTROL_H_ */

View File

@ -30,7 +30,7 @@ void ChannelControl_init(I2C_HandleTypeDef* hi2c, TIM_HandleTypeDef* timer3,
EN_Ports.portb.portb = 0;
EN_Ports.porta.alwayson = 1;
ChannelControl_UpdateGPIOs(EN_Ports);
ChannelControl_UpdatePWMs(0, 0, 0);
ChannelControl_UpdatePWMs(0, 0, 0, 0);
}
void ChannelControl_UpdateGPIOs(PortExtenderGPIO UpdatePorts) { // ctrl + left click auf portextender
@ -42,13 +42,14 @@ void ChannelControl_UpdateGPIOs(PortExtenderGPIO UpdatePorts) { // ctrl + left c
void ChannelControl_UpdatePWMs(
uint8_t radiatorfans,
uint8_t pwmaggregat,
uint8_t pwmpumps
uint8_t pwmpumps,
uint8_t tsacfans,
uint8_t pwmaggregat // TODO: Emulate PWN via PCA9535D!
){
pwmtimer3->Instance->CCR4 = pwmpumps << 8;
pwmtimer3->Instance->CCR1 = radiatorfans << 8;
//pwmtimer2->Instance->CCR2 = tsacfans << 8;
pwmtimer3->Instance->CCR4 = pwmpumps << 8;
pwmtimer2->Instance->CCR2 = tsacfans << 8;
if (timer3_running) {
if ((pwmpumps == 0) && (radiatorfans == 0)) {
@ -64,7 +65,7 @@ void ChannelControl_UpdatePWMs(
}
}
/*if (timer2_running) {
if (timer2_running) {
if (tsacfans == 0) {
timer2_running = 0;
HAL_TIM_PWM_Stop(pwmtimer2, TIM_CHANNEL_2);
@ -74,7 +75,7 @@ void ChannelControl_UpdatePWMs(
timer2_running = 1;
HAL_TIM_PWM_Start(pwmtimer2, TIM_CHANNEL_2);
}
}*/
}
}

View File

@ -152,8 +152,9 @@ while(1)
ChannelControl_UpdateGPIOs(rxstate.iostatus);
ChannelControl_UpdatePWMs(
rxstate.radiatorfans,
rxstate.pwmaggregat,
rxstate.cooling_pump
rxstate.cooling_pump,
rxstate.tsacfans,
rxstate.pwmaggregat
);
}