Unpacked Tft, Touch,Gui and SD library from idpa project

This commit is contained in:
t-moe
2015-03-17 14:18:36 +01:00
parent 91352a222b
commit 552d0585de
18 changed files with 3924 additions and 0 deletions

189
src/Gui/button.c Normal file
View File

@@ -0,0 +1,189 @@
#include "../settings.h"
#include "../types.h"
#include "../tft/tft.h"
#include "../touch/touch.h"
#include "button.h"
#include <string.h>
#define BRIGHTNESS_VAL 3 //How much the Brightness is in/decreased for button shadows (3 -> Add 1/3 off Full Value)
void buttons_cb(void* touchArea, TOUCH_ACTION triggeredAction)
//Method shared between normal Buttons and Bitmap Buttons-> Look at comment in headerfile for explanation.
{
TOUCH_AREA_STRUCT * area = (TOUCH_AREA_STRUCT*)touchArea;
BUTTON_STRUCT* button = (BUTTON_STRUCT*)touchArea;
unsigned int c1,c2;
unsigned char r,g,b;
r=(button->bgcolor&0xF800)>>11;
g=(button->bgcolor&0x07E0)>>5;
b=(button->bgcolor&0x001F)>>0;
if((r + 0x1F/BRIGHTNESS_VAL) >0x1F)
c1=0xF800;
else
c1=(r+0x1F/BRIGHTNESS_VAL)<<11;
if((g + 0x3F/BRIGHTNESS_VAL) >0x3F)
c1|=0x07E0;
else
c1|=(g+0x3F/BRIGHTNESS_VAL)<<5;
if((b + 0x1F/BRIGHTNESS_VAL) >0x1F)
c1|=0x0018;
else
c1|=(b+0x1F/BRIGHTNESS_VAL)<<0;
if(r > (0x1F/BRIGHTNESS_VAL))
c2=(r-0x1F/BRIGHTNESS_VAL)<<11;
else
c2=0x0000;
if(g > (0x3F/BRIGHTNESS_VAL))
c2|=(g-0x3F/BRIGHTNESS_VAL)<<5;
if(b > (0x1F/BRIGHTNESS_VAL))
c2|=(b-0x1F/BRIGHTNESS_VAL)<<0;
switch(triggeredAction)
{
case PEN_DOWN:
area->hookedActions=PEN_UP|PEN_LEAVE;
tftDrawLine(button->base.x1+1,button->base.y1,button->base.x2-1,button->base.y1,c2); //Nord
tftDrawLine(button->base.x1,button->base.y1+1,button->base.x1,button->base.y2-1,c2);//West
tftDrawLine(button->base.x1+1,button->base.y2,button->base.x2-1,button->base.y2,c1); //S<>d
tftDrawLine(button->base.x2,button->base.y1+1,button->base.x2,button->base.y2-1,c1); //Ost
break;
case PEN_UP:
case PEN_LEAVE:
area->hookedActions=PEN_DOWN;
tftDrawLine(button->base.x1+1,button->base.y1,button->base.x2-1,button->base.y1,c1); //Nord
tftDrawLine(button->base.x1,button->base.y1+1,button->base.x1,button->base.y2-1,c1);//West
tftDrawLine(button->base.x1+1,button->base.y2,button->base.x2-1,button->base.y2,c2); //S<>d
tftDrawLine(button->base.x2,button->base.y1+1,button->base.x2,button->base.y2-1,c2); //Ost
if(triggeredAction==PEN_UP && button->callback!=NULL)
button->callback(button);
break;
default:break;
}
}
BOOL guiAddButton(BUTTON_STRUCT* button)//Registers a button (fill Struct first). Return FALSE if no more Space in the Pointertable (-->Change NUM_AREAS).
{
if(touchHaveEmpty(1))
{
unsigned int strwidth=FLASH_CHAR_ARR_READ(&button->font[0])*strlen(button->text);
unsigned char strheight=FLASH_CHAR_ARR_READ(&button->font[1]);
button->base.hookedActions=PEN_DOWN;
button->base.callback = buttons_cb;
if(button->base.x2==AUTO)
button->base.x2= button->base.x1 -1 + strwidth+(FLASH_CHAR_ARR_READ(&button->font[0])/2);
else if((button->base.x2-button->base.x1+1)<(strwidth+2))
return FALSE;
if(button->base.y2==AUTO)
button->base.y2=button->base.y1 -1 +strheight+(strheight/2);
else if((button->base.y2-button->base.y1+1)<(strheight+2))
return FALSE;
guiRedrawButton(button);
return touchRegisterArea(&button->base);
}
return FALSE;
}
void guiRedrawButton(BUTTON_STRUCT* button)
{
unsigned int strwidth=FLASH_CHAR_ARR_READ(&button->font[0])*strlen(button->text);
unsigned char strheight=FLASH_CHAR_ARR_READ(&button->font[1]);
unsigned char r,g,b;
unsigned int c;
r=(button->bgcolor&0xF800)>>11;
g=(button->bgcolor&0x07E0)>>5;
b=(button->bgcolor&0x001F)>>0;
tftFillRectangle(button->base.x1+1,button->base.y1+1,button->base.x2-1,button->base.y2-1,button->bgcolor);
if((r + 0x1F/BRIGHTNESS_VAL) >0x1F)
c=0xF800;
else
c=(r+0x1F/BRIGHTNESS_VAL)<<11;
if((g + 0x3F/BRIGHTNESS_VAL) >0x3F)
c|=0x07E0;
else
c|=(g+0x3F/BRIGHTNESS_VAL)<<5;
if((b + 0x1F/BRIGHTNESS_VAL) >0x1F)
c|=0x0018;
else
c|=(b+0x1F/BRIGHTNESS_VAL)<<0;
tftDrawLine(button->base.x1+1,button->base.y1,button->base.x2-1,button->base.y1,c); //Nord
tftDrawLine(button->base.x1,button->base.y1+1,button->base.x1,button->base.y2-1,c);//West
if(r > (0x1F/BRIGHTNESS_VAL))
c=(r-0x1F/BRIGHTNESS_VAL)<<11;
else
c=0x0000;
if(g > (0x3F/BRIGHTNESS_VAL))
c|=(g-0x3F/BRIGHTNESS_VAL)<<5;
if(b > (0x1F/BRIGHTNESS_VAL))
c|=(b-0x1F/BRIGHTNESS_VAL)<<0;
tftDrawLine(button->base.x1+1,button->base.y2,button->base.x2-1,button->base.y2,c); //S<>d
tftDrawLine(button->base.x2,button->base.y1+1,button->base.x2,button->base.y2-1,c); //Ost
tftPrint(button->base.x1+(button->base.x2-button->base.x1+1-strwidth)/2,button->base.y1+(button->base.y2-button->base.y1+1-strheight)/2,button->txtcolor,button->bgcolor,button->font,button->text);
}
void guiRemoveButton(BUTTON_STRUCT* button)
{
touchUnregisterArea((TOUCH_AREA_STRUCT*)button);
}
BOOL guiAddBitmapButton (BITMAPBUTTON_STRUCT* button)
{
if(touchHaveEmpty(1))
{
button->base.hookedActions=PEN_DOWN;
button->base.callback = buttons_cb;
if(button->base.x2==AUTO)
button->base.x2= button->base.x1 -1 + button->imgwidth + button->imgwidth/4;
else if((button->base.x2-button->base.x1+1)<(button->imgwidth+2))
return FALSE;
if(button->base.y2==AUTO)
button->base.y2=button->base.y1 -1 +button->imgheight + button->imgheight/4;
else if((button->base.y2-button->base.y1+1)<(button->imgheight+2))
return FALSE;
guiRedrawBitmapButton(button);
return touchRegisterArea(&button->base);
}
return FALSE;
}
void guiRedrawBitmapButton(BITMAPBUTTON_STRUCT* button)
{
unsigned char r,g,b;
unsigned int c;
r=(button->bgcolor&0xF800)>>11;
g=(button->bgcolor&0x07E0)>>5;
b=(button->bgcolor&0x001F)>>0;
tftFillRectangle(button->base.x1+1,button->base.y1+1,button->base.x2-1,button->base.y2-1,button->bgcolor);
if((r + 0x1F/BRIGHTNESS_VAL) >0x1F)
c=0xF800;
else
c=(r+0x1F/BRIGHTNESS_VAL)<<11;
if((g + 0x3F/BRIGHTNESS_VAL) >0x3F)
c|=0x07E0;
else
c|=(g+0x3F/BRIGHTNESS_VAL)<<5;
if((b + 0x1F/BRIGHTNESS_VAL) >0x1F)
c|=0x0018;
else
c|=(b+0x1F/BRIGHTNESS_VAL)<<0;
tftDrawLine(button->base.x1+1,button->base.y1,button->base.x2-1,button->base.y1,c); //Nord
tftDrawLine(button->base.x1,button->base.y1+1,button->base.x1,button->base.y2-1,c);//West
if(r > (0x1F/BRIGHTNESS_VAL))
c=(r-0x1F/BRIGHTNESS_VAL)<<11;
else
c=0x0000;
if(g > (0x3F/BRIGHTNESS_VAL))
c|=(g-0x3F/BRIGHTNESS_VAL)<<5;
if(b > (0x1F/BRIGHTNESS_VAL))
c|=(b-0x1F/BRIGHTNESS_VAL)<<0;
tftDrawLine(button->base.x1+1,button->base.y2,button->base.x2-1,button->base.y2,c); //S<>d
tftDrawLine(button->base.x2,button->base.y1+1,button->base.x2,button->base.y2-1,c); //Ost
tftDrawBitmapUnscaledStreamedRaw(button->base.x1+(button->base.x2-button->base.x1+1-button->imgwidth)/2,button->base.y1+(button->base.y2-button->base.y1+1-button->imgheight)/2,button->imgwidth,button->imgheight,button->filename);
}
void guiRemoveBitmapButton(BITMAPBUTTON_STRUCT* button)
{
touchUnregisterArea((TOUCH_AREA_STRUCT*)button);
}

32
src/Gui/button.h Normal file
View File

@@ -0,0 +1,32 @@
typedef void (*BUTTON_CALLBACK)(void *button); //!< Function pointer used...
typedef struct {
TOUCH_AREA_STRUCT base;
unsigned int bgcolor;
BUTTON_CALLBACK callback; //Callback
unsigned int txtcolor;
FLASH_CHAR_ARR_POINTER font;
char *text;
} BUTTON_STRUCT;
typedef struct {
TOUCH_AREA_STRUCT base;
unsigned int bgcolor;
BUTTON_CALLBACK callback; //Callback
unsigned char imgwidth;
unsigned char imgheight;
char* filename;
} BITMAPBUTTON_STRUCT;
//Notice that the first 3 Members are Equal, so it's possible to cast it to a BUTTON_STRUCT even if it's a BITMAPBUTTON_STRUCT (when changeing only the first 3 Members).
#define AUTO 0
extern BOOL guiAddButton(BUTTON_STRUCT* button);
extern void guiRemoveButton(BUTTON_STRUCT* button);
extern void guiRedrawButton(BUTTON_STRUCT* button);
extern BOOL guiAddBitmapButton(BITMAPBUTTON_STRUCT* button);
extern void guiRemoveBitmapButton(BITMAPBUTTON_STRUCT* button);
extern void guiRedrawBitmapButton(BITMAPBUTTON_STRUCT* button);

88
src/Gui/checkbox.c Normal file
View File

@@ -0,0 +1,88 @@
#include "../settings.h"
#include "../types.h"
#include "../tft/tft.h"
#include "../touch/touch.h"
#include "checkbox.h"
#define BRIGHTNESS_VAL 2 //How much the Brightness is in/decreased for checkbox shadows (3 -> Add 1/3 off Full Value)
#define ACTIVE_COLOR RGB(251,208,123)
#define BORDER_COLOR RGB(29,82,129)
#define BACKGROUND_COLOR WHITE
void checkboxes_cb(void* touchArea, TOUCH_ACTION triggeredAction)
{
TOUCH_AREA_STRUCT * area = (TOUCH_AREA_STRUCT*)touchArea;
CHECKBOX_STRUCT* checkbox = (CHECKBOX_STRUCT*)touchArea;
switch(triggeredAction)
{
case PEN_DOWN:
area->hookedActions=PEN_UP|PEN_LEAVE;
tftDrawRectangle(checkbox->base.x1+1,checkbox->base.y1+1,checkbox->base.x2-1,checkbox->base.y2-1,ACTIVE_COLOR);
tftDrawRectangle(checkbox->base.x1+2,checkbox->base.y1+2,checkbox->base.x2-2,checkbox->base.y2-2,ACTIVE_COLOR);
break;
case PEN_UP:
checkbox->checked=!checkbox->checked;
guiUpdateCheckbox(checkbox);
if(checkbox->callback!=NULL)
checkbox->callback(checkbox,checkbox->checked);
case PEN_LEAVE:
area->hookedActions=PEN_DOWN;
tftDrawRectangle(checkbox->base.x1+1,checkbox->base.y1+1,checkbox->base.x2-1,checkbox->base.y2-1,BACKGROUND_COLOR);
tftDrawRectangle(checkbox->base.x1+2,checkbox->base.y1+2,checkbox->base.x2-2,checkbox->base.y2-2,BACKGROUND_COLOR);
break;
default:break;
}
}
BOOL guiAddCheckbox(CHECKBOX_STRUCT* checkbox)
{
if(touchHaveEmpty(1))
{
unsigned char size=0;
checkbox->base.hookedActions=PEN_DOWN;
checkbox->base.callback = checkboxes_cb;
if(checkbox->base.x2>checkbox->base.x1)
size = checkbox->base.x2 - checkbox->base.x1;
if(checkbox->base.y2>checkbox->base.y1)
{
if((checkbox->base.y2 - checkbox->base.y1)>size)
size = checkbox->base.y2 - checkbox->base.y1;
}
if((size&0x01))
size++;
checkbox->base.x2 = checkbox->base.x1 + size;
checkbox->base.y2 = checkbox->base.y1 + size;
guiRedrawCheckbox(checkbox);
return touchRegisterArea(&checkbox->base);
}
return FALSE;
}
void guiRedrawCheckbox(CHECKBOX_STRUCT* checkbox)
{
tftFillRectangle(checkbox->base.x1+1,checkbox->base.y1+1,checkbox->base.x2-1,checkbox->base.y2-1,BACKGROUND_COLOR);
tftDrawRectangle(checkbox->base.x1,checkbox->base.y1,checkbox->base.x2,checkbox->base.y2,BORDER_COLOR);
if(checkbox->checked)
guiUpdateCheckbox(checkbox);
}
void guiRemoveCheckbox(CHECKBOX_STRUCT* checkbox)
{
touchUnregisterArea((TOUCH_AREA_STRUCT*)checkbox);
}
void guiUpdateCheckbox(CHECKBOX_STRUCT* checkbox)
{
unsigned int c = (checkbox->checked)? checkbox->fgcolor:BACKGROUND_COLOR;
unsigned int xcent = checkbox->base.x1+(checkbox->base.x2-checkbox->base.x1)*6/14;
unsigned int yleft = checkbox->base.y2 - (xcent- checkbox->base.x1) - 1 ;
unsigned int yright = checkbox->base.y2 - (checkbox->base.x2 - xcent) - 1 ;
unsigned int ybot = checkbox->base.y2 - 4;
tftDrawLine(checkbox->base.x1+3,yleft-1,xcent,ybot -1,c);
tftDrawLine(checkbox->base.x1+3,yleft,xcent,ybot ,c);
tftDrawLine(checkbox->base.x1+3,yleft+1,xcent,ybot + 1,c);
xcent++;
ybot--;
tftDrawLine(xcent,ybot-1,checkbox->base.x2-3,yright-1,c);
tftDrawLine(xcent,ybot,checkbox->base.x2-3,yright+0,c);
tftDrawLine(xcent,ybot+1,checkbox->base.x2-3,yright+1,c);
}

15
src/Gui/checkbox.h Normal file
View File

@@ -0,0 +1,15 @@
typedef void (*CHECKBOX_CALLBACK)(void *checkbox, BOOL checked); //!< Function pointer used...
typedef struct {
TOUCH_AREA_STRUCT base;
unsigned int fgcolor;
BOOL checked;
CHECKBOX_CALLBACK callback; //Callback
} CHECKBOX_STRUCT;
extern BOOL guiAddCheckbox(CHECKBOX_STRUCT* checkbox);
extern void guiRemoveCheckbox(CHECKBOX_STRUCT* checkbox);
extern void guiUpdateCheckbox(CHECKBOX_STRUCT* checkbox);
extern void guiRedrawCheckbox(CHECKBOX_STRUCT* checkbox);
#define CHECKBOX_WIN_FG_COLOR RGB(32,161,34)

