hArduino-0.7: Control your Arduino board from Haskell.

Safe HaskellNone




Abstractions for shift-register IC parts.


Shift register abstraction

class ShiftRegister a whereSource

A shift-register class as supported by the hArduino library.


size :: a -> IntSource


name :: a -> StringSource

Display name

dataSheet :: a -> StringSource

Data sheet (typically a URL)

initialize :: a -> Arduino ()Source

Initialize the shift-register

disable :: a -> Arduino ()Source

Disable the output, putting it into high-impedance state

enable :: a -> Arduino ()Source

Enable the output, getting it out of the high-impedance state

clear :: a -> Arduino ()Source

Clear the contents

push :: a -> Bool -> Arduino ()Source

Push a single bit down the shift-register

store :: a -> Arduino ()Source

Store the pushed-in values in the storage register

read :: a -> Arduino [Bool]Source

Read the current value stored

Supported shift-registers

Texas Instruments 7HC595

data SR_74HC595 Source

The Texas-Instruments 74HC595 8-bit shift register with 3-state outputs. Data sheet: http://www.ti.com/lit/ds/symlink/sn74hc595.pdf.

This is a versatile 8-bit shift-register with separate serial and register clocks, allowing shifting to be done while the output remains untouched. We model all control pins provided. Note that the enable and clear lines are negated.




serial :: Pin

Chip Pin: 14: Serial input

nEnable :: Pin

Chip Pin: 13: Negated output-enable

rClock :: Pin

Chip Pin: 12: Register clock, positive triggered

sClock :: Pin

Chip Pin: 11: Serial clock, positive triggered

nClear :: Pin

Chip Pin: 10: Negated clear-data

mbBits :: Maybe [Pin]

Chip Pins: 15, 1-7, and 8: Sequence of output bits, connect only if reading is necessary