Browse Source

Update pwm.c

teensy4-core
Frank 4 years ago
parent
commit
3faa68520a
No account linked to committer's email address
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      teensy4/pwm.c

+ 2
- 2
teensy4/pwm.c View File

{ {
uint16_t mask = 1 << submodule; uint16_t mask = 1 << submodule;
uint32_t olddiv = p->SM[submodule].VAL1; 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; uint32_t prescale = 0;
//printf(" div=%lu\n", newdiv); //printf(" div=%lu\n", newdiv);
while (newdiv > 65535 && prescale < 7) { while (newdiv > 65535 && prescale < 7) {


void quadtimerFrequency(IMXRT_TMR_t *p, unsigned int submodule, float frequency) 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; uint32_t prescale = 0;
//printf(" div=%lu\n", newdiv); //printf(" div=%lu\n", newdiv);
while (newdiv > 65534 && prescale < 7) { while (newdiv > 65534 && prescale < 7) {

Loading…
Cancel
Save