95
src/Gui/numupdown.c Normal file
View File

@@ -0,0 +1,95 @@
//
//
// SUPPORT DISCONTINUED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//
//
//
#include "../settings.h"
#include "../types.h"
#include "../tft/tft.h"
#include "../touch/touch.h"
#include "button.h"
#include "numupdown.h"
#define BASE_COLOR RGB(90,90,90)
void button_up_cb(void* button)
{
}
void button_down_cb(void* button)
{
}
BOOL guiAddNumUpDown(NUMUPDOWN_STRUCT* numupdown)
{
if(touchHaveEmpty(2)) //We require 2 TouchAreas (for Buttons)
{
unsigned char width =31;
if(numupdown->max>=10) width+=16;
else if(numupdown->max>=100) width+=16*2;
numupdown->buttonUp.base.x1=numupdown->x;
numupdown->buttonUp.base.y1=numupdown->y;
numupdown->buttonUp.base.x2=numupdown->x+width;
numupdown->buttonUp.base.y2=AUTO;
numupdown->buttonUp.text="+";
numupdown->buttonUp.font=BigFont;
numupdown->buttonUp.bgcolor=BASE_COLOR;
numupdown->buttonUp.txtcolor=WHITE;
numupdown->buttonUp.callback = button_up_cb;
guiAddButton(&numupdown->buttonUp);
numupdown->buttonDown.base.x1=numupdown->x;
numupdown->buttonDown.base.y1=numupdown->buttonUp.base.y2+31;
numupdown->buttonDown.base.x2=numupdown->x+width;
numupdown->buttonDown.base.y2=AUTO;
numupdown->buttonDown.text="-";
numupdown->buttonDown.font=BigFont;
numupdown->buttonDown.bgcolor=BASE_COLOR;
numupdown->buttonDown.txtcolor=WHITE;
numupdown->buttonDown.callback = button_down_cb;
guiAddButton(&numupdown->buttonDown);
tftFillRectangle(numupdown->x,numupdown->buttonUp.base.y2+1,numupdown->x+width,numupdown->buttonDown.base.y1-1,BASE_COLOR);
tftPrintf_P(numupdown->x,numupdown->buttonUp.base.y2+7,numupdown->fgcolor,BASE_COLOR,BigFont,PSTR("%03u"),numupdown->value);
}
return FALSE;
/*if(touchHaveEmptyAreaPlace())
{
unsigned char size=0;
checkbox->base.hookedActions=PEN_DOWN;
checkbox->base.callback = checkboxes_cb;
if(checkbox->base.x2>checkbox->base.x1)
size = checkbox->base.x2 - checkbox->base.x1;
if(checkbox->base.y2>checkbox->base.y1)
{
if((checkbox->base.y2 - checkbox->base.y1)>size)
size = checkbox->base.y2 - checkbox->base.y1;
}
if((size&0x01))
size++;
checkbox->base.x2 = checkbox->base.x1 + size;
checkbox->base.y2 = checkbox->base.y1 + size;
size/=DISTANCE_BORDER;
tftFillRectangle(checkbox->base.x1+1,checkbox->base.y1+1,checkbox->base.x2-1,checkbox->base.y2-1,BACKGROUND_COLOR);
tftDrawRectangle(checkbox->base.x1,checkbox->base.y1,checkbox->base.x2,checkbox->base.y2,BORDER_COLOR);
if(checkbox->checked)
guiUpdateCheckbox(checkbox);
return touchRegisterArea(&checkbox->base);
}
return FALSE;*/
}
void guiRemoveNumUpDown(NUMUPDOWN_STRUCT* numupdown)
{
guiRemoveButton(&numupdown->buttonUp);
guiRemoveButton(&numupdown->buttonDown);
}
void guiUpdateNumUpDown(NUMUPDOWN_STRUCT* numupdown)
{
tftPrintf_P(numupdown->x,numupdown->buttonUp.base.y2+7,numupdown->fgcolor,BASE_COLOR,BigFont,PSTR("%03u"),numupdown->value);
}
void guiRedrawNumUpDown(NUMUPDOWN_STRUCT* numupdown)
{
}

24
src/Gui/numupdown.h Normal file
View File

@@ -0,0 +1,24 @@
//
//
// SUPPORT DISCONTINUED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//
//
//
typedef void (*NUMUPDOWN_CALLBACK)(void *numupdown, unsigned char value); //!< Function pointer used...
typedef struct {
unsigned int x;
unsigned int y;
unsigned int fgcolor;
unsigned char value;
unsigned char min;
unsigned char max;
NUMUPDOWN_CALLBACK callback; //Callback
BUTTON_STRUCT buttonUp;
BUTTON_STRUCT buttonDown;
} NUMUPDOWN_STRUCT;
extern BOOL guiAddNumUpDown(NUMUPDOWN_STRUCT* numupdown);
extern void guiRemoveNumUpDown(NUMUPDOWN_STRUCT* numupdown);
extern void guiUpdateNumUpDown(NUMUPDOWN_STRUCT* numupdown);
extern void guiRedrawNumUpDown(NUMUPDOWN_STRUCT* numupdown);

168
src/Gui/softinput.c Normal file
View File

@@ -0,0 +1,168 @@
#include "../settings.h"
#include "../types.h"
#include "../tft/tft.h"
#include "../touch/touch.h"
#include "softinput.h"
#include <stdlib.h>
#define C1 HEX(0xCCCC99)
#define C2 HEX(0x6A6A5A)
#define C3 HEX(0x013366)
#define C4 WHITE
char * allnums [] ={
"1","2","3","4","5","6","7","8","9","0","",
""
};
char * allmonth []={
"Jan","Feb","M<EFBFBD>r","Apr","Mai","Jun","",
"Jul","Aug","Sep","Okt","Nov","Dez","",
""};
TOUCH_AREA_STRUCT* softkey_touchareas;
SOFTINPUT_CALLBACK user_cb;
char ** user_buf;
void softkeys_cb(void* touchArea, TOUCH_ACTION triggeredAction)
{
TOUCH_AREA_STRUCT* area = (TOUCH_AREA_STRUCT*) touchArea;
switch(triggeredAction)
{
case PEN_DOWN:
area->hookedActions=PEN_UP|PEN_LEAVE;
tftDrawLine(area->x1,area->y1,area->x2,area->y1,C2); //Nord
tftDrawLine(area->x1,area->y1,area->x1,area->y2,C2);//West
tftDrawLine(area->x1,area->y2,area->x2,area->y2,C1); //S<>d
tftDrawLine(area->x2,area->y1,area->x2,area->y2,C1); //Ost
break;
case PEN_UP:
{
unsigned char unspaced=((unsigned int)area-(unsigned int)softkey_touchareas)/sizeof(TOUCH_AREA_STRUCT);
unsigned char spaced=0xFF;
unsigned char i=0;
while(i++<=unspaced )
{
if(user_buf[++spaced][0]==0)
spaced++;
}
user_cb( user_buf, unspaced,spaced);
}
case PEN_LEAVE:
area->hookedActions=PEN_DOWN;
tftDrawLine(area->x1,area->y1,area->x2,area->y1,C1); //Nord
tftDrawLine(area->x1,area->y1,area->x1,area->y2,C1);//West
tftDrawLine(area->x1,area->y2,area->x2,area->y2,C2); //S<>d
tftDrawLine(area->x2,area->y1,area->x2,area->y2,C2); //Ost
break;
default:break;
}
}
void guiAddSoftInput(char ** arr,unsigned char h, SOFTINPUT_CALLBACK cb)
{
unsigned char elem_x=0;
unsigned char elem_y=0;
unsigned char cnt=0;
unsigned char cnt_x=0;
while(1)
{
if(arr[cnt][0]==0)
{
if(cnt_x==0)
break;
if(cnt_x>elem_x)
elem_x=cnt_x;
cnt_x=0;
elem_y++;
}
else
cnt_x++;
cnt++;
}
cnt-=elem_y;
elem_x++;
elem_y++;
softkey_touchareas = malloc(sizeof(TOUCH_AREA_STRUCT)*cnt);
user_cb = cb;
user_buf=arr;
if(h==AUTO)
h= 20 * elem_y;
unsigned int y = DHEIGHT-h;
unsigned char width = WIDTH/elem_x;
unsigned char wspace = (width)/elem_x;
unsigned char height = h/elem_y;
unsigned char hspace = (height)/ elem_y;
unsigned char hstart = y+1+hspace;
tftDrawLine(0,y,DWIDTH,y,C3);
tftFillRectangle(0,y+1,DWIDTH,DHEIGHT,C4);
cnt=0;
unsigned char cnt_txt=0;
unsigned char cnt_areas=0;
for(unsigned char cnt_y=0; cnt_y<(elem_y-1); cnt_y++)
{
unsigned char elem_row=0;
while(arr[cnt++][0]!=0)
elem_row++;
unsigned char spaceleft=(WIDTH-elem_row*width-(elem_row-1)*wspace)/2;
for(cnt_x=0; cnt_x<elem_row; cnt_x++)
{
unsigned int x1 = spaceleft+cnt_x*(width+wspace);
unsigned char y1 = hstart+cnt_y*(height+hspace);
unsigned int x2 = x1+width;
unsigned char y2= y1+height;
tftPrint((width-tftPrintCalcWidth(BigFont,arr[cnt_txt]))/2+x1,(height-tftPrintCalcHeight(BigFont))/2+y1,C3,C4,BigFont,arr[cnt_txt]);
tftDrawLine(x1,y1,x2,y1,C1); //Nord
tftDrawLine(x1,y1,x1,y2,C1);//West
tftDrawLine(x1,y2,x2,y2,C2); //S<>d
tftDrawLine(x2,y1,x2,y2,C2); //Ost
softkey_touchareas[cnt_areas].x1=x1;
softkey_touchareas[cnt_areas].y1=y1;
softkey_touchareas[cnt_areas].x2=x2;
softkey_touchareas[cnt_areas].y2=y2;
softkey_touchareas[cnt_areas].hookedActions=PEN_DOWN;
softkey_touchareas[cnt_areas].callback = softkeys_cb;
touchRegisterArea(&softkey_touchareas[cnt_areas]);
cnt_txt++;
cnt_areas++;
}
cnt_txt++;
}
}
void guiRemoveSoftInput()
{
unsigned char cnt=0;
unsigned char cnt_area=0;
while(1)
{
if(user_buf[cnt][0]!=0) touchUnregisterArea(&softkey_touchareas[cnt_area++]);
else if(user_buf[cnt+1][0]==0) break;
cnt++;
}
free((void*)softkey_touchareas);
}
void guiUpdateSoftInput()
{
unsigned char cnt=0;
unsigned char cnt_area=0;
while(1)
{
if(user_buf[cnt][0]!=0)
{
unsigned int x1 = softkey_touchareas[cnt_area].x1;
unsigned char y1 = softkey_touchareas[cnt_area].y1;
unsigned int x2 = softkey_touchareas[cnt_area].x2;
unsigned char y2= softkey_touchareas[cnt_area].y2;
tftPrint(((x2-x1)-tftPrintCalcWidth(BigFont,user_buf[cnt]))/2+x1,((y2-y1)-tftPrintCalcHeight(BigFont))/2+y1,C3,C4,BigFont,user_buf[cnt]);
cnt_area++;
}
else if(user_buf[cnt+1][0]==0) break;
cnt++;
}
}

10
src/Gui/softinput.h Normal file
View File

@@ -0,0 +1,10 @@
//Arr = ref to String Array, ind_nospace = Index of touched String without empty strings, ind_spaced = real index
typedef void (*SOFTINPUT_CALLBACK)(char ** arr, unsigned char ind_nospace,unsigned char ind_spaced);
extern void guiAddSoftInput(char ** arr, unsigned char h, SOFTINPUT_CALLBACK cb);
extern void guiRemoveSoftInput();
extern void guiUpdateSoftInput();
#define AUTO 0
extern char * allnums [12];
extern char * allmonth [15];

41
src/SD/diskio.h Normal file
View File

@@ -0,0 +1,41 @@
/*-----------------------------------------------------------------------
/ PFF - Low level disk interface modlue include file (C)ChaN, 2009
/-----------------------------------------------------------------------*/
#ifndef _DISKIO
#include "../types.h"
/* Status of Disk Functions */
typedef BYTE DSTATUS;
/* Results of Disk Functions */
typedef enum {
RES_OK = 0, /* 0: Function succeeded */
RES_ERROR, /* 1: Disk error */
RES_NOTRDY, /* 2: Not ready */
RES_PARERR /* 3: Invalid parameter */
} DRESULT;
/*---------------------------------------*/
/* Prototypes for disk control functions */
DSTATUS disk_initialize (void);
DRESULT disk_readp (BYTE*, DWORD, WORD, WORD);
DRESULT disk_writep (const BYTE*, DWORD);
#define STA_NOINIT 0x01 /* Drive not initialized */
#define STA_NODISK 0x02 /* No medium in the drive */
/* Card type flags (CardType) */
#define CT_MMC 0x01 /* MMC ver 3 */
#define CT_SD1 0x02 /* SD ver 1 */
#define CT_SD2 0x04 /* SD ver 2 */
#define CT_SDC (CT_SD1|CT_SD2) /* SD */
#define CT_BLOCK 0x08 /* Block addressing */
#define _DISKIO
#endif

305
src/SD/mmc.c Normal file
View File

