1/tncrazvan/zigberrypi v0.13

Zig library for interacting with raspberrypi's gpio.


zigberrypi

Zig library for interacting with raspberrypi's gpio

How to install

  • add dependency
    zigmod aq install 1/tncrazvan/zigberrypi
    
  • add a reference for the dependency in build.zig
    const deps = @import("deps.zig");
    // ...
    pub fn build(b: *std.Build) void {
    // ...
      deps.addAllTo(exe);
    // ...
    }
    
  • import zigberrypi in your project with
    const gpio = @import("zigberrypi");
    

Example

Blinking led example

const std = @import("std");
const gpio = @import("zigberrypi");

fn sleepForTwoSeconds() void {
    std.time.sleep(std.time.ns_per_s * 2);
}

pub fn main() !void {
    var active = false;
    const pin11 = try gpio.openWritable(gpio.Pin.PIN11);
    defer pin11.close();
    while (true) {
        try pin11.write(if (active) "1" else "0");
        active = !active;
        sleepForTwoSeconds();
    }
}

Package Contents

  • .vscode/launch.json
  • .gitattributes
  • zigmod.lock
  • LICENSE
  • .github/workflows/zig.yml
  • .github/ISSUE_TEMPLATE/feature_request.md
  • .github/ISSUE_TEMPLATE/bug_report.md
  • .github/ISSUE_TEMPLATE/question.md
  • CODE_OF_CONDUCT.md
  • build.zig
  • zigmod.yml
  • src/gpio.zig
  • src/string.zig
  • src/buffer.zig
  • README.md
  • .gitignore

History

Published On Tree @ Commit Size
v0.13 Fri, 02 Jun 2023 14:09:00 UTC Tree 17.182 KB
v0.12 Fri, 02 Jun 2023 14:04:31 UTC Tree 17.200 KB
v0.11 Fri, 02 Jun 2023 14:03:54 UTC Tree 17.194 KB
v0.10 Fri, 02 Jun 2023 14:03:00 UTC Tree 17.220 KB
v0.9 Fri, 02 Jun 2023 14:02:06 UTC Tree 16.300 KB
v0.8 Fri, 02 Jun 2023 13:38:45 UTC Tree 16.294 KB
v0.7 Fri, 02 Jun 2023 13:31:08 UTC Tree 16.401 KB
v0.6 Fri, 02 Jun 2023 13:30:13 UTC Tree 16.542 KB
v0.5 Thu, 01 Jun 2023 17:41:02 UTC Tree 12.989 KB
v0.4 Thu, 01 Jun 2023 17:40:08 UTC Tree 7.887 KB
v0.3 Wed, 31 May 2023 23:35:09 UTC Tree 7.886 KB
v0.2 Wed, 31 May 2023 23:31:50 UTC Tree 7.761 KB
v0.1 Wed, 31 May 2023 23:23:02 UTC Tree 7.589 KB