commit 565f68cc58602a6bff7c39c2dc57965bb0d1af60 Author: cfif Date: Tue Oct 14 13:46:12 2025 +0300 Обновление diff --git a/Pwms.c b/Pwms.c new file mode 100644 index 0000000..51b1938 --- /dev/null +++ b/Pwms.c @@ -0,0 +1,43 @@ +// +// Created by Cfif on 14.12.23. +// +#include +#include "fc7xxx_driver_port.h" +#include "Pwms.h" + + +tPwms PWMS; + +void Bsp_Tpu_PwmCallback(void) { + TPU_PwmServiceReq(PWMS.pwm.TPU_PWM_CHANNEL, + PWMS.pwm.etpu_pwmconfig_tbl.u32ActiveTime, + PWMS.pwm.etpu_pwmconfig_tbl.u32PeriodTime); +} + +void Bsp_Tpu_OverflowCallBack(void) { + +} + + +void Pwms_Init(uint8_t percent) { + tPwms *env = &PWMS; + + PORT_InitType tInitStruct = {0}; + + /* TPU_CH0: PortA 18: ALT4 */ + tInitStruct.u32PortPins = PORT_PIN_18; + tInitStruct.uPortPinMux.u32PortPinMode = PORT_ALT4_FUNC_MODE; + PORT_InitPins(PORT_A, &tInitStruct); + + env->pwm = PWM_Initial( + PERIOD_TICKS, + PERIOD_TICKS * percent / 100, + 0, + 0x7, + Bsp_Tpu_PwmCallback, + Bsp_Tpu_OverflowCallBack + + ); + + env->pwmIo = vPwmGetIo(&env->pwm); +} diff --git a/Pwms.h b/Pwms.h new file mode 100644 index 0000000..a4dfbea --- /dev/null +++ b/Pwms.h @@ -0,0 +1,19 @@ +// +// Created by ilya on 14.12.23. +// + +#ifndef FLAG_PWMS_H +#define FLAG_PWMS_H + +#include "PwmFlagchip.h" + +typedef struct { + tPwmFlagchip pwm; + tPwmIO pwmIo; +} tPwms; + +extern tPwms PWMS; + +void Adcs_Init(); + +#endif //FLAG_PWMS_H diff --git a/modular.json b/modular.json new file mode 100644 index 0000000..9589ff8 --- /dev/null +++ b/modular.json @@ -0,0 +1,13 @@ +{ + "dep": [ + + ], + "cmake": { + "inc_dirs": [ + "./" + ], + "srcs": [ + "./**.c" + ] + } +} \ No newline at end of file