
#ifndef __CubeRegister__
#define __CubeRegister__
#include <Arduino.h>

class CubeRegister {
  public:
    /*
    singnals for IC SN74HC595 8-bit shift registers with 3-state output registers
       SER   - PIN 14
       OE    - PIN 13
       RCLK  - PIN 12
       SRCLK - PIN 11
       SRCLR - PIN 10
    */

    // bitmasks for PORTB Pin 8 - 13
    static const byte _SER     = 0x10; // 0b00010000; //  D12
    static const byte _OE      = 0x08; // 0b00001000; //  D11
    static const byte _RCLK    = 0x04; // 0b00000100; //  D10
    static const byte _SRCLK   = 0x02; // 0b00000010; //  D9
    static const byte _SRCLR   = 0x01; // 0b00000001; //  D8

    void reset(void);
    void output_enable(void);
    void output_disable(void);
    void clear_register(void);
    void shift_bit(bool bit);
    void register_to_output(void);

};

extern CubeRegister CubeRegisterPortB;
#endif