@@ -0,0 +1,305 @@
/*-------------------------------------------------------------------------*/
/* PFF - Low level disk control module for AVR (C)ChaN, 2010 */
/*-------------------------------------------------------------------------*/
#include "pff.h"
#include "diskio.h"
#include "../settings.h"
/*-------------------------------------------------------------------------*/
/* Platform dependent macros and functions needed to be modified */
/*-------------------------------------------------------------------------*/
#include <avr/io.h> /* Device include file */
#include <util/delay.h>
//#include "suart.h"
//#define SELECT() PORTD.OUT &= ~_BV(0) /* CS = L */
//#define DESELECT() PORTD.OUT |= _BV(0) /* CS = H */
//#define MMC_SEL !(PORTD.OUT & _BV(0)) /* CS status (true:CS == L) */
#define SELECT() PORTC.OUTCLR = 0x40
#define DESELECT() PORTC.OUTSET = 0x40
#define MMC_SEL !(PORTC.OUT & 0x40)
//#define FORWARD(d) xmit(d) /* Data forwarding function (Console out in this example) */
//unsigned char Dat_ready=0;
void init_spi (void)/* Initialize SPI port (usi.S) */
{
USARTD0.BAUDCTRLA = 100;
//USARTD0.BAUDCTRLB = 0x00;
//USARTD0.CTRLA = USART_RXCINTLVL0_bm; //kein Interrupt Enabled
USARTD0.CTRLB |= USART_RXEN_bm | USART_TXEN_bm; //Receive Enable, Transmit Enable
USARTD0.CTRLC |= USART_CMODE_MSPI_gc; //Master SPI Mode
USARTD0.CTRLC &= ~(0x02); //UCPHA bit l<>schen
//PORTD.PIN1CTRL |= PORT_INVEN_bm; //SCK invertieren
PORTC.DIRSET = 0x40; //CS
PORTD.DIRSET = 0x02 | 0x08; //SCK und TX
//PORTD.OUTSET = 0x0F;
PORTD.DIRCLR = 0x04; //zur Sicherheit das RX als Eingang ist
PORTD.PIN2CTRL = PORT_OPC_PULLUP_gc;
}
void dly_100us (void) /* Delay 100 microseconds (usi.S) */
{
_delay_us(100);
}
void xmit_spi (BYTE d) /* Send a byte to the MMC (usi.S) */
{
while(!(USARTD0.STATUS & USART_DREIF_bm));
USARTD0.DATA = d;
}
BYTE rcv_spi (void) /* Send a 0xFF to the MMC and get the received byte (usi.S) */
{
USARTD0.DATA = 0xFF;
while (!(USARTD0.STATUS & USART_RXCIF_bm));
return USARTD0.DATA;
}
/*--------------------------------------------------------------------------
Module Private Functions
---------------------------------------------------------------------------*/
/* Definitions for MMC/SDC command */
#define CMD0 (0x40+0) /* GO_IDLE_STATE */
#define CMD1 (0x40+1) /* SEND_OP_COND (MMC) */
#define ACMD41 (0xC0+41) /* SEND_OP_COND (SDC) */
#define CMD8 (0x40+8) /* SEND_IF_COND */
#define CMD16 (0x40+16) /* SET_BLOCKLEN */
#define CMD17 (0x40+17) /* READ_SINGLE_BLOCK */
#define CMD24 (0x40+24) /* WRITE_BLOCK */
#define CMD55 (0x40+55) /* APP_CMD */
#define CMD58 (0x40+58) /* READ_OCR */
/* Card type flags (CardType) */
#define CT_MMC 0x01 /* MMC ver 3 */
#define CT_SD1 0x02 /* SD ver 1 */
#define CT_SD2 0x04 /* SD ver 2 */
#define CT_BLOCK 0x08 /* Block addressing */
static
BYTE CardType;
/*-----------------------------------------------------------------------*/
/* Send a command packet to MMC */
/*-----------------------------------------------------------------------*/
static
BYTE send_cmd (
BYTE cmd, /* 1st byte (Start + Index) */
DWORD arg /* Argument (32 bits) */
)
{
BYTE n, res;
if (cmd & 0x80) { /* ACMD<n> is the command sequense of CMD55-CMD<n> */
cmd &= 0x7F;
res = send_cmd(CMD55, 0);
if (res > 1) return res;
}
/* Select the card */
DESELECT();
rcv_spi();
SELECT();
rcv_spi();
/* Send a command packet */
xmit_spi(cmd); /* Start + Command index */
xmit_spi((BYTE)(arg >> 24)); /* Argument[31..24] */
xmit_spi((BYTE)(arg >> 16)); /* Argument[23..16] */
xmit_spi((BYTE)(arg >> 8)); /* Argument[15..8] */
xmit_spi((BYTE)arg); /* Argument[7..0] */
n = 0x01; /* Dummy CRC + Stop */
if (cmd == CMD0) n = 0x95; /* Valid CRC for CMD0(0) */
if (cmd == CMD8) n = 0x87; /* Valid CRC for CMD8(0x1AA) */
xmit_spi(n);
/* Receive a command response */
n = 10; /* Wait for a valid response in timeout of 10 attempts */
do {
res = rcv_spi();
} while ((res & 0x80) && --n);
return res; /* Return with the response value */
}
/*--------------------------------------------------------------------------
Public Functions
---------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------*/
/* Initialize Disk Drive */
/*-----------------------------------------------------------------------*/
DSTATUS disk_initialize (void)
{
BYTE n, cmd, ty, ocr[4];
UINT tmr;
#if _USE_WRITE
if (CardType && MMC_SEL) disk_writep(0, 0); /* Finalize write process if it is in progress */
#endif
init_spi(); /* Initialize ports to control MMC */
DESELECT();
for (n = 10; n; n--) rcv_spi(); /* 80 dummy clocks with CS=H */
ty = 0;
if (send_cmd(CMD0, 0) == 1) { /* Enter Idle state */
if (send_cmd(CMD8, 0x1AA) == 1) { /* SDv2 */
for (n = 0; n < 4; n++) ocr[n] = rcv_spi(); /* Get trailing return value of R7 resp */
if (ocr[2] == 0x01 && ocr[3] == 0xAA) { /* The card can work at vdd range of 2.7-3.6V */
for (tmr = 10000; tmr && send_cmd(ACMD41, 1UL << 30); tmr--) dly_100us(); /* Wait for leaving idle state (ACMD41 with HCS bit) */
if (tmr && send_cmd(CMD58, 0) == 0) { /* Check CCS bit in the OCR */
for (n = 0; n < 4; n++) ocr[n] = rcv_spi();
ty = (ocr[0] & 0x40) ? CT_SD2 | CT_BLOCK : CT_SD2; /* SDv2 (HC or SC) */
}
}
} else { /* SDv1 or MMCv3 */
if (send_cmd(ACMD41, 0) <= 1) {
ty = CT_SD1; cmd = ACMD41; /* SDv1 */
} else {
ty = CT_MMC; cmd = CMD1; /* MMCv3 */
}
for (tmr = 10000; tmr && send_cmd(cmd, 0); tmr--) dly_100us(); /* Wait for leaving idle state */
if (!tmr || send_cmd(CMD16, 512) != 0) /* Set R/W block length to 512 */
ty = 0;
}
}
CardType = ty;
DESELECT();
rcv_spi();
return ty ? 0 : STA_NOINIT;
}
/*-----------------------------------------------------------------------*/
/* Read partial sector */
/*-----------------------------------------------------------------------*/
DRESULT disk_readp (
BYTE *buff, /* Pointer to the read buffer (NULL:Read bytes are forwarded to the stream) */
DWORD lba, /* Sector number (LBA) */
WORD ofs, /* Byte offset to read from (0..511) */
WORD cnt /* Number of bytes to read (ofs + cnt mus be <= 512) */
)
{
DRESULT res;
BYTE rc;
WORD bc;
//if(buff==0) return RES_PARERR;
if (!(CardType & CT_BLOCK)) lba *= 512; /* Convert to byte address if needed */
res = RES_ERROR;
if (send_cmd(CMD17, lba) == 0) { /* READ_SINGLE_BLOCK */
bc = 40000;
do { /* Wait for data packet */
rc = rcv_spi();
} while (rc == 0xFF && --bc);
if (rc == 0xFE) { /* A data packet arrived */
bc = 514 - ofs - cnt;
/* Skip leading bytes */
if (ofs) {
do rcv_spi(); while (--ofs);
}
/* Receive a part of the sector */
if (buff) { /* Store data to the memory */
do {
*buff++ = rcv_spi();
} while (--cnt);
} else
{ //Forward data to the outgoing stream (depends on the project)
while(cnt)
{
DATAPORT_HIGH(rcv_spi());
DATAPORT_LOW(rcv_spi());
CLEAR_WR;
SET_WR;
cnt-=2;
}
}
/* Skip trailing bytes and CRC */
do rcv_spi(); while (--bc);
res = RES_OK;
}
}
DESELECT();
rcv_spi();
return res;
}
/*-----------------------------------------------------------------------*/
/* Write partial sector */
/*-----------------------------------------------------------------------*/
#if _USE_WRITE
DRESULT disk_writep (
const BYTE *buff, /* Pointer to the bytes to be written (NULL:Initiate/Finalize sector write) */
DWORD sa /* Number of bytes to send, Sector number (LBA) or zero */
)
{
DRESULT res;
WORD bc;
static WORD wc;
res = RES_ERROR;
if (buff) { /* Send data bytes */
bc = (WORD)sa;
while (bc && wc) { /* Send data bytes to the card */
xmit_spi(*buff++);
wc--; bc--;
}
res = RES_OK;
} else {
if (sa) { /* Initiate sector write process */
if (!(CardType & CT_BLOCK)) sa *= 512; /* Convert to byte address if needed */
if (send_cmd(CMD24, sa) == 0) { /* WRITE_SINGLE_BLOCK */
xmit_spi(0xFF); xmit_spi(0xFE); /* Data block header */
wc = 512; /* Set byte counter */
res = RES_OK;
}
} else { /* Finalize sector write process */
bc = wc + 2;
while (bc--) xmit_spi(0); /* Fill left bytes and CRC with zeros */
if ((rcv_spi() & 0x1F) == 0x05) { /* Receive data resp and wait for end of write process in timeout of 500ms */
for (bc = 5000; rcv_spi() != 0xFF && bc; bc--) dly_100us(); /* Wait ready */
if (bc) res = RES_OK;
}
DESELECT();
rcv_spi();
}
}
return res;
}
#endif

1114
src/SD/pff.c Normal file

File diff suppressed because it is too large Load Diff

192
src/SD/pff.h Normal file
View File

@@ -0,0 +1,192 @@
/*---------------------------------------------------------------------------/
/ Petit FatFs - FAT file system module include file R0.02a (C)ChaN, 2010
/----------------------------------------------------------------------------/
/ Petit FatFs module is an open source software to implement FAT file system to
/ small embedded systems. This is a free software and is opened for education,
/ research and commercial developments under license policy of following trems.
/
/ Copyright (C) 2010, ChaN, all right reserved.
/
/ * The Petit FatFs module is a free software and there is NO WARRANTY.
/ * No restriction on use. You can use, modify and redistribute it for
/ personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY.
/ * Redistributions of source code must retain the above copyright notice.
/
/----------------------------------------------------------------------------*/
#include "../types.h"
/*---------------------------------------------------------------------------/
/ Petit FatFs Configuration Options
/
/ CAUTION! Do not forget to make clean the project after any changes to
/ the configuration options.
/
/----------------------------------------------------------------------------*/
#ifndef _FATFS
#define _FATFS
#define _USE_READ 1 /* 1:Enable pf_read() */
#define _USE_DIR 1 /* 1:Enable pf_opendir() and pf_readdir() */
#define _USE_LSEEK 1 /* 1:Enable pf_lseek() */
#define _USE_WRITE 1 /* 1:Enable pf_write() */
#define _FS_FAT12 1 /* 1:Enable FAT12 support */
#define _FS_FAT32 1 /* 1:Enable FAT32 support */
#define _CODE_PAGE 1
/* Defines which code page is used for path name. Supported code pages are:
/ 932, 936, 949, 950, 437, 720, 737, 775, 850, 852, 855, 857, 858, 862, 866,
/ 874, 1250, 1251, 1252, 1253, 1254, 1255, 1257, 1258 and 1 (ASCII only).
/ SBCS code pages except for 1 requiers a case conversion table. This
/ might occupy 128 bytes on the RAM on some platforms, e.g. avr-gcc. */
#define _WORD_ACCESS 1
/* The _WORD_ACCESS option defines which access method is used to the word
/ data in the FAT structure.
/
/ 0: Byte-by-byte access. Always compatible with all platforms.
/ 1: Word access. Do not choose this unless following condition is met.
/
/ When the byte order on the memory is big-endian or address miss-aligned
/ word access results incorrect behavior, the _WORD_ACCESS must be set to 0.
/ If it is not the case, the value can also be set to 1 to improve the
/ performance and code efficiency. */
/* End of configuration options. Do not change followings without care. */
/*--------------------------------------------------------------------------*/
#if _FS_FAT32
#define CLUST DWORD
#else
#define CLUST WORD
#endif
/* File system object structure */
typedef struct {
BYTE fs_type; /* FAT sub type */
BYTE flag; /* File status flags */
BYTE csize; /* Number of sectors per cluster */
BYTE pad1;
WORD n_rootdir; /* Number of root directory entries (0 on FAT32) */
CLUST n_fatent; /* Number of FAT entries (= number of clusters + 2) */
DWORD fatbase; /* FAT start sector */
DWORD dirbase; /* Root directory start sector (Cluster# on FAT32) */
DWORD database; /* Data start sector */
DWORD fptr; /* File R/W pointer */
DWORD fsize; /* File size */
CLUST org_clust; /* File start cluster */
CLUST curr_clust; /* File current cluster */
DWORD dsect; /* File current data sector */
} FATFS;
/* Directory object structure */
typedef struct {
WORD index; /* Current read/write index number */
BYTE* fn; /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */
CLUST sclust; /* Table start cluster (0:Static table) */
CLUST clust; /* Current cluster */
DWORD sect; /* Current sector */
} DIR;
/* File status structure */
typedef struct {
DWORD fsize; /* File size */
WORD fdate; /* Last modified date */
WORD ftime; /* Last modified time */
BYTE fattrib; /* Attribute */
char fname[13]; /* File name */
} FILINFO;
/* File function return code (FRESULT) */
typedef enum {
FR_OK = 0, /* 0 */
FR_DISK_ERR, /* 1 */
FR_NOT_READY, /* 2 */
FR_NO_FILE, /* 3 */
FR_NO_PATH, /* 4 */
FR_NOT_OPENED, /* 5 */
FR_NOT_ENABLED, /* 6 */
FR_NO_FILESYSTEM /* 7 */
} FRESULT;
/*--------------------------------------------------------------*/
/* Petit FatFs module application interface */
FRESULT pf_mount (FATFS*); /* Mount/Unmount a logical drive */
FRESULT pf_open (const char*); /* Open a file */
FRESULT pf_read (void*, WORD, WORD*); /* Read data from the open file */
FRESULT pf_write (const void*, WORD, WORD*); /* Write data to the open file */
FRESULT pf_lseek (DWORD); /* Move file pointer of the open file */
FRESULT pf_opendir (DIR*, const char*); /* Open a directory */
FRESULT pf_readdir (DIR*, FILINFO*); /* Read a directory item from the open directory */
/*--------------------------------------------------------------*/
/* Flags and offset address */
/* File status flag (FATFS.flag) */
#define FA_OPENED 0x01
#define FA_WPRT 0x02
#define FA__WIP 0x40
/* FAT sub type (FATFS.fs_type) */
#define FS_FAT12 1
#define FS_FAT16 2
#define FS_FAT32 3
/* File attribute bits for directory entry */
#define AM_RDO 0x01 /* Read only */
#define AM_HID 0x02 /* Hidden */
#define AM_SYS 0x04 /* System */
#define AM_VOL 0x08 /* Volume label */
#define AM_LFN 0x0F /* LFN entry */
#define AM_DIR 0x10 /* Directory */
#define AM_ARC 0x20 /* Archive */
#define AM_MASK 0x3F /* Mask of defined bits */
/*--------------------------------*/
/* Multi-byte word access macros */
#if _WORD_ACCESS == 1 /* Enable word access to the FAT structure */
#define LD_WORD(ptr) (WORD)(*(WORD*)(BYTE*)(ptr))
#define LD_DWORD(ptr) (DWORD)(*(DWORD*)(BYTE*)(ptr))
#define ST_WORD(ptr,val) *(WORD*)(BYTE*)(ptr)=(WORD)(val)
#define ST_DWORD(ptr,val) *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
#else /* Use byte-by-byte access to the FAT structure */
#define LD_WORD(ptr) (WORD)(((WORD)*((BYTE*)(ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
#define LD_DWORD(ptr) (DWORD)(((DWORD)*((BYTE*)(ptr)+3)<<24)|((DWORD)*((BYTE*)(ptr)+2)<<16)|((WORD)*((BYTE*)(ptr)+1)<<8)|*(BYTE*)(ptr))
#define ST_WORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8)
#define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8); *((BYTE*)(ptr)+2)=(BYTE)((DWORD)(val)>>16); *((BYTE*)(ptr)+3)=(BYTE)((DWORD)(val)>>24)
#endif
#endif /* _FATFS */

246
src/Tft/fonts.c Normal file
View File

