diff --git a/Pwms.c b/Pwms.c index 7b9dd52..d1889d9 100644 --- a/Pwms.c +++ b/Pwms.c @@ -35,15 +35,23 @@ void Pwms_Init() { PORT_InitPins(PORT_B, &tInitStruct); */ +/* // TPU_CH0: PortA 18: ALT4 tInitStruct.u32PortPins = PORT_PIN_18; tInitStruct.uPortPinMux.u32PortPinMode = PORT_ALT4_FUNC_MODE; PORT_InitPins(PORT_A, &tInitStruct); +*/ + + // TPU_CH0: PortB 8: ALT5 + tInitStruct.u32PortPins = PORT_PIN_8; + tInitStruct.uPortPinMux.u32PortPinMode = PORT_ALT5_FUNC_MODE; + PORT_InitPins(PORT_B, &tInitStruct); PWM_Initial( &env->pwm, + true, PERIOD_TICKS, - PERIOD_TICKS * 20 / 100, + PERIOD_TICKS * 5 / 100, 0U, 0xFF, Bsp_Tpu_PwmCallback, @@ -54,19 +62,20 @@ void Pwms_Init() { - // TPU_CH8: PortA 31: ALT6 - tInitStruct.u32PortPins = PORT_PIN_31; - tInitStruct.uPortPinMux.u32PortPinMode = PORT_ALT6_FUNC_MODE; + // TPU_CH1: PortA 0: ALT5 + tInitStruct.u32PortPins = PORT_PIN_0; + tInitStruct.uPortPinMux.u32PortPinMode = PORT_ALT5_FUNC_MODE; PORT_InitPins(PORT_A, &tInitStruct); PWM_Capture_Initial( &env->pwmCapture, - 0, - 0, - 8U, + false, + 1U, 0xFF, Bsp_Tpu_PwmCaptureCallback, Bsp_Tpu_Capture_OverflowCallBack ); + env->pwmCaptureIO = vPwmCaptureGetIo(&env->pwmCapture); + } diff --git a/Pwms.h b/Pwms.h index 4a6d0d6..fe1913f 100644 --- a/Pwms.h +++ b/Pwms.h @@ -13,6 +13,7 @@ typedef struct { tPwmIO pwmIo; tPwmCaptureFlagchip pwmCapture; + tPwmCaptureIO pwmCaptureIO; } tPwms;