Keeping compatibility of hardware clock of Pi 4 with earlier versions.

(cherry picked from commit 651136a110)
This commit is contained in:
neuralassembly 2019-12-30 23:40:30 +09:00 committed by Robert von Burg
parent 9f38fd5b87
commit 230d92e4a4
1 changed files with 5 additions and 0 deletions

View File

@ -1218,6 +1218,11 @@ void pwmSetRange (unsigned int range)
void pwmSetClock (int divisor)
{
uint32_t pwm_control ;
if (piGpioBase == GPIO_PERI_BASE_2711)
{
divisor = 540*divisor/192;
}
divisor &= 4095 ;
if ((wiringPiMode == WPI_MODE_PINS) || (wiringPiMode == WPI_MODE_PHYS) || (wiringPiMode == WPI_MODE_GPIO))