pwm uart gpio i2c

This commit is contained in:
2025-11-12 19:44:11 +08:00
parent 8908bf2332
commit 4dc04bdd7e
3 changed files with 20 additions and 3 deletions

View File

@@ -8,12 +8,12 @@ void PWM_Channel1(uint16_t Compare)
void PWM_Channel2(uint16_t Compare)
{
//DL_TimerA_setCaptureCompareValue(PWM_0_INST,Compare,GPIO_PWM_0_C1_IDX);
DL_TimerA_setCaptureCompareValue(PWM_0_INST,Compare,GPIO_PWM_0_C1_IDX);
}
void PWM_Channel3(uint16_t Compare)
{
//DL_TimerA_setCaptureCompareValue(PWM_0_INST,Compare,GPIO_PWM_0_C2_IDX);
DL_TimerA_setCaptureCompareValue(PWM_0_INST,Compare,GPIO_PWM_0_C2_IDX);
}

View File

@@ -36,12 +36,14 @@
#include <stdio.h>
#include <string.h>
#include <pwm.h>
extern float angle_f;
const float num_f = 0.123456f;
volatile uint16_t count = 0 ;
int main(void)
{
@@ -55,6 +57,11 @@ int main(void)
volatile float angle_rad = GetAngle();
//printf("test \n");
printf("angle %.5f \n" , angle_rad);
PWM_Channel1(count ++);
if(count == 750)
count = 0;
}
}

View File

@@ -439,6 +439,16 @@
<FileType>5</FileType>
<FilePath>..\3rd\uart_redircet.h</FilePath>
</File>
<File>
<FileName>pwm.c</FileName>
<FileType>1</FileType>
<FilePath>..\3rd\pwm.c</FilePath>
</File>
<File>
<FileName>pwm.h</FileName>
<FileType>5</FileType>
<FilePath>..\3rd\pwm.h</FilePath>
</File>
</Files>
</Group>
</Groups>