Skip to content

Commit

Permalink
Minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
Rubberazer authored Dec 24, 2023
1 parent 37c2007 commit f6412ce
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions nano.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ For more information, please refer to <http://unlicense.org/>
#include <stdint.h>
#include <errno.h>
#include <unistd.h>
#include <math.h>
#include <sys/fcntl.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
Expand Down Expand Up @@ -2022,15 +2023,8 @@ int gpioSetPWMfrequency(unsigned gpio, unsigned frequency){

int status = 1;
int PFM = 0;
int divider = 0;
if ((frequency >= 25) && (frequency <=187000)){
if (frequency < 30000){
divider = 187500;
}
else {
divider = 204800;
}
PFM = (divider/frequency)-1;
PFM = round(187500.0/(double)frequency)-1;
switch (gpio){
case 32:
pinPWM->PWM_0[0] = 0x0;
Expand Down

0 comments on commit f6412ce

Please sign in to comment.