]>
git.gir.st - hardpass.git/blob - oled/oled_passwd.cpp
1 #include "ArduiPi_OLED_lib.h"
2 #include "Adafruit_GFX.h"
3 #include "ArduiPi_OLED.h"
9 //yes, this is irritating to unix users, but a return val >= 1 will mean nth item selected
10 ArduiPi_OLED display
; // Instantiate the display
18 // default options values
24 void testdrawchar(void) {
25 display
.setTextSize(1);
26 display
.setTextColor(WHITE
);
27 display
.setCursor(0,0);
29 for (uint8_t i
=0; i
< 168; i
++) {
30 if (i
== '\n') continue;
32 //if ((i > 0) && (i % 21 == 0))
33 //display.print("\n");
39 void disp_login (char* title
, int ast_n
) {
40 display
.clearDisplay();
41 display
.setTextSize(1);
42 display
.setTextColor(WHITE
);
43 display
.setCursor(0,0);
44 display
.print (title
);
45 display
.drawLine(0, 8, display
.width()-1, 8, WHITE
);
47 display
.setCursor(0,10);
48 display
.printf ("Enter GPG Passphrase:\n");
49 for (int i
= 0; i
< ast_n
; i
++) {
56 int the_login (char* title
) {
57 int asterisks_num
= 0;
58 system ("/bin/stty raw");//send keystrokes immediately, not just after enter key
60 disp_login (title
, asterisks_num
);
70 system ("/bin/stty cooked");//return to normal mode
78 int main(int argc
, char **argv
)
80 if ( !display
.init(OLED_I2C_RESET
,opts
.oled
) ) {
86 //display.clearDisplay(); // clears the screen buffer
87 //display.display(); // display it (clear display)
89 display
.clearDisplay();
91 // draw the first ~12 characters in the font
95 //display.clearDisplay();
99 return the_login ("Hardpass");
102 display
.close(); // Free PI GPIO ports