/* * peripherial.h * * Created on: Sep 10, 2024 * Author: jakubski */ #ifndef INC_PERIPHERIAL_H_ #define INC_PERIPHERIAL_H_ #include "main.h" #include "cmsis_os.h" #define DBG_LED1 GPIO_PIN_4 #define DBG_LED2 GPIO_PIN_5 #define DBG_LED3 GPIO_PIN_6 #define DBG_LED4 GPIO_PIN_7 #define CURRENT_SENSOR_L1_GPIO_OFFSET 7 #define CURRENT_SENSOR_L2_GPIO_OFFSET 9 #define CURRENT_SENSOR_L3_GPIO_OFFSET 13 #define MCU_CS_PWR_EN GPIO_PIN_15 enum _CurrentSensor { CurrentSensorL1, CurrentSensorL2, CurrentSensorL3 }; typedef enum _CurrentSensor CurrentSensor; enum _CurrentSensorGain { csGain1, csGain2, csGain3, csGain0 }; typedef enum _CurrentSensorGain CurrentSensorGain; enum _MotorDriverState { HiZ, Forward, Reverse, Brake }; typedef enum _MotorDriverState MotorDriverState; void DbgLEDOn(uint8_t ledNumber); void DbgLEDOff(uint8_t ledNumber); void DbgLEDToggle(uint8_t ledNumber); void EnableCurrentSensors(void); void DisableCurrentSensors(void); void SelectCurrentSensorGain(CurrentSensor sensor, CurrentSensorGain gain); void MotorAction(TIM_HandleTypeDef *tim, TIM_OC_InitTypeDef *timerConf, uint32_t channel1, uint32_t channel2, MotorDriverState setState, uint32_t pulse); uint8_t MotorControl (TIM_HandleTypeDef* htim, TIM_OC_InitTypeDef* motorTimerConfigOC, uint8_t channel1, uint8_t channel2, osTimerId_t motorTimerHandle, int32_t motorPWMPulse, int32_t motorTimerPeriod, uint8_t switchLimiterUpStat, uint8_t switchLimiterDownStat) ; #endif /* INC_PERIPHERIAL_H_ */