/* * stm_gen.h * * Created on: Oct 3, 2023 * Author: Katya */ #ifndef INC_STM_GEN_H_ #define INC_STM_GEN_H_ typedef struct { // SPI input uint8_t time_mode; uint16_t pwm_value; uint8_t f; uint8_t invert; // L12 (1/0) // inner uint8_t coef; // prescaler uint16_t freq_pwm_new; // period uint16_t pwm_value_res; // пересчитанное значение PWM (относительно freq_pwm_new) } Mode; #define CHANNELS 2 #define F_CPU_TIM1 1000 #define F_CPU 24000000 #define MAX_PWM_FREQ 65535 extern Mode modes[CHANNELS]; void PWMInit(uint8_t prescaler, uint16_t period, uint16_t pwm_value); void ChannelSwap(Mode *mode_ptr, int channel_new, int *channel_var, int settings_flag, int *settings_var); void SetInvert(Mode *mode_ptr); void FillMode(Mode *mode_ptr, uint8_t *recData, int start); void CommonChannelActions(Mode *mode_ptr, int channel, int *channelPtr, int *iter, int *settings_set); #endif /* INC_STM_GEN_H_ */