Skip to content

Commit

Permalink
Meadow.Linux: Add support for Raspberry Pi 5 pinout
Browse files Browse the repository at this point in the history
The Raspberry Pi 5 pinout is quite different from the previous
versions, so we need to add a new pinout class for it. It use a
in house developed silicon for I/O, the RP1 I/O controller. It's
comes with a new pinctrl driver that changed the sysfs base from
0 to 53 and the gpiochip bank from gpiochip0 to gpiochip4.

However, reusing what we already have from previous versions of
Raspberry Pi, we can support this simply by modifying
the LinuxFlexiPin to allow changing the SysFsGpio and
GpiodChip.

Signed-off-by: Matheus Castello <matheus.castello@toradex.com>
  • Loading branch information
microhobby committed Oct 12, 2023
1 parent 02e0cbc commit ca8cce9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Meadow.Hardware;
using System.Collections;
using System.Collections.Generic;

namespace Meadow.Pinouts
{
public class RaspberryPi5 : RaspberryPi
{
public RaspberryPi5()
{
// the sysfs base for the pinctrl-rpi1 is 53
// the gpiochip bank for pinctrl-rpi1 on rpi5 is gpiochip4
foreach (LinuxFlexiPin pin in this.AllPins) {
pin.SysFsGpio += 53;
pin.GpiodChip = "gpiochip4";
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ public class LinuxFlexiPin : Pin
/// <summary>
/// The pin's sysfs GPIO number
/// </summary>
public int SysFsGpio { get; }
public int SysFsGpio { get; internal set; }
/// <summary>
/// The chip name for the gpiod driver
/// </summary>
public string GpiodChip { get; }
public string GpiodChip { get; internal set; }
/// <summary>
/// The pin offset for the gpiod driver
/// </summary>
Expand Down

0 comments on commit ca8cce9

Please sign in to comment.