Обновление

This commit is contained in:
cfif 2025-10-14 13:46:12 +03:00
commit 565f68cc58
3 changed files with 75 additions and 0 deletions

43
Pwms.c Normal file
View File

@ -0,0 +1,43 @@
//
// Created by Cfif on 14.12.23.
//
#include <stdbool.h>
#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);
}

19
Pwms.h Normal file
View File

@ -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

13
modular.json Normal file
View File

@ -0,0 +1,13 @@
{
"dep": [
],
"cmake": {
"inc_dirs": [
"./"
],
"srcs": [
"./**.c"
]
}
}