Skip to content

Instantly share code, notes, and snippets.

@scls19fr
Last active October 27, 2018 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scls19fr/0e95131dc3ec6cd061da11377445215d to your computer and use it in GitHub Desktop.
Save scls19fr/0e95131dc3ec6cd061da11377445215d to your computer and use it in GitHub Desktop.
@scls19fr
Copy link
Author

scls19fr 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)

@scls19fr
Copy link
Author

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

@scls19fr
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