Changeset 33083 in project


Ignore:
Timestamp:
01/12/16 23:43:40 (4 years ago)
Author:
Caolan McMahon
Message:

API updates for 1.1.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/raspberry-pi-gpio

    r32199 r33083  
    3434
    3535(define (loop)
    36   (let ((pin (receive-gpio-event)))
    37     (printf "Interrup on pin ~S, value: ~S~n" pin (digital-read pin))
     36  (receive (pin value intsec intnsec) (receive-gpio-event)
     37    (printf "Interrupt on pin ~S, interrupt time ~S.~S, value: ~S, value now: ~S ~n"
     38            pin intsec intnsec value (digital-read pin))
    3839    (loop)))
    3940
     
    9697previously set as an output.
    9798
     99<procedure>(digital-write/time pin value)</procedure>
     100
     101Writes the value HIGH or LOW (1 or 0) to the given pin which must have been previously set as an output.
     102
     103Returns two values, seconds and nanoseconds since process- or machine startup when the pin value was changed.
     104
    98105<procedure>(digital-read pin)</procedure>
    99106
     
    122129
    123130Blocks until a GPIO interrupt occurs on a pin that had set-edge called on it.
    124 Returns the pin number that caused the interrupt.
     131
     132Returns four values the pin number that caused the interrupt, the value read from the pin in the interrupt routine, the number of seconds and nanoseconds representing the time when the interrupt routine was executed.
     133
     134<procedure>(current-time-raw)</procedure>
     135
     136Returns two values the number of seconds and nanosecons since process- or machine startup.
     137
     138Uses Linux' clock_gettime to read CLOCK_MONOTONIC_RAW, i.e. the result value is not effected by adjustments from NTP etc. and therefore suited to measure physical time deltas.
    125139
    126140<constant>HIGH</constant>
Note: See TracChangeset for help on using the changeset viewer.