Skip to content

Commit 302877f

Browse files
committed
added code for fox in testapp
work by @finnpauls, @eljojo and @zucaritask
1 parent bdcca51 commit 302877f

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

testapp/fox.c

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*
2+
* Copyright 2015 team rad1o
3+
*
4+
*/
5+
6+
#include <unistd.h>
7+
8+
#include <rad1olib/setup.h>
9+
#include <r0ketlib/display.h>
10+
#include <r0ketlib/print.h>
11+
#include <r0ketlib/itoa.h>
12+
#include <r0ketlib/keyin.h>
13+
#include <r0ketlib/menu.h>
14+
#include <r0ketlib/select.h>
15+
#include <r0ketlib/image.h>
16+
#include <fatfs/ff.h>
17+
#include <r0ketlib/fs_util.h>
18+
19+
// # from LED
20+
#include <rad1olib/pins.h>
21+
#include <libopencm3/lpc43xx/adc.h>
22+
23+
void show_menu() {
24+
lcdClear();
25+
lcdPrintln("Super Image");
26+
lcdPrintln("up: view file");
27+
lcdPrintln("down: choose second image");
28+
lcdPrintln("right: start the loop!");
29+
lcdDisplay();
30+
}
31+
32+
//# MENU img
33+
void fox_menu() {
34+
char filename[FLEN];
35+
char filename2[FLEN];
36+
FATFS FatFs;
37+
FRESULT res;
38+
int so=58;
39+
40+
show_menu();
41+
42+
getInputWaitRelease();
43+
44+
SETUPadc(LED4);
45+
while(1){
46+
switch(getInputWaitRepeat()){
47+
case BTN_UP:
48+
getInputWaitRelease();
49+
if(selectFile(filename,"LCD")<0){
50+
lcdPrintln("Select ERROR");
51+
lcdDisplay();
52+
getInputWait();
53+
return;
54+
};
55+
56+
show_menu();
57+
// lcdShowImageFile(filename);
58+
break;
59+
case BTN_DOWN:
60+
getInputWaitRelease();
61+
if(selectFile(filename2,"LCD")<0){
62+
lcdPrintln("Select ERROR");
63+
lcdDisplay();
64+
getInputWait();
65+
return;
66+
};
67+
show_menu();
68+
break;
69+
case BTN_LEFT:
70+
break;
71+
case BTN_RIGHT:
72+
while(getInput() != BTN_LEFT) {
73+
if(adc_get_single(ADC0,ADC_CR_CH6)*2*330/1023 > 210) {
74+
lcdShowImageFile(filename);
75+
// lcdPrintln("HIGH");
76+
// lcdDisplay();
77+
} else {
78+
lcdShowImageFile(filename2);
79+
// lcdPrintln("LOW");
80+
// lcdDisplay();
81+
}
82+
}
83+
show_menu();
84+
break;
85+
case BTN_ENTER:
86+
lcd_select();
87+
lcdWrite(TYPE_CMD,0x3a); lcdWrite(TYPE_DATA,2);
88+
lcd_deselect();
89+
return;
90+
};
91+
};
92+
};

0 commit comments

Comments
 (0)