uraimo / SwiftyGPIO

A Swift library for hardware projects on Linux/ARM boards with support for GPIOs/SPI/I2C/PWM/UART/1Wire.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for Raspberry Pi zero 2

curuvar opened this issue · comments

Board Type

Raspberry Pi zero 2

Operating System

Raspberry Pi OS

Swift Version

Swift version 5.5 (swift-5.5-RELEASE)

Description

Need to add official support for Raspberry Pi zero 2. Currently I have to lie an say the board is a pi3 for the PWM to work.

Hi, pi3 presets and not the pi4 ones, correct?
Can you also confirm that you are using the latest Pi OS (bullseye)?
New release coming tomorrow.

Released 1.3.6, with the initIO fix too.

The problem with the dual PWMs is that the PWM generator expects the PWM pattern to be stored in a single memory location, and when you want to generate two distinct signals the two patterns are expected to be stored as an interleaved sequence of elements, as in: odd positions for PWM1 and even positions for PWM2.
Normally that block of memory would just contains a pattern for a single PWM as an unbroken sequence.

I've never added support for this because it would make the code and relative API even more convoluted, I planned to implement a different PWM mode that would have solved the multiple PWMs issue in a cleaner way and would have allowed up to 8 independent PWM but never got around to it.