{"id":16189300,"url":"https://github.com/caolan/raspberry-pi-gpio","last_synced_at":"2025-07-03T08:04:54.423Z","repository":{"id":21722257,"uuid":"25043867","full_name":"caolan/raspberry-pi-gpio","owner":"caolan","description":"Raspberry Pi GPIO library for CHICKEN Scheme","archived":false,"fork":false,"pushed_at":"2016-01-12T22:29:36.000Z","size":171,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-07T13:51:21.671Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scheme","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/caolan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-10T16:31:28.000Z","updated_at":"2023-03-03T08:19:35.000Z","dependencies_parsed_at":"2022-08-17T16:25:15.831Z","dependency_job_id":null,"html_url":"https://github.com/caolan/raspberry-pi-gpio","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/caolan/raspberry-pi-gpio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fraspberry-pi-gpio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fraspberry-pi-gpio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fraspberry-pi-gpio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fraspberry-pi-gpio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caolan","download_url":"https://codeload.github.com/caolan/raspberry-pi-gpio/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fraspberry-pi-gpio/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261823685,"owners_count":23215140,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T07:34:59.601Z","updated_at":"2025-06-25T07:03:39.254Z","avatar_url":"https://github.com/caolan.png","language":"Scheme","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RaspberryPI GPIO library\n\nThis egg provides an interface to the RaspberryPi GPIO pin for CHICKEN Scheme.\n\n## Requirements\n\nYou'll need to install [Wiring Pi](http://wiringpi.com) before using this\nlibrary. The [Wiring Pi documentation](http://wiringpi.com/reference) may\nhelp you understand some of these functions in more detail.\n\nNo eggs required.  (This egg was written to reduce the huge dependency\nlist of the original.)\n\n## Example\n\n```scheme\n(use raspberry-pi-gpio)\n\n(setup-gpio)\n\n;; digital read / write\n\n(pin-mode 1 'output)\n\n(digital-write 1 HIGH)\n(digital-write 1 LOW)\n\n(printf \"Pin 1 is: ~S~n\" (digital-read 1))\n\n;; using interrupts to respond to events\n\n(set-edge 7 'falling)\n(set-edge 8 'both)\n\n(define (loop)\n  (receive (pin value intsec intnsec) (receive-gpio-event)\n    (printf \"Interrupt on pin ~S, interrupt time ~S.~S, value: ~S, value now: ~S ~n\"\n            pin intsec intnsec value (digital-read pin))\n    (loop)))\n\n(loop)\n```\n\n## API\n\nOne of the setup functions must be called at the start of your program, or\nyour program will fail to work correctly.\n\n#### (setup-gpio)\n\nUse the Broadcom GPIO pin numbers when referencing pins.\n\n#### (setup-virtual)\n\nUse the wiringPi pin numbering scheme. This is a simplified numbering\nscheme which provides a mapping from virtual pin numbers 0 through 16 to\nthe real underlying Broadcom GPIO pin numbers. See the [Wiring Pi\ndocumentation](http://wiringpi.com/reference/setup/) for more info.\n\n#### (setup-physical)\n\nUse the physical pin numbers *on the P1 connector only*.\n\n#### (setup-system)\n\nUse the /sys/class/gpio interface rather than accessing the hardware\ndirectly. This can be called as a non-root user provided the GPIO pins have\nbeen exported before-hand using the gpio program.\n\n#### (board-rev)\n\nReturns the board revision (1 or 2).\n\n#### (pin-mode pin mode)\n\nSets the pin to the given mode. Mode is one of the following symbols:\n`input`, `output`, `pwm-output`, `gpio-clock`.\n\n#### (pull-up-dn-control pin pud)\n\nThis sets the pull-up or pull-down resistor mode on the given pin, which\nshould be set as an input. Pud should be one of the following symbols:\n`off`, `up`, `down`.\n\n#### (pwm-write pin value)\n\nWrites the value to the PWM register for the given pin. The Raspberry Pi\nhas one on-board PWM pin, pin 1 (BMC\\_GPIO 18, Phys 12) and the range is\n0-1024. Other PWM devices may have other PWM ranges.\n\nThis function is not able to control the Pi’s on-board PWM when in Sys\nmode.\n\n#### (digital-write pin value)\n\nWrites the value HIGH or LOW (1 or 0) to the given pin which must have been\npreviously set as an output.\n\n#### (digital-write/time pin value)\n\nWrites the value HIGH or LOW (1 or 0) to the given pin which must have been\npreviously set as an output.\n\nReturns two values, seconds and nanoseconds since process- or machine\nstartup when the pin value was changed.\n\n#### (digital-read pin)\n\nThis function returns the value read at the given pin. It will be HIGH or\nLOW (1 or 0) depending on the logic level at the pin.\n\n#### (analog-write pin value)\n\nThis writes the given value to the supplied analog pin.\n\n#### (analog-read pin)\n\nThis returns the value read on the supplied analog input pin.\n\n#### (set-edge pin edge)\n\nSets up an interrupt handler for the pin and given edge using wiringPiISR.\nUse this to hook up events for use with `recieve-gpio-event`.\n\nType should be one of the following symbols: `falling`, `rising`, `both`,\n`setup`. If `setup` is used then no initialisation of the pin will happen –\nit’s assumed that you have already setup the pin elsewhere (e.g. with the\ngpio program).\n\n#### (receive-gpio-event)\n\nBlocks until a GPIO interrupt occurs on a pin that had set-edge called on it.\n\nReturns four values the pin number that caused the interrupt, the\nvalue read from the pin in the interrupt routine, the number of\nseconds and nanoseconds representing the time when the interrupt\nroutine was executed.\n\n#### (current-time-raw)\n\nReturns two values the number of seconds and nanosecons since process-\nor machine startup.\n\nUses Linux' `clock_gettime` to read `CLOCK_MONOTONIC_RAW`, i.e. the\nresult value is *not* effected by adjustments from NTP etc. and\ntherefore suited to measure physical time deltas.\n\n#### HIGH\n\nThe HIGH value (1) exported by wiringPi.\n\n#### LOW\n\nThe LOW value (0) exported by wiringPi.\n\n## Authors\n\nCaolan McMahon, Jörg F. Wittenberger\n\n## License\n\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the Software),\nto deal in the Software without restriction, including without limitation\nthe rights to use, copy, modify, merge, publish, distribute, sublicense,\nand/or sell copies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\nTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\nOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaolan%2Fraspberry-pi-gpio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaolan%2Fraspberry-pi-gpio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaolan%2Fraspberry-pi-gpio/lists"}