瀏覽代碼

Update pwm.c

main
Frank 4 年之前
父節點
當前提交
3faa68520a
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 2 行新增2 行删除
  1. +2
    -2
      teensy4/pwm.c

+ 2
- 2
teensy4/pwm.c 查看文件

@@ -119,7 +119,7 @@ void flexpwmFrequency(IMXRT_FLEXPWM_t *p, unsigned int submodule, uint8_t channe
{
uint16_t mask = 1 << submodule;
uint32_t olddiv = p->SM[submodule].VAL1;
uint32_t newdiv = (uint32_t)((float)F_BUS_ACTUAL / frequency + 0.5);
uint32_t newdiv = (uint32_t)((float)F_BUS_ACTUAL / frequency + 0.5f);
uint32_t prescale = 0;
//printf(" div=%lu\n", newdiv);
while (newdiv > 65535 && prescale < 7) {
@@ -158,7 +158,7 @@ void quadtimerWrite(IMXRT_TMR_t *p, unsigned int submodule, uint16_t val)

void quadtimerFrequency(IMXRT_TMR_t *p, unsigned int submodule, float frequency)
{
uint32_t newdiv = (uint32_t)((float)F_BUS_ACTUAL / frequency + 0.5);
uint32_t newdiv = (uint32_t)((float)F_BUS_ACTUAL / frequency + 0.5f);
uint32_t prescale = 0;
//printf(" div=%lu\n", newdiv);
while (newdiv > 65534 && prescale < 7) {

Loading…
取消
儲存