-
Notifications
You must be signed in to change notification settings - Fork 0
/
TinyDriver.h
75 lines (61 loc) · 2.31 KB
/
TinyDriver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// >>>>> TINY JOYPAD TESTER GPL v3 <<<<
// >>>>> FOR TINYJOYPAD rev2 <<<<
// Programmer: Daniel C 2021
// Contact EMAIL: [email protected]
// official website: www.tinyjoypad.com
// or https://sites.google.com/view/arduino-collection
// TINY JOYPAD TESTER is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//for TINY JOYPAD rev2 (attiny85)
//the code work at 16MHZ internal
//Program the chip with an arduino uno in "Arduino as ISP" mode.
//
// Modified by Dan Schnur to use SSD1306xled driver from tinysaur & to flip screen for use in business card.
//
#include <ssd1306xled.h>
//prototype
void TinyOLED_init(void);
void TinyOLED_Begin(void);
void TinyOLED_End(void);
void TinyOLED_Send(uint8_t byte_);
void TinyOLED_send_command(uint8_t command_);
void TinyOLED_Data_Start(uint8_t Y_);
#define OledSDA_LOW 0b11111110
#define OledSDA_HIGH 0b00000001
#define OledSCL_LOW 0b11111011
#define OledSCL_HIGH 0b00000100
#define OledADRESS 0x78
void TinyOLED_init(void){
SSD1306.ssd1306_init();
pinMode(1,INPUT);
DDRB =DDRB|0b00010000;
pinMode(A0,INPUT);
// Comment out Next 2 lines to flip screen
//SSD1306.ssd1306_send_command(0xC0); //Flip Screen
//SSD1306.ssd1306_send_command(0xA0); //Remap address so we dont get a mirrored screen
}
void TinyOLED_Begin(void){
SSD1306.ssd1306_xfer_start();
}
void TinyOLED_End(void){
SSD1306.ssd1306_xfer_stop();
}
void TinyOLED_Send(uint8_t byte_){
SSD1306.ssd1306_send_data_start();
SSD1306.ssd1306_send_byte(byte_);
}
void TinyOLED_send_command(uint8_t command_){
SSD1306.ssd1306_send_command(command_);
}
void TinyOLED_Data_Start(uint8_t Y_){
SSD1306.ssd1306_send_data_start();
SSD1306.ssd1306_setpos(0,Y_);
}