#include <TinyWireM.h>
#include <Tiny4kOLED.h>
#define OLEDsda 0 // PB0 I2C SDA
#define BtnDwnPin 1 // PB1 Port asigned for Button Down
#define OLEDsck 2 // PB2 I2C SCK
#define MicSwitch 3 // PB3 Port asigned for Buzzer or Mic Switch / MicSwitch
#define BtnUpPin 4 // PB4 Port asigned for Button Up
#define AnalogInPin 5 // PB5 /RESET Port asigned for measuring Vbat
// BUTTONS
bool BtnDwn = false; // Button Down status
bool BtnUp = false; // Button Up status
bool BtnPressed = false; // Both Button(s) status
#define BtnUpRow 0 // Button Up Arrow position on row
#define BtnDwnRow 7 // Button Down Arrow position
#define BtnColPos 120 // Buttons Arrows column position
#define regist PCINT0_vect //All IRQ pins on Attiny85 :)
// GLOBALS
int Timer=0;
int Vbat=0; // For measuring Vbat
void setup() {
pinMode(BtnUpPin, INPUT_PULLUP);
pinMode(BtnDwnPin, INPUT_PULLUP);
pinMode(MicSwitch, OUTPUT);
pinMode(A0, INPUT); // use PB5 for measuring Vbat
oled.begin(128, 64, sizeof(tiny4koled_init_128x64br), tiny4koled_init_128x64br);
// Two fonts are supplied with this library, FONT8X16 and FONT6X8
oled.setFont(FONT6X8);
// To clear all the memory
oled.clear();
oled.on();
// enable interrupt for pins...
GIMSK = 0b00100000; // turns on pin change interrupts
PCMSK = 0b00010010; // On pins 1 & 4
splash();
delay(500);
oled.clear();
// prepareDisplay();
}
void loop() {
// put your main code here, to run repeatedly:
}
ISR(regist) {
//if (digitalRead(BtnDwnPin)==LOW){
if (!digitalRead( BtnDwnPin )) BtnDwn = true;
if (!digitalRead( BtnUpPin )) BtnUp = true;
}