@@ -0,0 +1,246 @@
#include "../settings.h"
// SmallFont.c
// Font Size : 8x12
// Memory usage : 1216 bytes
// # characters : 101
FLASH_CHAR_ARR(SmallFont,1216) ={
0x08,0x0C,0x20,0x65,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // <Space>
0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, // !
0x00,0x28,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // "
0x00,0x00,0x28,0x28,0xFC,0x28,0x50,0xFC,0x50,0x50,0x00,0x00, // #
0x00,0x20,0x78,0xA8,0xA0,0x60,0x30,0x28,0xA8,0xF0,0x20,0x00, // $
0x00,0x00,0x48,0xA8,0xB0,0x50,0x28,0x34,0x54,0x48,0x00,0x00, // %
0x00,0x00,0x20,0x50,0x50,0x78,0xA8,0xA8,0x90,0x6C,0x00,0x00, // &
0x00,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // '
0x00,0x04,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x04,0x00, // (
0x00,0x40,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x40,0x00, // )
0x00,0x00,0x00,0x20,0xA8,0x70,0x70,0xA8,0x20,0x00,0x00,0x00, // *
0x00,0x00,0x20,0x20,0x20,0xF8,0x20,0x20,0x20,0x00,0x00,0x00, // +
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x80, // ,
0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, // -
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00, // .
0x00,0x08,0x10,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x80,0x00, // /
0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, // 0
0x00,0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, // 1
0x00,0x00,0x70,0x88,0x88,0x10,0x20,0x40,0x80,0xF8,0x00,0x00, // 2
0x00,0x00,0x70,0x88,0x08,0x30,0x08,0x08,0x88,0x70,0x00,0x00, // 3
0x00,0x00,0x10,0x30,0x50,0x50,0x90,0x78,0x10,0x18,0x00,0x00, // 4
0x00,0x00,0xF8,0x80,0x80,0xF0,0x08,0x08,0x88,0x70,0x00,0x00, // 5
0x00,0x00,0x70,0x90,0x80,0xF0,0x88,0x88,0x88,0x70,0x00,0x00, // 6
0x00,0x00,0xF8,0x90,0x10,0x20,0x20,0x20,0x20,0x20,0x00,0x00, // 7
0x00,0x00,0x70,0x88,0x88,0x70,0x88,0x88,0x88,0x70,0x00,0x00, // 8
0x00,0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x48,0x70,0x00,0x00, // 9
0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x20,0x00,0x00, // :
0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x20,0x00, // ;
0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00, // <
0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0xF8,0x00,0x00,0x00,0x00, // =
0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00, // >
0x00,0x00,0x70,0x88,0x88,0x10,0x20,0x20,0x00,0x20,0x00,0x00, // ?
0x00,0x00,0x70,0x88,0x98,0xA8,0xA8,0xB8,0x80,0x78,0x00,0x00, // @
0x00,0x00,0x20,0x20,0x30,0x50,0x50,0x78,0x48,0xCC,0x00,0x00, // A
0x00,0x00,0xF0,0x48,0x48,0x70,0x48,0x48,0x48,0xF0,0x00,0x00, // B
0x00,0x00,0x78,0x88,0x80,0x80,0x80,0x80,0x88,0x70,0x00,0x00, // C
0x00,0x00,0xF0,0x48,0x48,0x48,0x48,0x48,0x48,0xF0,0x00,0x00, // D
0x00,0x00,0xF8,0x48,0x50,0x70,0x50,0x40,0x48,0xF8,0x00,0x00, // E
0x00,0x00,0xF8,0x48,0x50,0x70,0x50,0x40,0x40,0xE0,0x00,0x00, // F
0x00,0x00,0x38,0x48,0x80,0x80,0x9C,0x88,0x48,0x30,0x00,0x00, // G
0x00,0x00,0xCC,0x48,0x48,0x78,0x48,0x48,0x48,0xCC,0x00,0x00, // H
0x00,0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0xF8,0x00,0x00, // I
0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0xE0,0x00, // J
0x00,0x00,0xEC,0x48,0x50,0x60,0x50,0x50,0x48,0xEC,0x00,0x00, // K
0x00,0x00,0xE0,0x40,0x40,0x40,0x40,0x40,0x44,0xFC,0x00,0x00, // L
0x00,0x00,0xD8,0xD8,0xD8,0xD8,0xA8,0xA8,0xA8,0xA8,0x00,0x00, // M
0x00,0x00,0xDC,0x48,0x68,0x68,0x58,0x58,0x48,0xE8,0x00,0x00, // N
0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, // O
0x00,0x00,0xF0,0x48,0x48,0x70,0x40,0x40,0x40,0xE0,0x00,0x00, // P
0x00,0x00,0x70,0x88,0x88,0x88,0x88,0xE8,0x98,0x70,0x18,0x00, // Q
0x00,0x00,0xF0,0x48,0x48,0x70,0x50,0x48,0x48,0xEC,0x00,0x00, // R
0x00,0x00,0x78,0x88,0x80,0x60,0x10,0x08,0x88,0xF0,0x00,0x00, // S
0x00,0x00,0xF8,0xA8,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, // T
0x00,0x00,0xCC,0x48,0x48,0x48,0x48,0x48,0x48,0x30,0x00,0x00, // U
0x00,0x00,0xCC,0x48,0x48,0x50,0x50,0x30,0x20,0x20,0x00,0x00, // V
0x00,0x00,0xA8,0xA8,0xA8,0x70,0x50,0x50,0x50,0x50,0x00,0x00, // W
0x00,0x00,0xD8,0x50,0x50,0x20,0x20,0x50,0x50,0xD8,0x00,0x00, // X
0x00,0x00,0xD8,0x50,0x50,0x20,0x20,0x20,0x20,0x70,0x00,0x00, // Y
0x00,0x00,0xF8,0x90,0x10,0x20,0x20,0x40,0x48,0xF8,0x00,0x00, // Z
0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, // [
0x00,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x08,0x00,0x00, // <Backslash>
0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00, // ]
0x00,0x20,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ^
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC, // _
0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // '
0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x38,0x48,0x3C,0x00,0x00, // a
0x00,0x00,0xC0,0x40,0x40,0x70,0x48,0x48,0x48,0x70,0x00,0x00, // b
0x00,0x00,0x00,0x00,0x00,0x38,0x48,0x40,0x40,0x38,0x00,0x00, // c
0x00,0x00,0x18,0x08,0x08,0x38,0x48,0x48,0x48,0x3C,0x00,0x00, // d
0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x78,0x40,0x38,0x00,0x00, // e
0x00,0x00,0x1C,0x20,0x20,0x78,0x20,0x20,0x20,0x78,0x00,0x00, // f
0x00,0x00,0x00,0x00,0x00,0x3C,0x48,0x30,0x40,0x78,0x44,0x38, // g
0x00,0x00,0xC0,0x40,0x40,0x70,0x48,0x48,0x48,0xEC,0x00,0x00, // h
0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x70,0x00,0x00, // i
0x00,0x00,0x10,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0xE0, // j
0x00,0x00,0xC0,0x40,0x40,0x5C,0x50,0x70,0x48,0xEC,0x00,0x00, // k
0x00,0x00,0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0xF8,0x00,0x00, // l
0x00,0x00,0x00,0x00,0x00,0xF0,0xA8,0xA8,0xA8,0xA8,0x00,0x00, // m
0x00,0x00,0x00,0x00,0x00,0xF0,0x48,0x48,0x48,0xEC,0x00,0x00, // n
0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x48,0x48,0x30,0x00,0x00, // o
0x00,0x00,0x00,0x00,0x00,0xF0,0x48,0x48,0x48,0x70,0x40,0xE0, // p
0x00,0x00,0x00,0x00,0x00,0x38,0x48,0x48,0x48,0x38,0x08,0x1C, // q
0x00,0x00,0x00,0x00,0x00,0xD8,0x60,0x40,0x40,0xE0,0x00,0x00, // r
0x00,0x00,0x00,0x00,0x00,0x78,0x40,0x30,0x08,0x78,0x00,0x00, // s
0x00,0x00,0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x18,0x00,0x00, // t
0x00,0x00,0x00,0x00,0x00,0xD8,0x48,0x48,0x48,0x3C,0x00,0x00, // u
0x00,0x00,0x00,0x00,0x00,0xEC,0x48,0x50,0x30,0x20,0x00,0x00, // v
0x00,0x00,0x00,0x00,0x00,0xA8,0xA8,0x70,0x50,0x50,0x00,0x00, // w
0x00,0x00,0x00,0x00,0x00,0xD8,0x50,0x20,0x50,0xD8,0x00,0x00, // x
0x00,0x00,0x00,0x00,0x00,0xEC,0x48,0x50,0x30,0x20,0x20,0xC0, // y
0x00,0x00,0x00,0x00,0x00,0x78,0x10,0x20,0x20,0x78,0x00,0x00, // z
0x00,0x18,0x10,0x10,0x10,0x20,0x10,0x10,0x10,0x10,0x18,0x00, // {
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, // |
0x00,0x60,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0x60,0x00, // }
0x40,0xA4,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ~
0x50,0x00,0x20,0x20,0x30,0x50,0x50,0x78,0x48,0xCC,0x00,0x00, // <20>
0x50,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, // <20>
0x48,0x00,0xCC,0x48,0x48,0x48,0x48,0x48,0x48,0x30,0x00,0x00, // <20>
0x00,0x00,0x00,0x48,0x00,0x30,0x48,0x38,0x48,0x3C,0x00,0x00, // <20>
0x00,0x00,0x00,0x48,0x00,0x30,0x48,0x48,0x48,0x30,0x00,0x00, // <20>
0x00,0x00,0x00,0x48,0x00,0xD8,0x48,0x48,0x48,0x3C,0x00,0x00 // <20>
};
// BigFont.c (C)2010 by Henning Karlsen
// Font Size : 16x16
// Memory usage : 3236 bytes
// # characters : 101
FLASH_CHAR_ARR(BigFont,3236) ={
0x10,0x10,0x20,0x65,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // <Space>
0x00,0x00,0x00,0x00,0x07,0x00,0x0F,0x80,0x0F,0x80,0x0F,0x80,0x0F,0x80,0x0F,0x80,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x00,0x00, // !
0x00,0x00,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x06,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // "
0x00,0x00,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x7F,0xFE,0x7F,0xFE,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x7F,0xFE,0x7F,0xFE,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x00,0x00, // #
0x00,0x00,0x02,0x40,0x02,0x40,0x0F,0xF8,0x1F,0xF8,0x1A,0x40,0x1A,0x40,0x1F,0xF0,0x0F,0xF8,0x02,0x58,0x02,0x58,0x1F,0xF8,0x1F,0xF0,0x02,0x40,0x02,0x40,0x00,0x00, // $
0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x10,0x0E,0x30,0x0E,0x70,0x00,0xE0,0x01,0xC0,0x03,0x80,0x07,0x00,0x0E,0x70,0x0C,0x70,0x08,0x70,0x00,0x00,0x00,0x00,0x00,0x00, // %
0x00,0x00,0x00,0x00,0x0F,0x00,0x19,0x80,0x19,0x80,0x19,0x80,0x0F,0x00,0x0F,0x08,0x0F,0x98,0x19,0xF8,0x18,0xF0,0x18,0xE0,0x19,0xF0,0x0F,0x98,0x00,0x00,0x00,0x00, // &
0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // '
0x00,0x00,0x00,0x00,0x00,0xF0,0x01,0xC0,0x03,0x80,0x07,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x07,0x00,0x03,0x80,0x01,0xC0,0x00,0xF0,0x00,0x00,0x00,0x00, // (
0x00,0x00,0x00,0x00,0x0F,0x00,0x03,0x80,0x01,0xC0,0x00,0xE0,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0xE0,0x01,0xC0,0x03,0x80,0x0F,0x00,0x00,0x00,0x00,0x00, // )
0x00,0x00,0x00,0x00,0x01,0x80,0x11,0x88,0x09,0x90,0x07,0xE0,0x07,0xE0,0x3F,0xFC,0x3F,0xFC,0x07,0xE0,0x07,0xE0,0x09,0x90,0x11,0x88,0x01,0x80,0x00,0x00,0x00,0x00, // *
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x0F,0xF0,0x0F,0xF0,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // +
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x0E,0x00,0x00,0x00, // ,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // -
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00, // ,
0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x06,0x00,0x0E,0x00,0x1C,0x00,0x38,0x00,0x70,0x00,0xE0,0x01,0xC0,0x03,0x80,0x07,0x00,0x0E,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, // /
0x00,0x00,0x00,0x00,0x0F,0xF0,0x1C,0x38,0x1C,0x78,0x1C,0xF8,0x1C,0xF8,0x1D,0xB8,0x1D,0xB8,0x1F,0x38,0x1F,0x38,0x1E,0x38,0x1C,0x38,0x0F,0xF0,0x00,0x00,0x00,0x00, // 0
0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x03,0x80,0x1F,0x80,0x1F,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x1F,0xF0,0x00,0x00,0x00,0x00, // 1
0x00,0x00,0x00,0x00,0x0F,0xE0,0x1C,0x70,0x1C,0x38,0x00,0x38,0x00,0x70,0x00,0xE0,0x01,0xC0,0x03,0x80,0x07,0x00,0x0E,0x38,0x1C,0x38,0x1F,0xF8,0x00,0x00,0x00,0x00, // 2
0x00,0x00,0x00,0x00,0x0F,0xE0,0x1C,0x70,0x1C,0x38,0x00,0x38,0x00,0x70,0x03,0xC0,0x03,0xC0,0x00,0x70,0x00,0x38,0x1C,0x38,0x1C,0x70,0x0F,0xE0,0x00,0x00,0x00,0x00, // 3
0x00,0x00,0x00,0x00,0x00,0xE0,0x01,0xE0,0x03,0xE0,0x06,0xE0,0x0C,0xE0,0x18,0xE0,0x1F,0xF8,0x1F,0xF8,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x03,0xF8,0x00,0x00,0x00,0x00, // 4
0x00,0x00,0x00,0x00,0x1F,0xF8,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x1F,0xE0,0x1F,0xF0,0x00,0x78,0x00,0x38,0x1C,0x38,0x1C,0x70,0x0F,0xE0,0x00,0x00,0x00,0x00, // 5
0x00,0x00,0x00,0x00,0x03,0xE0,0x07,0x00,0x0E,0x00,0x1C,0x00,0x1C,0x00,0x1F,0xF0,0x1F,0xF8,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x0F,0xF0,0x00,0x00,0x00,0x00, // 6
0x00,0x00,0x00,0x00,0x1F,0xFC,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x00,0x1C,0x00,0x38,0x00,0x70,0x00,0xE0,0x01,0xC0,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00, // 7
0x00,0x00,0x00,0x00,0x0F,0xF0,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1F,0x38,0x07,0xE0,0x07,0xE0,0x1C,0xF8,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x0F,0xF0,0x00,0x00,0x00,0x00, // 8
0x00,0x00,0x00,0x00,0x0F,0xF0,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1F,0xF8,0x0F,0xF8,0x00,0x38,0x00,0x38,0x00,0x70,0x00,0xE0,0x07,0xC0,0x00,0x00,0x00,0x00, // 9
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // :
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ;
0x00,0x00,0x00,0x70,0x00,0xE0,0x01,0xC0,0x03,0x80,0x07,0x00,0x0E,0x00,0x1C,0x00,0x1C,0x00,0x0E,0x00,0x07,0x00,0x03,0x80,0x01,0xC0,0x00,0xE0,0x00,0x70,0x00,0x00, // <
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFC,0x3F,0xFC,0x00,0x00,0x00,0x00,0x3F,0xFC,0x3F,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // =
0x00,0x00,0x1C,0x00,0x0E,0x00,0x07,0x00,0x03,0x80,0x01,0xC0,0x00,0xE0,0x00,0x70,0x00,0x70,0x00,0xE0,0x01,0xC0,0x03,0x80,0x07,0x00,0x0E,0x00,0x1C,0x00,0x00,0x00, // >
0x00,0x00,0x03,0xC0,0x0F,0xF0,0x1E,0x78,0x18,0x38,0x00,0x38,0x00,0x70,0x00,0xE0,0x01,0xC0,0x01,0xC0,0x00,0x00,0x00,0x00,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x00,0x00, // ?
0x00,0x00,0x0F,0xF8,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0xFC,0x1C,0xFC,0x1C,0xFC,0x1C,0xFC,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x1F,0xF0,0x07,0xF8,0x00,0x00, // @
0x00,0x00,0x00,0x00,0x03,0xC0,0x07,0xE0,0x0E,0x70,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1F,0xF8,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x00,0x00,0x00,0x00, // A
0x00,0x00,0x00,0x00,0x1F,0xF0,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0F,0xF0,0x0F,0xF0,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x1F,0xF0,0x00,0x00,0x00,0x00, // B
0x00,0x00,0x00,0x00,0x07,0xF0,0x0E,0x38,0x1C,0x38,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x1C,0x38,0x0E,0x38,0x07,0xF0,0x00,0x00,0x00,0x00, // C
0x00,0x00,0x00,0x00,0x1F,0xE0,0x0E,0x70,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x70,0x1F,0xE0,0x00,0x00,0x00,0x00, // D
0x00,0x00,0x00,0x00,0x1F,0xF8,0x0E,0x18,0x0E,0x08,0x0E,0x00,0x0E,0x30,0x0F,0xF0,0x0F,0xF0,0x0E,0x30,0x0E,0x00,0x0E,0x08,0x0E,0x18,0x1F,0xF8,0x00,0x00,0x00,0x00, // E
0x00,0x00,0x00,0x00,0x1F,0xF8,0x0E,0x18,0x0E,0x08,0x0E,0x00,0x0E,0x30,0x0F,0xF0,0x0F,0xF0,0x0E,0x30,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x1F,0x00,0x00,0x00,0x00,0x00, // F
0x00,0x00,0x00,0x00,0x07,0xF0,0x0E,0x38,0x1C,0x38,0x1C,0x38,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x1C,0xF8,0x1C,0x38,0x1C,0x38,0x0E,0x38,0x07,0xF8,0x00,0x00,0x00,0x00, // G
0x00,0x00,0x00,0x00,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1F,0xF0,0x1F,0xF0,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x00,0x00,0x00,0x00, // H
0x00,0x00,0x00,0x00,0x0F,0xE0,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x0F,0xE0,0x00,0x00,0x00,0x00, // I
0x00,0x00,0x00,0x00,0x01,0xFC,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x38,0x70,0x38,0x70,0x38,0x70,0x38,0x70,0x0F,0xE0,0x00,0x00,0x00,0x00, // J
0x00,0x00,0x00,0x00,0x1E,0x38,0x0E,0x38,0x0E,0x70,0x0E,0xE0,0x0F,0xC0,0x0F,0x80,0x0F,0x80,0x0F,0xC0,0x0E,0xE0,0x0E,0x70,0x0E,0x38,0x1E,0x38,0x00,0x00,0x00,0x00, // K
0x00,0x00,0x00,0x00,0x1F,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x08,0x0E,0x18,0x0E,0x38,0x1F,0xF8,0x00,0x00,0x00,0x00, // L
0x00,0x00,0x00,0x00,0x1C,0x1C,0x1E,0x3C,0x1F,0x7C,0x1F,0xFC,0x1F,0xFC,0x1D,0xDC,0x1C,0x9C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x00,0x00,0x00,0x00, // M
0x00,0x00,0x00,0x00,0x1C,0x1C,0x1C,0x1C,0x1E,0x1C,0x1F,0x1C,0x1F,0x9C,0x1D,0xDC,0x1C,0xFC,0x1C,0x7C,0x1C,0x3C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x00,0x00,0x00,0x00, // N
0x00,0x00,0x00,0x00,0x03,0xE0,0x07,0xF0,0x0E,0x38,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x0E,0x38,0x07,0xF0,0x03,0xE0,0x00,0x00,0x00,0x00, // O
0x00,0x00,0x00,0x00,0x1F,0xF0,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0F,0xF0,0x0F,0xF0,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x1F,0x00,0x00,0x00,0x00,0x00, // P
0x00,0x00,0x00,0x00,0x03,0xE0,0x0F,0x78,0x0E,0x38,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x7C,0x1C,0xFC,0x0F,0xF8,0x0F,0xF8,0x00,0x38,0x00,0xFC,0x00,0x00, // Q
0x00,0x00,0x00,0x00,0x1F,0xF0,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0F,0xF0,0x0F,0xF0,0x0E,0x70,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x1E,0x38,0x00,0x00,0x00,0x00, // R
0x00,0x00,0x00,0x00,0x0F,0xF0,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1C,0x00,0x0F,0xE0,0x07,0xF0,0x00,0x38,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x0F,0xF0,0x00,0x00,0x00,0x00, // S
0x00,0x00,0x00,0x00,0x1F,0xFC,0x19,0xCC,0x11,0xC4,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x07,0xF0,0x00,0x00,0x00,0x00, // T
0x00,0x00,0x00,0x00,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0F,0xE0,0x00,0x00,0x00,0x00, // U
0x00,0x00,0x00,0x00,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0E,0xE0,0x07,0xC0,0x03,0x80,0x00,0x00,0x00,0x00, // V
0x00,0x00,0x00,0x00,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x9C,0x1C,0x9C,0x1C,0x9C,0x0F,0xF8,0x0F,0xF8,0x07,0x70,0x07,0x70,0x00,0x00,0x00,0x00, // W
0x00,0x00,0x00,0x00,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0E,0xE0,0x07,0xC0,0x03,0x80,0x03,0x80,0x07,0xC0,0x0E,0xE0,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x00,0x00,0x00,0x00, // X
0x00,0x00,0x00,0x00,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0E,0xE0,0x07,0xC0,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x0F,0xE0,0x00,0x00,0x00,0x00, // Y
0x00,0x00,0x00,0x00,0x1F,0xF8,0x1C,0x38,0x18,0x38,0x10,0x70,0x00,0xE0,0x01,0xC0,0x03,0x80,0x07,0x00,0x0E,0x08,0x1C,0x18,0x1C,0x38,0x1F,0xF8,0x00,0x00,0x00,0x00, // Z
0x00,0x00,0x00,0x00,0x07,0xF0,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0xF0,0x00,0x00,0x00,0x00, // [
0x00,0x00,0x00,0x00,0x10,0x00,0x18,0x00,0x1C,0x00,0x0E,0x00,0x07,0x00,0x03,0x80,0x01,0xC0,0x00,0xE0,0x00,0x70,0x00,0x38,0x00,0x1C,0x00,0x07,0x00,0x00,0x00,0x00, // <Backslash>
0x00,0x00,0x00,0x00,0x07,0xF0,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x07,0xF0,0x00,0x00,0x00,0x00, // ]
0x00,0x00,0x01,0x80,0x03,0xC0,0x07,0xE0,0x0E,0x70,0x1C,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ^
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0x7F,0xFF, // _
0x00,0x00,0x00,0x00,0x1C,0x00,0x1C,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // '
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xE0,0x00,0x70,0x00,0x70,0x0F,0xF0,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0F,0xD8,0x00,0x00,0x00,0x00, // a
0x00,0x00,0x00,0x00,0x1E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0F,0xF0,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x1B,0xF0,0x00,0x00,0x00,0x00, // b
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xE0,0x1C,0x70,0x1C,0x70,0x1C,0x00,0x1C,0x00,0x1C,0x70,0x1C,0x70,0x0F,0xE0,0x00,0x00,0x00,0x00, // c
0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x70,0x00,0x70,0x00,0x70,0x0F,0xF0,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0F,0xD8,0x00,0x00,0x00,0x00, // d
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xE0,0x1C,0x70,0x1C,0x70,0x1F,0xF0,0x1C,0x00,0x1C,0x70,0x1C,0x70,0x0F,0xE0,0x00,0x00,0x00,0x00, // e
0x00,0x00,0x00,0x00,0x03,0xE0,0x07,0x70,0x07,0x70,0x07,0x00,0x07,0x00,0x1F,0xE0,0x1F,0xE0,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x1F,0xC0,0x00,0x00,0x00,0x00, // f
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xD8,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0F,0xF0,0x07,0xF0,0x00,0x70,0x1C,0x70,0x0F,0xE0, // g
0x00,0x00,0x00,0x00,0x1E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0xF0,0x0F,0x38,0x0F,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x1E,0x38,0x00,0x00,0x00,0x00, // h
0x00,0x00,0x00,0x00,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x00,0x00,0x0F,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x0F,0xF8,0x00,0x00,0x00,0x00, // i
0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x00,0x03,0xF0,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x1C,0x70,0x0C,0xF0,0x07,0xE0, // j
0x00,0x00,0x00,0x00,0x1E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x38,0x0E,0x70,0x0E,0xE0,0x0F,0xC0,0x0E,0xE0,0x0E,0x70,0x0E,0x38,0x1E,0x38,0x00,0x00,0x00,0x00, // k
0x00,0x00,0x00,0x00,0x0F,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x0F,0xF8,0x00,0x00,0x00,0x00, // l
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF8,0x1C,0x9C,0x1C,0x9C,0x1C,0x9C,0x1C,0x9C,0x1C,0x9C,0x1C,0x9C,0x1C,0x9C,0x00,0x00,0x00,0x00, // m
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xE0,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x00,0x00,0x00,0x00, // n
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xE0,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0F,0xE0,0x00,0x00,0x00,0x00, // o
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1B,0xF0,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0F,0xF0,0x0E,0x00,0x0E,0x00,0x1F,0x00, // p
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xB0,0x38,0xE0,0x38,0xE0,0x38,0xE0,0x38,0xE0,0x38,0xE0,0x1F,0xE0,0x00,0xE0,0x00,0xE0,0x01,0xF0, // q
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0xF0,0x0F,0xF8,0x0F,0x38,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x1F,0x00,0x00,0x00,0x00,0x00, // r
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xE0,0x1C,0x30,0x1C,0x30,0x0F,0x80,0x03,0xE0,0x18,0x70,0x18,0x70,0x0F,0xE0,0x00,0x00,0x00,0x00, // s
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x07,0x00,0x1F,0xF0,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x70,0x07,0x70,0x03,0xE0,0x00,0x00,0x00,0x00, // t
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0F,0xD8,0x00,0x00,0x00,0x00, // u
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0E,0xE0,0x07,0xC0,0x03,0x80,0x00,0x00,0x00,0x00, // v
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x9C,0x1C,0x9C,0x0F,0xF8,0x07,0x70,0x07,0x70,0x00,0x00,0x00,0x00, // w
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0xE0,0x1C,0xE0,0x0F,0xC0,0x07,0x80,0x07,0x80,0x0F,0xC0,0x1C,0xE0,0x1C,0xE0,0x00,0x00,0x00,0x00, // x
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x07,0xF0,0x03,0xE0,0x00,0xE0,0x01,0xC0,0x1F,0x80, // y
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xE0,0x18,0xE0,0x11,0xC0,0x03,0x80,0x07,0x00,0x0E,0x20,0x1C,0x60,0x1F,0xE0,0x00,0x00,0x00,0x00, // z
0x00,0x00,0x00,0x00,0x01,0xF8,0x03,0x80,0x03,0x80,0x03,0x80,0x07,0x00,0x1C,0x00,0x1C,0x00,0x07,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x01,0xF8,0x00,0x00,0x00,0x00, // {
0x00,0x00,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x00,0x00, // |
0x00,0x00,0x00,0x00,0x1F,0x80,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x00,0xE0,0x00,0x38,0x00,0x38,0x00,0xE0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x1F,0x80,0x00,0x00,0x00,0x00, // }
0x00,0x00,0x00,0x00,0x1F,0x1C,0x3B,0x9C,0x39,0xDC,0x38,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ~
0x0C,0x30,0x0C,0x30,0x03,0xC0,0x07,0xE0,0x0E,0x70,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1F,0xF8,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x00,0x00,0x00,0x00, // <20>
0x0C,0x18,0x0C,0x18,0x03,0xE0,0x07,0xF0,0x0E,0x38,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x0E,0x38,0x07,0xF0,0x03,0xE0,0x00,0x00,0x00,0x00, // <20>
0x0C,0x60,0x0C,0x60,0x00,0x00,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0F,0xE0,0x00,0x00,0x00,0x00, // <20>
0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x60,0x0C,0x60,0x00,0x00,0x0F,0xE0,0x00,0x70,0x00,0x70,0x0F,0xF0,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0F,0xD8,0x00,0x00,0x00,0x00, // <20>
0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x60,0x0C,0x60,0x00,0x00,0x0F,0xE0,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0F,0xE0,0x00,0x00,0x00,0x00, // o
0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x60,0x0C,0x60,0x00,0x00,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0F,0xD8,0x00,0x00,0x00,0x00 // u
};
// SevenSegNumFont.c
// Font Size : 32x50
// Memory usage : 2004 bytes
// # characters : 10
FLASH_CHAR_ARR(SevenSegNumFont,2004) ={
0x20,0x32,0x30,0x0A,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x60,0x0C,0xFF,0xFE,0xF0,0x1E,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3E,0x00,0x00,0x78,0x38,0x00,0x00,0x18,0x20,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x38,0x00,0x00,0x18,0x3E,0x00,0x00,0x78,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x1E,0x00,0x00,0xF0,0x0C,0xFF,0xFE,0x60,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0xF0,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 1
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x60,0x00,0xFF,0xFE,0xF0,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0x78,0x01,0xFF,0xFE,0x18,0x03,0xFF,0xFF,0x88,0x0F,0xFF,0xFF,0xE0,0x27,0xFF,0xFF,0xC0,0x39,0xFF,0xFF,0x00,0x3E,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x0C,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 2
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x60,0x00,0xFF,0xFE,0xF0,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0x78,0x01,0xFF,0xFE,0x18,0x03,0xFF,0xFF,0x88,0x0F,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xC0,0x01,0xFF,0xFF,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xF0,0x00,0xFF,0xFE,0x60,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 3
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x0C,0x00,0x00,0xF0,0x1E,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3E,0x00,0x00,0x78,0x39,0xFF,0xFE,0x18,0x23,0xFF,0xFF,0x88,0x0F,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xC0,0x01,0xFF,0xFF,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 4
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x0C,0xFF,0xFE,0x00,0x1E,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3E,0x00,0x00,0x00,0x39,0xFF,0xFE,0x00,0x23,0xFF,0xFF,0x80,0x0F,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xC0,0x01,0xFF,0xFF,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xF0,0x00,0xFF,0xFE,0x60,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 5
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x0C,0xFF,0xFE,0x00,0x1E,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3E,0x00,0x00,0x00,0x39,0xFF,0xFE,0x00,0x23,0xFF,0xFF,0x80,0x0F,0xFF,0xFF,0xE0,0x27,0xFF,0xFF,0xC0,0x39,0xFF,0xFF,0x18,0x3E,0x00,0x00,0x78,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x1E,0x00,0x00,0xF0,0x0C,0xFF,0xFE,0x60,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 6
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x60,0x00,0xFF,0xFE,0xF0,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 7
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x60,0x0C,0xFF,0xFE,0xF0,0x1E,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3E,0x00,0x00,0x78,0x39,0xFF,0xFE,0x18,0x23,0xFF,0xFF,0x88,0x0F,0xFF,0xFF,0xE0,0x27,0xFF,0xFF,0xC0,0x39,0xFF,0xFF,0x18,0x3E,0x00,0x00,0x78,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x1E,0x00,0x00,0xF0,0x0C,0xFF,0xFE,0x60,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 8
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x60,0x0C,0xFF,0xFE,0xF0,0x1E,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3E,0x00,0x00,0x78,0x39,0xFF,0xFE,0x18,0x23,0xFF,0xFF,0x88,0x0F,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xC0,0x01,0xFF,0xFF,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xF0,0x00,0xFF,0xFE,0x60,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 9
};

