Skip to content

Instantly share code, notes, and snippets.

@s-celles
Last active October 27, 2018 06:45
Show Gist options
  • Save s-celles/0e95131dc3ec6cd061da11377445215d to your computer and use it in GitHub Desktop.
Save s-celles/0e95131dc3ec6cd061da11377445215d to your computer and use it in GitHub Desktop.
@s-celles
Copy link
Author

s-celles commented Apr 26, 2016

https://github.com/scls19fr/Pingo.jl

see RaspberryPi-Samples/roadmap#1
and https://github.com/JuliaBerry/PiGPIO.jl
and https://github.com/scls19fr/roadmap_private/issues/17

is_virtualis attribute is a bad idea to manage a virtual / ghost push button (used for testing purpose)

maybe we should have Button and GhostButton or VirtualButton

https://gist.github.com/scls19fr/0e95131dc3ec6cd061da11377445215d#file-pingo-jl-L103

Pin have a board attribute so

function Led(board::AbstractBoard, pin::DigitalPin; lit_state=HIGH::PIN_VALUE)

should be replaced by

function Led(pin::DigitalPin; lit_state=HIGH::PIN_VALUE)

Board("") shouldn't always return a RaspberryPiBoard (should depend on which board it's running)

@s-celles
Copy link
Author

pin = Pin(GhostBoard(), Digital(), BCM(13))

@s-celles
Copy link
Author

function Board(s::AbstractString)
    s = lowercase(s)
    if s in ["", "rpi", "raspberry"]
        RaspberryPiBoard()
    elseif s in ["ghost"]
        GhostBoard()
    else
        error("'$s' is not an allowed board")
    end
end

function Board()
    Board("")
end

Should provide a register function

register!(Pingo.SUPPORTED_BOARDS, RaspberryPiBoard, ["rpi", "raspberry", "raspberrypi"])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment