Browse Source

Merge pull request #71 from neuralassembly/master

Keeping compatibility of hardware clock of Pi 4 with earlier versions.
pull/72/head
Mark Liffiton 4 years ago
committed by GitHub
parent
commit
5bbb6e34b8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      wiringPi/wiringPi.c

+ 5
- 0
wiringPi/wiringPi.c View File

@@ -1218,6 +1218,11 @@ void pwmSetRange (unsigned int range)
void pwmSetClock (int divisor) void pwmSetClock (int divisor)
{ {
uint32_t pwm_control ; uint32_t pwm_control ;

if (piGpioBase == GPIO_PERI_BASE_2711)
{
divisor = 540*divisor/192;
}
divisor &= 4095 ; divisor &= 4095 ;


if ((wiringPiMode == WPI_MODE_PINS) || (wiringPiMode == WPI_MODE_PHYS) || (wiringPiMode == WPI_MODE_GPIO)) if ((wiringPiMode == WPI_MODE_PINS) || (wiringPiMode == WPI_MODE_PHYS) || (wiringPiMode == WPI_MODE_GPIO))


Loading…
Cancel
Save