795
src/Tft/tft.c Normal file
View File

@@ -0,0 +1,795 @@
#include "../settings.h"
#include "../types.h"
#include "tft.h"
//#include "../touch/touch.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "../SD/pff.h"
void _tftData(unsigned int dat)
{
//Makro Definieren (Damit man <20>ber das QM (QuickMakro) sich LCALL und RET spaaren kann, auf Kosten des Flash-Speichers)
//Funktioniert nur bis zur Optimierungsstufe 8. Ab Stufe 9 (Common Sub Blocks) ist das Makro nutzlos.
#define _tftDataQM(dat){ \
SET_RS;\
DATAPORT_LOW((dat)); \
DATAPORT_HIGH((dat) >> 8); \
CLEAR_WR; \
SET_WR;}
_tftDataQM(dat); //Makro einsetzen
}
void _tftCmd(unsigned char cmd)
{
CLEAR_RS;
DATAPORT_LOW(cmd);
DATAPORT_HIGH(0);
CLEAR_WR;
SET_WR;
}
void _tftCmdData(unsigned char cmd, unsigned int dat)
{
_tftCmd(cmd);
_tftData(dat);
}
int ATputchar(char c,FILE*f);
void tftInit(void)
{
DATAPORT_LOW_DDR.DIR = 0xFF; //Low Datenport als Ausgang setzen
DATAPORT_HIGH_DDR.DIR = 0xFF; //High Datenport als Ausgang setzen
PORTD.DIRSET = Display_CTRL_RESET_bm; //Reset Pin als Ausgang setzen
PORTE.DIRSET = Display_CTRL_RS_bm | Display_CTRL_WR_bm | Display_CTRL_RD_bm; //RS,WR,RD als Ausgag setzen
PORTC.DIRSET = Display_CTRL_CS_bm; //CS als Ausgag setzen
PORTE.OUTSET = Display_CTRL_RD_bm; //READ setzen
PORTC.DIRSET = Display_Backlight_bm; //Backlight =Ausgang
//PORTC.OUTSET = Display_Backlight_bm; // = Aus
#ifdef CONTROLLER_SSD1289
CLEAR_RESET;
SET_RESET;
CLEAR_CS;
_tftCmdData(0x00,0x0001);
_tftCmdData(0x03,0xA8A4);
_tftCmdData(0x0C,0x0000);
_tftCmdData(0x0D,0x080C);
_tftCmdData(0x0E,0x2B00);
_tftCmdData(0x1E,0x00B7);
_tftCmdData(0x01,0x2B3F);
_tftCmdData(0x02,0x0600);
_tftCmdData(0x10,0x0000);
_tftCmdData(0x11,0x6018);
_tftCmdData(0x05,0x0000);
_tftCmdData(0x06,0x0000);
_tftCmdData(0x16,0xEF1C);
_tftCmdData(0x17,0x0003);
_tftCmdData(0x07,0x0233);
_tftCmdData(0x0B,0x0000);
_tftCmdData(0x0F,0x0000);
_tftCmdData(0x41,0x0000);
_tftCmdData(0x42,0x0000);
_tftCmdData(0x48,0x0000);
_tftCmdData(0x49,0x013F);
_tftCmdData(0x4A,0x0000);
_tftCmdData(0x4B,0x0000);
_tftCmdData(0x44,0xEF00);
_tftCmdData(0x45,0x0000);
_tftCmdData(0x46,0x013F);
_tftCmdData(0x30,0x0707);
_tftCmdData(0x31,0x0204);
_tftCmdData(0x32,0x0204);
_tftCmdData(0x33,0x0502);
_tftCmdData(0x34,0x0507);
_tftCmdData(0x35,0x0204);
_tftCmdData(0x36,0x0204);
_tftCmdData(0x37,0x0502);
_tftCmdData(0x3A,0x0302);
_tftCmdData(0x3B,0x0302);
_tftCmdData(0x23,0x0000);
_tftCmdData(0x24,0x0000);
_tftCmdData(0x25,0x8000);
_tftCmdData(0x4f,0x0000);
_tftCmdData(0x4e,0x0000);
_tftCmd(0x22);
SET_CS;
#endif
#ifdef CONTROLLER_ILI9327
CLEAR_RESET;
_delay_ms(1);
SET_RESET;
_delay_ms(1);
CLEAR_CS;
_tftCmd(0xE9);
_tftData(0x0020);
_delay_ms(1);
_tftCmd(0x11); //Exit Sleep
_delay_ms(100);
_tftCmd(0xD1);
_tftData(0x0000);
_tftData(0x0071);
_tftData(0x0019);
_delay_ms(1);
_tftCmd(0xD0);
_tftData(0x0007);
_tftData(0x0001);
_tftData(0x0008);
_delay_ms(1);
_tftCmd(0x36); //Set_address_mode (36)
_tftData(0x0069);
_delay_ms(1);
_tftCmd(0x3A);
_tftData(0x0005);
_delay_ms(1);
_tftCmd(0xC1);
_tftData(0x0010);
_tftData(0x0010);
_tftData(0x0002);
_tftData(0x0002);
_tftCmd(0xC0); //Set Default Gamma
_tftData(0x0000);
_tftData(0x0035);
_tftData(0x0000);
_tftData(0x0000);
_tftData(0x0001);
_tftData(0x0002);
_tftCmd(0xC5); //Set frame rate
_tftData(0x0004);
_tftCmd(0xD2); //power setting
_tftData(0x0001);
_tftData(0x0044);
_tftCmd(0xC8); //Set Gamma
_tftData(0x0004);
_tftData(0x0067);
_tftData(0x0035);
_tftData(0x0004);
_tftData(0x0008);
_tftData(0x0006);
_tftData(0x0024);
_tftData(0x0001);
_tftData(0x0037);
_tftData(0x0040);
_tftData(0x0003);
_tftData(0x0010);
_tftData(0x0008);
_tftData(0x0080);
_tftData(0x0000);
_tftCmd(0x2A); //Set column address (2A)
_tftData(0x0000);
_tftData(0x0020);
_tftData(0x0001);
_tftData(0x00AF);
_tftCmd(0x2B); //Set page address (2B)
_tftData(0x0000);
_tftData(0x0000);
_tftData(0x0000);
_tftData(0x00EF);
_tftCmd(0x29); //display on
_tftCmd(0x2C); //display on
SET_CS;
#endif
fdevopen(ATputchar, NULL );
tftClear(BLACK);
}
void _tftSetXY(unsigned int x,unsigned char y)
{
#ifdef CONTROLLER_SSD1289
#define _tftSetXYQM(x,y){ \
_tftCmdData(0x4e,y); \
_tftCmdData(0x4f,319-x);\
_tftCmd(0x0022); }
#endif
#ifdef CONTROLLER_ILI9327
#define _tftSetXYQM(x,y){ \
_tftCmd(0x2A); \
_tftData((0x20+x)>>8);\
_tftData(0x20+x);\
_tftCmd(0x2B);\
_tftData(0);\
_tftData(y);\
_tftCmd(0x2C); }
#endif
_tftSetXYQM(x,y);
}
BOOL regionReseted=0;
void _tftResetRegion()
{
#ifdef CONTROLLER_SSD1289
//Landscape
_tftCmdData(0x44,239<<8);
_tftCmdData(0x45,0);
_tftCmdData(0x46,319);
#endif
#ifdef CONTROLLER_ILI9327
_tftCmd(0x2A); //Set column address (2A)
_tftData(0x0000);
_tftData(0x0020);
_tftData(0x0001);
_tftData(0x00AF);
_tftCmd(0x2B); //Set page address (2B)
_tftData(0x0000);
_tftData(0x0000);
_tftData(0x0000);
_tftData(0x00EF);
#endif
regionReseted=1;
}
void _tftSetRegionAndPos(unsigned int x1,unsigned char y1,unsigned int x2,unsigned char y2)
{
#ifdef CONTROLLER_SSD1289
//Landscape
_tftCmdData(0x44,(y2<<8)+y1);
_tftCmdData(0x45,319-x2);
_tftCmdData(0x46,319-x1);
_tftSetXYQM(x1,y1);
#endif
#ifdef CONTROLLER_ILI9327
x1+=0x20;
x2+=0x20;
_tftCmd(0x2A); //Set column address (2A)
_tftData(x1>>8);
_tftData(x1);
_tftData(x2>>8);
_tftData(x2);
_tftCmd(0x2B); //Set page address (2B)
_tftData(y1>>8);
_tftData(y1);
_tftData(y2>>8);
_tftData(y2);
_tftCmd(0x2C); //start writing
#endif
regionReseted=0;
}
void tftDrawPixel(unsigned int x,unsigned char y,unsigned int color)
{
CLEAR_CS;
if(!regionReseted)
_tftResetRegion();
_tftSetXYQM(x,y);
_tftDataQM(color);
SET_CS;
}
void tftClear(unsigned int color)
{
unsigned long i;
CLEAR_CS;
if(!regionReseted)
_tftResetRegion();
_tftSetXY(0,0);
for(i=(WIDTH*HEIGHT); i>0; i--) _tftDataQM(color);
SET_CS;
}
void tftDrawLine(unsigned int x1,unsigned char y1,unsigned int x2,unsigned char y2, unsigned int color)
{
CLEAR_CS;
if(!regionReseted)
_tftResetRegion();
if(y1==y2)
{
if(x2<x1)
{
_tftSetXY(x2,y1);
do _tftDataQM(color) //Let Semi away, because of block makro
while(x2++!=x1);
}
else
{
_tftSetXY(x1,y1);
do _tftDataQM(color)
while(x1++!=x2);
}
}
else if(x1==x2)
{
#ifdef CONTROLLER_ILI9327
_tftSetRegionAndPos(x1,((y1>y2)?y2:y1),x1,((y1>y2)?y1:y2));//_tftCmdData(0x36,0x0049); //Set_address_mode (36)
#else
_tftCmdData(0x11,0x6030); // Change adresspointer direction
#endif
// (is quicker than defining a region)
if(y2<y1)
{
_tftSetXY(x1,y2);
do _tftDataQM(color)
while(y2++!=y1);
}
else
{
_tftSetXY(x1,y1);
do _tftDataQM(color)
while(y1++!=y2);
}
#ifdef CONTROLLER_ILI9327
_tftResetRegion(); //_tftCmdData(0x36,0x0069); //Set_address_mode (36)
#else
_tftCmdData(0x11,0x6018); // Set adresspointer direction normal again
#endif
}
else
{
if(abs(x2-x1) > abs(y2-y1))
{
//Without floating point!
int deltax = ((int)x2-(int)x1);
int deltay = ((int)y2-(int)y1)<<1; // multiple by 2 to make it easier to round
int x = 0;
if (x1>x2)
{
do
{
//y = mx + b (math theory, linear functions)
_tftSetXY(x1+x,y1+ (((long)deltay*(long)x/deltax+1)>>1)); // Add 1 and divde by 2 = +0.5
_tftDataQM(color);
}
while(x--!=deltax);
}
else
{
do
{
_tftSetXY(x1+x,y1+ (((long)deltay*(long)x/deltax+1)>>1));
_tftDataQM(color);
}
while(x++!=deltax);
}
}
else
{
int deltax = ((int)x2-(int)x1)<<1;
int deltay = ((int)y2-(int)y1);
int y = 0;
if (y1>y2)
{
do
{
_tftSetXY(x1+ (((long)deltax*(long)y/deltay+1)>>1),y1+ y);
_tftDataQM(color);
}
while(y--!=deltay);
}
else
{
do
{
_tftSetXY(x1+ (((long)deltax*(long)y/deltay+1)>>1),y1+ y);
_tftDataQM(color);
}
while(y++!=deltay);
}
}
}
SET_CS;
}
void tftDrawRectangle(unsigned int x1,unsigned char y1,unsigned int x2,unsigned char y2, unsigned int color)
{
unsigned int tmp;
unsigned int i;
CLEAR_CS;
if(!regionReseted)
_tftResetRegion();
if (x1>x2)
{
tmp=x1;
x1=x2;
x2=tmp;
}
if (y1>y2)
{
tmp=y1;
y1=y2;
y2=tmp;
}
i=x1;
_tftSetXY(x1,y1);
while(i++!=x2) _tftDataQM(color);
_tftSetXY(x1,y2);
while(i--!=x1) _tftDataQM(color);
i=y1;
#ifdef CONTROLLER_SSD1289
_tftCmdData(0x11,0x6030); // Change adresspointer direction
_tftSetXY(x1,y1);
#else
_tftSetRegionAndPos(x1,y1,x1,y2);
#endif
while(i++!=y2) _tftDataQM(color);
#ifdef CONTROLLER_SSD1289
_tftSetXY(x2,y1);
#else
_tftSetRegionAndPos(x2,y1,x2,y2);
#endif
while(i--!=y1) _tftDataQM(color);
#ifdef CONTROLLER_SSD1289
_tftCmdData(0x11,0x6018); // Set adresspointer direction normal again
#else
_tftResetRegion();
#endif
SET_CS;
}
void tftFillRectangle(unsigned int x1,unsigned char y1,unsigned int x2,unsigned char y2, unsigned int color)
{
unsigned int tmp;
unsigned long i;
CLEAR_CS;
if (x1>x2)
{
tmp=x1;
x1=x2;
x2=tmp;
}
if (y1>y2)
{
tmp=y1;
y1=y2;
y2=tmp;
}
_tftSetRegionAndPos(x1,y1,x2,y2);
for(i=((unsigned long)(x2-x1+1)*(y2-y1+1));i>0;i--) _tftDataQM(color);
SET_CS;
}
void tftDrawBitmapUnscaled(unsigned int x, unsigned char y, unsigned int width, unsigned char height, FLASH_INT_ARR_POINTER dat)
{
unsigned long i;
CLEAR_CS;
_tftSetRegionAndPos(x,y,x+width-1,y+height-1);
for(i=height*width; i>0; i--)
{
_tftDataQM(FLASH_INT_ARR_READ(dat));
dat++;
}
SET_CS;
}
void tftDrawBitmapUnscaledStreamedRaw (unsigned int x, unsigned char y, unsigned int width, unsigned char height, char* filename)
{
WORD readed;
if(pf_open(filename)!=FR_OK) return;
CLEAR_CS;
_tftSetRegionAndPos(x,y,x+width-1,y+height-1);
SET_RS;
while (1)
{
pf_read(NULL,65024,&readed);
if (readed < 65024)
break;
}
SET_CS;
}
void _tftPutChar(unsigned int x, unsigned char y, unsigned char c, unsigned int color, unsigned int bgcolor, FLASH_CHAR_ARR_POINTER font)
{
unsigned char width = FLASH_CHAR_ARR_READ(&font[0]);
unsigned char height = FLASH_CHAR_ARR_READ(&font[1]);
unsigned char offset = FLASH_CHAR_ARR_READ(&font[2]);
switch(c)
{
case 0xC4: //<2F>
c=127;
break;
case 0xD6: //<2F>
c=128;
break;
case 0xDC: //<2F>
c=129;
break;
case 0xE4: //<2F>
c=130;
break;
case 0xF6: //<2F>
c=131;
break;
case 0xFC: //<2F>
c=132;
break;
default:
break;
}
unsigned int ind = ((c-offset)*((width/8)*height))+4;
unsigned int cnt =0;
unsigned char bitm=0;
BOOL bgIsTrans = bgcolor==TRANSPARENT;
#ifdef CONTROLLER_SSD1289
BOOL enTrans=0;
#endif
#ifdef CONTROLLER_ILI9327
unsigned char xadd=0;
unsigned char yadd=0;
#endif
CLEAR_CS;
_tftSetRegionAndPos(x,y,x+width-1,y+height-1);
for(cnt= (width/8)*height; cnt>0; cnt--)
{
for(bitm=0x80; bitm >0; bitm>>=1)
{
if(FLASH_CHAR_ARR_READ(&font[ind])& bitm)
{
#ifdef CONTROLLER_SSD1289
if(enTrans)
{
enTrans=0;
_tftCmdData(0x23,0x0000);
_tftCmdData(0x24,0x0000);
_tftCmd(0x22);
}
_tftDataQM(color)
#endif
#ifdef CONTROLLER_ILI9327
if(bgIsTrans)
_tftSetXY(x+xadd,y+yadd);
_tftDataQM(color);
#endif
}
else
{
#ifdef CONTROLLER_SSD1289
if(bgIsTrans && !enTrans)
{
enTrans=1;
_tftCmdData(0x23,0xFFFF);
_tftCmdData(0x24,0xFFFF);
_tftCmd(0x22);
}
_tftDataQM(bgcolor)
#endif
#ifdef CONTROLLER_ILI9327
if(!bgIsTrans) _tftDataQM(bgcolor);
#endif
}
#ifdef CONTROLLER_ILI9327
if(bgIsTrans)
{
xadd++;
if(xadd==width)
{
xadd=0;
yadd++;
}
}
#endif
}
ind++;
}
#ifdef CONTROLLER_SSD1289
if(enTrans)
{
_tftCmdData(0x23,0x0000);
_tftCmdData(0x24,0x0000);
}
#endif
SET_CS;
}
unsigned char fontWidth=0;
unsigned int textX=0;
unsigned char textY=0;
unsigned int textColor=0;
unsigned int textBgcolor=0;
FLASH_CHAR_ARR_POINTER fontPtr;
unsigned int tftPrintCalcWidth(FLASH_CHAR_ARR_POINTER font, char * text)
{
return FLASH_CHAR_ARR_READ(&font[0]) * strlen(text);
}/*
unsigned int tftPrintCalcWidth_P(FLASH_CHAR_ARR_POINTER font, const char * text)
{
return FLASH_CHAR_ARR_READ(&font[0]) * strlen_P(text);
}*/
unsigned char tftPrintCalcHeight(FLASH_CHAR_ARR_POINTER font)
{
return FLASH_CHAR_ARR_READ(&font[1]);
}
void tftPrint(unsigned int x, unsigned char y, unsigned int color, unsigned int bgcolor, FLASH_CHAR_ARR_POINTER font, char * text)
{
fontWidth = FLASH_CHAR_ARR_READ(&font[0]);
char c = *text;
while(c!=0x00)
{
_tftPutChar(x, y, c, color, bgcolor, font);
x += fontWidth;
text++;
c = *text;
}
}
void tftPrint_P(unsigned int x, unsigned char y, unsigned int color, unsigned int bgcolor, FLASH_CHAR_ARR_POINTER font, const char * text)
{
fontWidth = FLASH_CHAR_ARR_READ(&font[0]);
char c = FLASH_CHAR_ARR_READ(text);
while(c!=0x00)
{
_tftPutChar(x, y, c, color, bgcolor, font);
x += fontWidth;
text++;
c = FLASH_CHAR_ARR_READ(text);
}
}
void tftPrintf(unsigned int x, unsigned char y, unsigned int color, unsigned int bgcolor, FLASH_CHAR_ARR_POINTER font, char *format, ...)
{
va_list args;
fontPtr =font;
fontWidth = FLASH_CHAR_ARR_READ(&font[0]);
textX = x;
textY = y;
textColor = color;
textBgcolor=bgcolor;
va_start (args, format);
vprintf (format, args);
va_end (args);
}
void tftPrintf_P(unsigned int x, unsigned char y, unsigned int color, unsigned int bgcolor, FLASH_CHAR_ARR_POINTER font,const char *format, ...)
{
va_list args;
fontPtr =font;
fontWidth = FLASH_CHAR_ARR_READ(&font[0]);
textX = x;
textY = y;
textColor = color;
textBgcolor=bgcolor;
va_start (args, format);
vfprintf_P (stdout,format, args);
va_end (args);
}
int ATputchar(char c,FILE*f)
{
if(fontWidth>WIDTH)
return EOF;
_tftPutChar(textX, textY, c, textColor, textBgcolor, fontPtr);
textX += fontWidth;
return 0;
}
//Draw an icon, for example e battery percentage icon
void tftDrawIconUnscaledStreamedRaw(unsigned int x, unsigned char y, unsigned char width, unsigned char iconNr, char* filename)
{
#define ICONS_PER_ROW 10
WORD readed;
if(pf_open(filename)!=FR_OK) return;
CLEAR_CS;
_tftSetRegionAndPos(x,y,x+width-1,y+width-1);
SET_RS;
DWORD SDoffset = 2*(iconNr%ICONS_PER_ROW)*width+(DWORD)(iconNr/ICONS_PER_ROW)*ICONS_PER_ROW*2*width*width;
for(unsigned char i=0; i<width; i++)
{
pf_lseek(SDoffset);
pf_read(NULL,2*width,&readed); //read (width) Pixel
SDoffset += width*2*ICONS_PER_ROW;
}
SET_CS;
}
void tftDrawGradient(unsigned int x, unsigned char y, unsigned int width, unsigned char height, FLASH_INT_ARR_POINTER dat)
{
CLEAR_CS;
_tftSetRegionAndPos(x,y,x+width-1,y+height-1);
unsigned int w_cnt=0;
while(height>0)
{
_tftDataQM(FLASH_INT_ARR_READ(dat));
if (++w_cnt==width)
{
dat++;
height--;
w_cnt=0;
}
}
SET_CS;
}
void tftDrawLinearGradient(unsigned int x, unsigned char y, unsigned int width, unsigned char height, unsigned int color_top, unsigned int color_bot,GRADIENT_MODE mode)
{
CLEAR_CS;
_tftSetRegionAndPos(x,y,x+width-1,y+height-1);
int h=0;
int w=0;
unsigned int w_cnt=0;
unsigned int col=0;
int r,g,b;
int dr,dg,db;
int ar,ag,ab;
r=(color_top&0xF800)>>11;
g=(color_top&0x07E0)>>5;
b=(color_top&0x001F)>>0;
dr=((color_bot&0xF800)>>11)-r;
dg=((color_bot&0x07E0)>>5)-g;
db=((color_bot&0x001F)>>0)-b;
if(mode==TOP_BOTTOM)
{
while(h<height)
{
//TODO Remove unuseful int cast and variables
ar= r+((dr*h)+((int)height/2))/((int)height);
ag = g+((dg*h)+((int)height/2))/((int)height);
ab = b+((db*h)+((int)height/2))/((int)height);
col = (ar<<11)|(ag<<5)|(ab&0x1F);
while(w_cnt++<width) _tftDataQM(col);
w_cnt=0;
h++;
}
}
else if(mode==LEFT_RIGHT)
{
while(h++<height)
{
while(w<width)
{
//TODO Remove unuseful int cast and variables
ar= r+((dr*w)+((int)width/2))/((int)width);
ag = g+((dg*w)+((int)width/2))/((int)width);
ab = b+((db*w)+((int)width/2))/((int)width);
col = (ar<<11)|(ag<<5)|(ab&0x1F);
_tftDataQM(col);
w++;
}
w=0;
}
}
SET_CS;
}
void tftSetScrollArea(unsigned int TFA, unsigned int VSA, unsigned int BFA )
//ILI9327 Manual Page 81
{
CLEAR_CS;
#ifdef CONTROLLER_SSD1289
#endif
#ifdef CONTROLLER_ILI9327
//_tftCmd(0x36); //Set_address_mode (36)
//_tftData(0x0009);
_tftCmd(0x33);
_tftData(TFA>>8);
_tftData(TFA&0x00FF);
_tftData(VSA>>8);
_tftData(VSA&0x00FF);
_tftData(BFA>>8);
_tftData(BFA&0x00FF);
#endif
SET_CS;
}
void tftSetScrollStart(unsigned int VSP)
//ILI9327 Manual Page 89
{
CLEAR_CS;
#ifdef CONTROLLER_SSD1289
#endif
#ifdef CONTROLLER_ILI9327
_tftCmd(0x37);
_tftData(VSP>>8);
_tftData(VSP&0x00FF);
#endif
SET_CS;
}
void tftEnterSleep()
{
CLEAR_CS;
_tftCmd(0x10); //Enter sleep Mode
SET_CS;
}
void tftExitSleep()
{
CLEAR_CS;
_tftCmd(0x11); //Exit sleep Mode
SET_CS;
}

