Обновление
This commit is contained in:
commit
565f68cc58
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"dep": [
|
||||
|
||||
],
|
||||
"cmake": {
|
||||
"inc_dirs": [
|
||||
"./"
|
||||
],
|
||||
"srcs": [
|
||||
"./**.c"
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue