#include <Arduino.h>

enum {
  MODE_INPUT,
  MODE_OUTPUT
} dataMode = NULL;

#define OE 3
// PGM is also WE# according to data sheet
#define PGM 2

// 18 pin address line
#define Addr0 22
#define Addr18 40

// 8 pin data line
#define Data0 44
#define Data7 51

void setCtrlPins();

void setAddrPinsOut();

void setDataPinsOut();

void setDataPinsIn();

void setByte(byte out);

void setAddress(unsigned long addr);

byte readByte();

byte readData(unsigned long address);

void writeByte(byte data, unsigned long address);

void programData(byte data, unsigned long address);