52
src/Tft/tft.h Normal file
View File

@@ -0,0 +1,52 @@
extern void tftInit(void);
extern void tftClear(unsigned int color);
extern void tftDrawPixel(unsigned int x,unsigned char y,unsigned int color);
extern void tftDrawLine(unsigned int x1,unsigned char y1,unsigned int x2,unsigned char y2, unsigned int color);
extern void tftDrawRectangle(unsigned int x1,unsigned char y1,unsigned int x2,unsigned char y2, unsigned int color);
extern void tftFillRectangle(unsigned int x1,unsigned char y1,unsigned int x2,unsigned char y2, unsigned int color);
extern void tftDrawBitmapUnscaled(unsigned int x, unsigned char y, unsigned int width, unsigned char height, FLASH_INT_ARR_POINTER dat);
extern void tftPrint(unsigned int x, unsigned char y, unsigned int color, unsigned int bgcolor, FLASH_CHAR_ARR_POINTER font, char * text);
extern void tftPrint_P(unsigned int x, unsigned char y, unsigned int color, unsigned int bgcolor, FLASH_CHAR_ARR_POINTER font, const char * text);
extern void tftPrintf(unsigned int x, unsigned char y, unsigned int color, unsigned int bgcolor, FLASH_CHAR_ARR_POINTER font, char *format, ...);
extern void tftPrintf_P(unsigned int x, unsigned char y, unsigned int color, unsigned int bgcolor, FLASH_CHAR_ARR_POINTER font,const char *format, ...);
extern void tftDrawBitmapUnscaledStreamedRaw (unsigned int x, unsigned char y, unsigned int width, unsigned char height, char* filename);
extern void tftDrawIconUnscaledStreamedRaw(unsigned int x, unsigned char y, unsigned char width, unsigned char iconNr, char* filename);
typedef enum {TOP_BOTTOM,LEFT_RIGHT} GRADIENT_MODE;
extern void tftDrawLinearGradient(unsigned int x, unsigned char y, unsigned int width, unsigned char height, unsigned int color_top, unsigned int color_bot, GRADIENT_MODE mode);
extern void tftDrawGradient(unsigned int x, unsigned char y, unsigned int width, unsigned char height, FLASH_INT_ARR_POINTER dat);
extern unsigned int tftPrintCalcWidth(FLASH_CHAR_ARR_POINTER font, char * text);
extern unsigned int tftPrintCalcWidth_P(FLASH_CHAR_ARR_POINTER font, const char * text);
extern unsigned char tftPrintCalcHeight(FLASH_CHAR_ARR_POINTER font);
extern void tftEnterSleep();
extern void tftExitSleep();
#define RGB(r,g,b) ((((r) & 0xF8) << 8) | (((g) & 0xFC) << 3) | (((b) & 0xF8) >> 3))
#define RED RGB(255,0,0)
#define GREEN RGB(0,255,0)
#define BLUE RGB(0,0,255)
#define WHITE RGB(255,255,255)
#define BLACK RGB(0,0,0)
#define HEX(h) (RGB(((h)>>16),((h)>>8),(h)))
#define TRANSPARENT 0x80C2
#ifdef CONTROLLER_SSD1289
#define WIDTH 320l
#define HEIGHT 240l
#elif defined (CONTROLLER_ILI9327)
#define WIDTH 400l
#define HEIGHT 240l
#else
#error You should either define CONTROLLER_SSD1289 or CONTROLLER_ILI9327 in the Compiler Settings
#endif
#define DWIDTH (WIDTH-1)
#define DHEIGHT (HEIGHT-1)
#define HWIDTH (WIDTH/2)
#define HHEIGHT (HEIGHT/2)
extern FLASH_CHAR_ARR(SmallFont,1144);
extern FLASH_CHAR_ARR(BigFont,3044);
extern FLASH_CHAR_ARR(SevenSegNumFont,2004);

