/* BigIOoutput.h - Write serial to parallel output BigIOinput *PRELIMINARY* Arduino header Copyright (c) 2011 Devon Sean McCullough Licensed under the GPL (GNU Public License) BigIOoutput(size, mirror, ser, serclk, rclk, oe, srclr) // buffered // BigIOoutput(size, circle, ser, serclk, rclk, oe, srclr) // circular mirror = write buffer of size bits, i.e., size/8 bytes circle = input pin connected to final Qh' output required output pins: ser, serclk, rclk optional output pins: oe, srclr enable(true) // enable 3-state outputs (requires oe) enable(false) // disable ... clear() // clear register to zeros (requires srclr) store() // copy register to external outputs shift(bit) // shift bit to register shift(bits, size) // ... size binary bits shift(buffer, size) // ... buffer of size booleans set(...) // write(...) to mirror only, does not store write(bit, position) // write bit to position write(bits, size, position) // ... size bits ... write(buffer, size, position) // ... from buffer ... write(buffer, size, position, map) // ... permuted by map type BitIO_t // sixty-four bit unsigned integer constant BIGIO_BITS // number of bits in BitIO_t bit = boolean false=0, true=1 bits = bit vector as little-endian BitIO_t size = number of bits position = bit index as zero-origin int buffer = bit vector as little-endian* packed binary octets map = soft rewire as array of buffer positions * little-endian bit and byte order both, i.e., byte i weighs 2^(BIGIO_BITS_PER_BYTE * i) bit j weighs 2^j */ #ifndef BigIOoutput_h #define BigIOoutput_h #include "WProgram.h" #include "BigIO.h" class BigIOoutput { public: BigIOoutput(int size, byte *mirror, int ser, int srclk, int rclk, int oe = -1, int srclr = -1); //BigIOoutput(int size, int circle, int ser, int srclk, int rclk, int oe = -1, int srclr = -1); void store(); void clear(); void enable(boolean on); void shift(boolean bit); void shift(BigIO_t bits, int size); void shift(byte *buffer, int size); void set(boolean bit, int position); void set(BigIO_t bits, int size, int position); void set(BigIO_t bits, int size, int position, int *map); void set(byte *buffer, int size, int position); void set(byte *buffer, int size, int position, int *map); void write(boolean bit, int position); void write(BigIO_t bits, int size, int position); void write(BigIO_t bits, int size, int position, int *map); void write(byte *buffer, int size, int position); void write(byte *buffer, int size, int position, int *map); private: int _size; byte *_mirror; byte _ser, _srclk, _rclk, _oe, _srclr; //byte _circle; //void (*_bigSet)(BigIO_t bits, int size, int position, int *map); //void (*_bufSet)(byte *buffer, int size, int position, int *map); }; #endif // end BigIOoutput.h