check
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
{ config, lib, pkgs, namespace, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
namespace,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.${namespace}.hardware.raspberry-pi.i2c;
|
||||
variant = config.${namespace}.hardware.raspberry-pi.variant;
|
||||
@@ -10,52 +16,62 @@ in
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
hardware.deviceTree = {
|
||||
overlays = (if (variant == "5") then
|
||||
[
|
||||
{
|
||||
name = "i2c0-pi5-overlay";
|
||||
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/i2c0-pi5-overlay.dts";
|
||||
}
|
||||
{
|
||||
name = "i2c1-pi5-overlay";
|
||||
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/i2c1-pi5-overlay.dts";
|
||||
}
|
||||
{
|
||||
name = "i2c2-pi5-overlay";
|
||||
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/i2c2-pi5-overlay.dts";
|
||||
}
|
||||
{
|
||||
name = "i2c3-pi5-overlay";
|
||||
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/i2c3-pi5-overlay.dts";
|
||||
}
|
||||
]
|
||||
else
|
||||
[
|
||||
{
|
||||
name = "i2c0-overlay";
|
||||
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/i2c0-overlay.dts";
|
||||
}
|
||||
{
|
||||
name = "i2c1-overlay";
|
||||
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/i2c1-overlay.dts";
|
||||
}
|
||||
{
|
||||
name = "i2c3-overlay";
|
||||
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/i2c3-overlay.dts";
|
||||
}
|
||||
{
|
||||
name = "i2c4-overlay";
|
||||
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/i2c4-overlay.dts";
|
||||
}
|
||||
{
|
||||
name = "i2c5-overlay";
|
||||
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/i2c5-overlay.dts";
|
||||
}
|
||||
{
|
||||
name = "i2c6-overlay";
|
||||
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/i2c6-overlay.dts";
|
||||
}
|
||||
]);
|
||||
overlays = (
|
||||
if (variant == "5") then
|
||||
[
|
||||
{
|
||||
name = "i2c0-pi5-overlay";
|
||||
dtsFile = "${
|
||||
pkgs.${namespace}.raspberrypi-overlays
|
||||
}/dtbs/raspberrypi-overlays/i2c0-pi5-overlay.dts";
|
||||
}
|
||||
{
|
||||
name = "i2c1-pi5-overlay";
|
||||
dtsFile = "${
|
||||
pkgs.${namespace}.raspberrypi-overlays
|
||||
}/dtbs/raspberrypi-overlays/i2c1-pi5-overlay.dts";
|
||||
}
|
||||
{
|
||||
name = "i2c2-pi5-overlay";
|
||||
dtsFile = "${
|
||||
pkgs.${namespace}.raspberrypi-overlays
|
||||
}/dtbs/raspberrypi-overlays/i2c2-pi5-overlay.dts";
|
||||
}
|
||||
{
|
||||
name = "i2c3-pi5-overlay";
|
||||
dtsFile = "${
|
||||
pkgs.${namespace}.raspberrypi-overlays
|
||||
}/dtbs/raspberrypi-overlays/i2c3-pi5-overlay.dts";
|
||||
}
|
||||
]
|
||||
else
|
||||
[
|
||||
{
|
||||
name = "i2c0-overlay";
|
||||
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/i2c0-overlay.dts";
|
||||
}
|
||||
{
|
||||
name = "i2c1-overlay";
|
||||
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/i2c1-overlay.dts";
|
||||
}
|
||||
{
|
||||
name = "i2c3-overlay";
|
||||
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/i2c3-overlay.dts";
|
||||
}
|
||||
{
|
||||
name = "i2c4-overlay";
|
||||
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/i2c4-overlay.dts";
|
||||
}
|
||||
{
|
||||
name = "i2c5-overlay";
|
||||
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/i2c5-overlay.dts";
|
||||
}
|
||||
{
|
||||
name = "i2c6-overlay";
|
||||
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/i2c6-overlay.dts";
|
||||
}
|
||||
]
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user