389
src/Touch/touch.c Normal file
View File

@@ -0,0 +1,389 @@
#include "../settings.h"
#include"../types.h"
#include "../OpSys/ptask.h"
#include "touch.h"
#include "../Tft/tft.h"
#include <string.h>
#define CCENTER 20 //Pixel Distance from Sides for Calibration Cross
#define CLENGTH 10 //Length of the Calibration Cross Lines
#define TOUCH_PRECISION 16 //Number of executions before building the average
#define NUM_AREAS 50 //Number of Structs Reserved in Memory for TouchAreas (e.g Buttons)
#define TIMER_FREQ 15 //Frequency of the Interval between the finsihed and the next measure, while pen is down.
#define TOUCH_BASEPRIORITY 100
//Global
volatile int touchY=0; //Last Y Coordinate in pixels
volatile int touchX=0; //Last X Coordinate in pixels
volatile BOOL calibration =0 ; //Flag if calibartion active (values will not be converted to pixels)
unsigned char touchEvents[28]; //7 bytes per Event (1 Length + 6 Data)
PTASK_STRUCT* touchTask;
TOUCH_AREA_STRUCT* areas[NUM_AREAS] = {NULL};
#ifdef CONTROLLER_SSD1289
int _x1=0x0231;
int _x2=0x0C08;
int _y1=0x0287;
int _y2=0x0B56; //Calibration Constants(Defaults= Timo's 3.2")
#endif
#ifdef CONTROLLER_ILI9327
int _x1=0x0DEE;
int _x2=0xF34E;
int _y1=0x01EF;
int _y2=0x0BE2; //Calibration Constants(Defaults= Timo's 3.2")
#endif
#define dx _x2 //Save some vars
#define dy _y2
#define CBEGIN (CCENTER-CLENGTH/2)
#define CEND (CCENTER + CLENGTH/2)
void touchTaskCb(void *this_, UCHAR length)
{
//Because we have Data, we need to read the event, or the Function will be called ever and ever again.
unsigned char dat[6]; // Parameter length will be 6, i know it :)
PTask_ReadEvent(this_,dat); //Read current Event
unsigned char penDown = dat[0];
unsigned char oldPenDown = dat[1];
unsigned int resX = dat[2]<<8 | dat[3];
unsigned int resY = dat[4]<<8 | dat[5];
unsigned char z;
if(penDown)
{
touchX=(((long)(DWIDTH-2*CCENTER)*2*(long)((long)resX-_x1)/dx+1)>>1)+CCENTER;
touchY=(((long)(DHEIGHT-2*CCENTER)*2*(long)((long)resY-_y1)/dy+1)>>1)+CCENTER;
// tftDrawPixel(touchX,touchY,WHITE);
if(!oldPenDown) //First Touch
{
for(z=0; z < NUM_AREAS; z++) // For every touch area
{
if(areas[z]!=NULL && touchX >= areas[z]->x1 && touchX <= areas[z]->x2 && touchY >= areas[z]->y1 && touchY <= areas[z]->y2 )
{
areas[z]->flags=1; //PenInside=1
if(areas[z]->hookedActions & PEN_DOWN)
areas[z]->callback(areas[z],PEN_DOWN);
}
}
}
else //Second, Third
{
for(z=0; z < NUM_AREAS; z++) // For every touch area
{
if(areas[z]!=NULL )
{
if(touchX >= areas[z]->x1 && touchX <= areas[z]->x2 && touchY >= areas[z]->y1 && touchY <= areas[z]->y2)
{
if(areas[z]->flags==0) //PenInside ==0
{
areas[z]->flags=1; //PenInside=1
if(areas[z]->hookedActions & PEN_ENTER)
areas[z]->callback(areas[z],PEN_ENTER);
}
}
else if(areas[z]->flags) //PenInside==1
{
areas[z]->flags=0; //PenInside=0
if(areas[z]->hookedActions & PEN_LEAVE)
areas[z]->callback(areas[z],PEN_LEAVE);
}
}
}
}
for(z=0; z < NUM_AREAS; z++) // For every touch area
{
if(areas[z]!=NULL && areas[z]->hookedActions&PEN_MOVE)
{
if(touchX >= areas[z]->x1 && touchX <= areas[z]->x2 && touchY >= areas[z]->y1 && touchY <= areas[z]->y2)
{
areas[z]->callback(areas[z],PEN_MOVE);
}
}
}
}
else
{
if(oldPenDown) //Was the pen ever down (or was it a too short touch)
{
for(z=0; z < NUM_AREAS; z++) // For every touch area
{
if(areas[z]!=NULL && touchX >= areas[z]->x1 && touchX <= areas[z]->x2 && touchY >= areas[z]->y1 && touchY <= areas[z]->y2 )
{
areas[z]->flags=0; //PenInside = 0;
if(areas[z]->hookedActions & PEN_UP)
areas[z]->callback(areas[z],PEN_UP);
}
}
}
touchX=0xFFFF;
touchY=0xFFFF;
}
}
void touchInit (void)
{
//SPI D1 Touch
USARTD1.BAUDCTRLA = 255;
USARTD1.BAUDCTRLB = 0;
USARTD1.CTRLB |= USART_RXEN_bm | USART_TXEN_bm; //Receive Enable, Transmit Enable
USARTD1.CTRLC |= USART_CMODE_MSPI_gc; //Master SPI Mode
USARTD1.CTRLA = USART_RXCINTLVL_LO_gc; //Interrupt Level0 Enabled
PORTD.DIRSET = Touch_SPI_SCK_bm | Touch_SPI_DOUT_bm; //SCK und TX
PORTD.PIN6CTRL = PORT_OPC_PULLUP_gc; //RX
PORTE.DIRSET = Touch_SPI_CS_bm;
PORTE.OUTSET = Touch_SPI_CS_bm; //Set CS
USARTD1.CTRLC &= ~(0x02); //UCPHA bit l<>schen
//Touch Interrupt
PORTD.DIRCLR = Touch_Interrupt_bm;
PORTD.INT0MASK = Touch_Interrupt_bm;
PORTD.PIN4CTRL |= PORT_OPC_PULLUP_gc;
PORTD.PIN4CTRL |= PORT_ISC_FALLING_gc;
PORTD.INTCTRL = PORT_INT0LVL_LO_gc;
TCD1.PER = (F_CPU / 256 / TIMER_FREQ) -1;
TCD1.INTCTRLA = TC_OVFINTLVL_LO_gc;
touchTask = PTask_AddTask(touchTaskCb,TOUCH_BASEPRIORITY,28,touchEvents);
//HACK this is just a bad Workaround, to prevent touch Problems after start
//you can also use: TCD1.CTRLA = TC_CLKSEL_DIV256_gc;
CLEAR_CS_TOUCH;
USARTD1.DATA = 0x90;
}
ISR(TCD1_OVF_vect)
{
TCD1.CTRLA = TC_CLKSEL_OFF_gc;
//TCD1.CNT = 0x00;
CLEAR_CS_TOUCH;
USARTD1.DATA = 0x90;
}
ISR (PORTD_INT0_vect)
{
PORTD.INTCTRL = PORT_INT0LVL_OFF_gc; //Deactivate INT0ISR
TCD1.CNT = 0x00;
TCD1.CTRLA = TC_CLKSEL_DIV256_gc; //Activate Timer
}
void touchCalibrate()
{
#define TOUCH_DEBUG //Define if Debug Values should be printed
tftClear(BLACK);
tftPrint_P(HWIDTH-27*8/2, HHEIGHT-6, WHITE, BLACK, SmallFont, PSTR("Tippe genau auf den Marker!"));
//-----------------First Point--------------------
tftDrawLine(CCENTER,CBEGIN,CCENTER,CEND,WHITE); //Draw Cross
tftDrawLine(CBEGIN,CCENTER,CEND,CCENTER,WHITE); //Draw Cross
calibration=1; //TouchX + TouchY Values will not be converted to Pixels
while(calibration); //Wait on PenUp
_x1=touchX;
_y1=touchY;
#ifdef TOUCH_DEBUG
tftPrintf_P(CEND+5,CEND+5,WHITE,BLUE, SmallFont, PSTR("X:0x%03X Y:0x%03X"),touchX,touchY);
#endif
tftFillRectangle(CBEGIN,CBEGIN,CEND,CEND,BLACK); //Clear Cross
//-----------------Second Point-------------------
tftDrawLine(DWIDTH-CCENTER,DHEIGHT-CBEGIN,DWIDTH-CCENTER,DHEIGHT-CEND,WHITE);
tftDrawLine(DWIDTH-CBEGIN,DHEIGHT-CCENTER,DWIDTH-CEND,DHEIGHT-CCENTER,WHITE);
calibration=1;
while(calibration);
_x2=touchX;
_y2=touchY;
#ifdef TOUCH_DEBUG
tftPrintf_P(DWIDTH-CEND-17*8,DHEIGHT-CEND-5-12,WHITE,BLUE, SmallFont, PSTR("X:0x%03X Y:0x%03X"),touchX,touchY);
#endif
tftFillRectangle(DWIDTH-CBEGIN,DHEIGHT-CBEGIN,DWIDTH-CEND,DHEIGHT-CEND,BLACK);
//-----------------Third Point--------------------
tftDrawLine(CCENTER,DHEIGHT-CBEGIN,CCENTER,DHEIGHT-CEND,WHITE);
tftDrawLine(CBEGIN,DHEIGHT-CCENTER,CEND,DHEIGHT-CCENTER,WHITE);
calibration=1;
while(calibration);
_x1+=touchX; //Add(!) values. We'll build the average later
_y2+=touchY;
#ifdef TOUCH_DEBUG
tftPrintf_P(CEND+5,DHEIGHT-CEND-5-12,WHITE,BLUE, SmallFont, PSTR("X:0x%03X Y:0x%03X"),touchX,touchY);
#endif
tftFillRectangle(CBEGIN,DHEIGHT-CBEGIN,CEND,DHEIGHT-CEND,BLACK);
//------------------4. Point---------------------
tftDrawLine(DWIDTH-CCENTER,CBEGIN,DWIDTH-CCENTER,CEND,WHITE);
tftDrawLine(DWIDTH-CBEGIN,CCENTER,DWIDTH-CEND,CCENTER,WHITE);
calibration=1;
while(calibration);
_x2+=touchX;
_y1+=touchY;
#ifdef TOUCH_DEBUG
tftPrintf_P(DWIDTH-CEND-17*8,CEND+5,WHITE,BLUE, SmallFont, PSTR("X:0x%03X Y:0x%03X"),touchX,touchY);
#endif
tftFillRectangle(DWIDTH-CBEGIN,CBEGIN,DWIDTH-CEND,CEND,BLACK);
//-------------------Calculation---------------------
_x1++; //Add 1 and divide by 2 later = +0.5 (for correct rounding)
_y1++;
_x2++;
_y2++;
_x1>>=1; //Divide by 2
_y1>>=1;
_x2>>=1;
_y2>>=1;
dx = (_x2-_x1); //Build the Difference
dy = (_y2-_y1);
#ifdef TOUCH_DEBUG
tftPrintf_P(2,HHEIGHT-6,WHITE,BLUE, SmallFont, PSTR("X1:0x%03X Y1:0x%03X DX:0x%03X DY:0x%03X"),_x1,_y1,dx,dy);
calibration=1;
while(calibration);
#endif
tftClear(BLACK); //Finish
//The Pixel Value is later calculated with a modified version of the basic therory about linear math functions
}
ISR (USARTD1_RXC_vect) //SPI Tranmission Finish Interrupt
{
static unsigned char state=0; //State
static unsigned int temp;
#if TOUCH_PRECISION > 255
static unsigned int run_number=0;
#else
static unsigned char run_number=0;
#endif
#if TOUCH_PRECISION > 16
static unsigned long sum=0;
#else
static unsigned int sum=0;
#endif
static unsigned int resX; //Result X (unconverted)
static unsigned int resY; //Result Y (unconverted)
static BOOL penDown;
static BOOL oldPenDown=0;
switch(state)
{
case 0: //Same Code for State 0 and 3
case 3:
//Called after Starting a Conversation
USARTD1.DATA; // Read SPI Data (Necessary for AVR Platfrom)
USARTD1.DATA = 0x00; //Send a zero (and receive the first databyte later)
state++; //Go to next state (at next Interrupt)
break;
case 1: //Same Code for State 1 and 4
case 4:
temp = ((unsigned int)USARTD1.DATA<<5); //Save First Databyte (See Manual for Details about shifting)
USARTD1.DATA = 0x00; //Send a zero again (and receive the second and last databyte later)
state++;
break;
case 2:
temp|=((unsigned int)USARTD1.DATA>>3); //Save Second Databyte
sum+=temp; //Add Value to Sum (for Average)
if(run_number++< (TOUCH_PRECISION-1)) //If NOT Enough Values taken
{
USARTD1.DATA=0x90; //Start another X Conversation
state=0; //Repeat States
}
else //Enough Values received
{
USARTD1.DATA=0xD0; // Start first Y Conversation
resX=sum / TOUCH_PRECISION; //Calculate X Average
run_number=0;
sum=0;
state++; //Go on
}
break;
case 5:
temp|=((unsigned int)USARTD1.DATA>>3);
sum+=temp;
if(run_number++< (TOUCH_PRECISION-1)) //If NOT Enough Values taken
{
USARTD1.DATA=0xD0; //Start another Y Conversation
state=3; //Repeat States
}
else //Enough Values received
{
resY=sum / TOUCH_PRECISION; //Calculate Y Average
run_number=0; //Reset Values for next Time
sum=0;
state=0;
SET_CS_TOUCH; //Disable Touch
penDown=(resX!=0xFFF); //Flag if Pen is down
//------------------Analysis------------------
if(calibration) //If in Calibration mode
{
if(penDown)
{
touchX=resX; //Set Touch X directly (without Conversation)
touchY=resY;
TCD1.CTRLA = TC_CLKSEL_DIV256_gc; //Activate Timer
}
else
{
if(oldPenDown) //Run only if we got at least one pen down
calibration=0; //Calibration finish (Touch X and Y are the values from the last measure, where the pen was down)
PORTD.INTFLAGS = PORT_INT0IF_bm; // Clear Interrupt Flag (For preventing an other interrupt after activation)
PORTD.INTCTRL = PORT_INT0LVL_LO_gc;
}
}
else //Normal Mode
{
PTask_QueueEvent(touchTask,6,penDown,oldPenDown,resX>>8,resX&0x00FF,resY>>8,resY&0x00FF);
if(penDown)
{
TCD1.CNT = 0x00;
TCD1.CTRLA = TC_CLKSEL_DIV256_gc; //Activate Timer
}
else
{
PORTD.INTFLAGS = PORT_INT0IF_bm; // Clear Interrupt Flag (For preventing an other interrupt after activation)
PORTD.INTCTRL = PORT_INT0LVL_LO_gc;
}
}
oldPenDown=penDown; //Set old value (for edge detection)
//tftPrintf_P(10,HHEIGHT-10,WHITE,BLACK,SmallFont,PSTR("penDown (%1u)"),penDown);
}
break;
}
}
BOOL touchHaveEmpty(unsigned char num)
{
for(unsigned char i=0; i<NUM_AREAS; i++)
{
if(areas[i]==NULL) num--;
if(num==0) return TRUE;
}
return FALSE;
}
BOOL touchRegisterArea(TOUCH_AREA_STRUCT* area) //Registers an Area (fill Struct first). Return FALSE if no more Space in the Pointertable (-->Change NUM_AREAS).
{
for(unsigned char i=0; i<NUM_AREAS; i++)
{
if(areas[i]==NULL)
{
area->flags=0;
areas[i]=area;
return TRUE;
}
}
return FALSE;
}
void touchUnregisterArea(TOUCH_AREA_STRUCT* area)//Unregisters an Area
{
for(unsigned char i=0; i<NUM_AREAS; i++)
{
if(areas[i]==area)
{
areas[i]=NULL;
break;
}
}
}

27
src/Touch/touch.h Normal file
View File

@@ -0,0 +1,27 @@
typedef enum {NONE=0x00,PEN_DOWN=0x01, PEN_UP=0x02, PEN_ENTER=0x04, PEN_LEAVE=0x08,PEN_MOVE=0x10} TOUCH_ACTION;
typedef void (*TOUCH_CALLBACK)(void* touchArea, TOUCH_ACTION triggeredAction);
typedef struct {
TOUCH_ACTION hookedActions; //Actions to listen to
unsigned int x1; //Top Left X Coordiate of Area
unsigned int y1; //Top Left Y Coordiate of Area
unsigned int x2; //Bottom Right X Coordiate of Area
unsigned int y2; //Bottom Right Y Coordiate of Area
TOUCH_CALLBACK callback; //Callback
UCHAR flags; //Internal Used, don't change
} TOUCH_AREA_STRUCT;
extern volatile int touchY;
extern volatile int touchX;
extern void touchInit();
extern void touchCalibrate();
extern BOOL touchHaveEmpty(unsigned char num);
extern BOOL touchRegisterArea(TOUCH_AREA_STRUCT* area);
extern void touchUnregisterArea(TOUCH_AREA_STRUCT* area);

142
src/settings.h Normal file
View File

@@ -0,0 +1,142 @@
// Select Display Controller:
//CONTROLLER_SSD1289 //Normal 3.2" 240*320
//CONTROLLER_ILI9327 //Widescreen 3.2" 240*400
#define FLASH_INT_ARR(name, size) prog_uint16_t name[size] PROGMEM
#define FLASH_INT_ARR_POINTER prog_uint16_t*
#define FLASH_INT_ARR_READ pgm_read_word
#define FLASH_CHAR_ARR(name, size) prog_uint8_t name[size] PROGMEM
#define FLASH_CHAR_ARR_POINTER prog_uint8_t*
#define FLASH_CHAR_ARR_READ pgm_read_byte
#define F_CPU 58000000UL //f<>r die Delay Funktionen, uC Takt ist 2MHz wenn CLK.CTRL nicht gesetzt wird im Init_Device
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#ifndef NULL
#define NULL ((void *) 0)
#endif
//Sysclock: 8MHz blablablablablablablablablablablablablablabla
//Data Low: PORTB
//Data High: PORTD
//Noch nicht umgesetzt:
//SPI: P0.0 - P0.2 (NSS muss leider freibleiben, kann nicht deaktiviert werden - scheiss Mesa)
//SPI CS: z.b P4.1
//PENIRQ (INT0): P0.4
//RS: P0.5
//WR: P0.6
//RESET: P0.7
//CS: P4.0 (Leider nicht mehr bitadressierbar)
#define DATAPORT_LOW_DDR PORTF
#define DATAPORT_HIGH_DDR PORTB
#define DATAPORT_LOW(val) PORTF.OUT=val
#define DATAPORT_HIGH(val) PORTB.OUT=val
/*
#define RS 5
#define WR 4
//#define RD PC2
#define CS 7
#define RESET 0
*/
//Akku ON/OFF
#define Batt_ON_bm 0x20 //PortC
//Buzzer
#define Buzzer_bm 0x01 //PortE
//#define Freq_Buzzer_bm 0x01 //PortE
//LED
#define LED_bm 0x10 //PortC
//#define PWM_LED_bm 0x10 //PortC
//Battlader an PortA
#define Batt_STAT1_bp 4 //PortA
#define Batt_STAT1_bm 0x10 //PortA
#define Batt_STAT2_bp 6 //PortA
#define Batt_STAT2_bm 0x40 //PortA
#define Batt_STATPG_bp 5 //PortA
#define Batt_STATPG_bm 0x20 //PortA
#define Batt_STATPINS_bm 0x70 //PortA
#define Batt_FastCharge_bp 7 //PortA
#define Batt_FastCharge_bm 0x80 //PortA
#define Batt_STATUS_SHUTDOWN (Batt_STAT1_bm|Batt_STAT2_bm|Batt_STATPG_bm) //111
#define Batt_STATUS_STANDBY (Batt_STAT1_bm|Batt_STAT2_bm) //110
#define Batt_STATUS_CHARGE (Batt_STAT2_bm) //010
#define Batt_STATUS_CHARGEC (Batt_STAT1_bm) //100
#define Batt_STATUS_TEMPFAULT (Batt_STAT1_bm|Batt_STAT2_bm) //110
#define Batt_STATUS_TESTMODE 0 //000
//Messpunkt f<>r die Akkuspannung der Schaltung @ PortA
#define MP_Batt_bm 0x02
#define MP_Batt_bp 1
//Messpunkt f<>r die Eingangsspannung der Schaltung @ PortA
#define MP_Vin_bm 0x01
#define MP_Vin_bp 0
//G Sensor
#define Sensor_Connected_bm 0x08 //PortA
#define Sensor_Connected_bp 3 //PortA
#define Sensor_Interrupt_bm 0x02 //PortR
#define Sensor_Interrupt_bp 1 //PortR
#define Sensor_Reset_bm 0x01 //PortR
#define Sensor_Reset_bp 0 //PortR
#define Sensor_SPI_CS_bm 0x04 //PortA
#define Sensor_SPI_DIN_bm 0x04 //PortC //DIN und DOUT sind im Schema anders!
#define Sensor_SPI_DOUT_bm 0x08 //PortC //DIN und DOUT sind im Schema anders!
#define Sensor_SPI_SCK_bm 0x02 //PortC
#define Sensor_SET_CS PORTA.OUTSET = Sensor_SPI_CS_bm
#define Sensor_CLR_CS PORTA.OUTCLR = Sensor_SPI_CS_bm
//Display
#define Display_Dataport_L PORTF //Die ersten 8 Bit des Datenport
#define Display_Dataport_H PORTB //Die letzen 8 Bit des Datenport
#define Display_Backlight_bm 0x01 //PortC
#define Display_CTRL_RS_bm 0x20 //PortE
#define Display_CTRL_WR_bm 0x10 //PortE
#define Display_CTRL_RD_bm 0x08 //PortE
#define Display_CTRL_CS_bm 0x80 //PortC
#define Display_CTRL_RESET_bm 0x01 //PortD
//SD
#define SD_SPI_CS_bm 0x40 //PortC
#define SD_SPI_SCK_bm 0x02 //PortD
#define SD_SPI_DOUT_bm 0x08 //PortD //DIN und DOUT sind im Schema anders!
#define SD_SPI_DIN_bm 0x04 //PortD //DIN und DOUT sind im Schema anders!
//Touch
#define Touch_SPI_CS_bm 0x04 //PortE
#define Touch_SPI_SCK_bm 0x20 //PortD
#define Touch_SPI_DOUT_bm 0x80 //PortD //DIN und DOUT sind im Schema anders!
#define Touch_SPI_DIN_bm 0x40 //PortD //DIN und DOUT sind im Schema anders!
#define Touch_Interrupt_bm 0x10 //PortD
#define Touch_Busy_bm 0x02 //PortE
#define SET_RS PORTE.OUTSET = Display_CTRL_RS_bm
#define CLEAR_RS PORTE.OUTCLR = Display_CTRL_RS_bm
#define SET_WR PORTE.OUTSET = Display_CTRL_WR_bm
#define CLEAR_WR PORTE.OUTCLR = Display_CTRL_WR_bm
#define SET_RD PORTE.OUTSET = Display_CTRL_RD_bm
#define CLEAR_RD PORTE.OUTCLR = Display_CTRL_RD_bm
#define SET_CS PORTC.OUTSET = Display_CTRL_CS_bm
#define CLEAR_CS PORTC.OUTCLR = Display_CTRL_CS_bm
#define SET_RESET PORTD.OUTSET = Display_CTRL_RESET_bm
#define CLEAR_RESET PORTD.OUTCLR = Display_CTRL_RESET_bm
#define SET_CS_TOUCH PORTE.OUTSET = Touch_SPI_CS_bm
#define CLEAR_CS_TOUCH PORTE.OUTCLR = Touch_SPI_CS_bm