/* ELAVR32 - dependend user-functionality, like setting the time, ...... */ #ifndef ___usr_h #define ___usr_h #include "../../inc/global.h" #define KEY_SUBACK KEY_FUNC0 #define KEY_MENU KEY_FUNC1 #define KEY_NAK KEY_FUNC2 #define KEY_ACK KEY_FUNC3 #define KEY_STOP_MOT KEY_FUNC0 #define KEY_MENU_LEFT KEY_FUNC1 #define KEY_MENU_RIGHT KEY_FUNC2 #define KEY_ACK_MENU KEY_FUNC3 extern void printDateTime(void); //a cancel with KEY_NAK returns 0, otherwise 1 is returned. extern int setusrDate(unsigned char row); //a cancel with KEY_NAK returns 0, otherwise 1 is returned. extern int setusrTime(unsigned char row); //for numbers 0..9 top should be 0x30, and bottom 0x39, and start inside this range. //for chars A..Z top should be 0x31, and bottom 0x5a, and start inside this range. //for chars a..z top should be 0x61, and bottom 0x7a, and start inside this range. //a cancel with KEY_NAK returns the value of start extern unsigned char usr_choose_nr(unsigned char row, unsigned char pos,unsigned char top, unsigned char bottom, unsigned char start ); //start must be one of '+', or '-' //a cancel with KEY_NAK returns the value of start extern unsigned char usr_choose_sign(unsigned char row, unsigned char pos,unsigned char start ); //prints a double as string in the format //example: //+024.12345000000 //max number is +/- 999.99999999999 //min number is +/- 000.00000000001 //normally used for printing degrees, startime, or //hours in a decimal value. //if trg not NULL function also writes the internal formated string //to trg, which should provide place for 17 bytes. extern void printDoubleDegree(unsigned char row, double val, char *trg); //a cancel with KEY_NAK returns the value of init extern double setusrDoubleDegree( unsigned char row,double init ); //prints a long to row like example: //+0000012345 extern void printLong(unsigned char row, long val); //a cancel with KEY_NAK returns the value of init extern long setusrLong( unsigned char row,long init ); //prints an int to row like example: //+00020 extern void printInt(unsigned char row, int val); //a cancel with KEY_NAK returns the value of init extern int setusrInt( unsigned char row,int init ); //mode: 0 val is a value representing a value in hours like 23,..... //mode: 1 val is a value representing a value in arcseconds //mode: 2 val is a value representing a value in 1/10 arcseconds //mode: >=3 val is a value representing a value in degrees like 160,.... //hours: 0 output is done as degrees in form +000.00.00 degrees:arcminutes:arcseconds ( like dec,alt,az ) //hours: 1 output is done as hours in form +000:00:00 hours:minutes:seconds ( like ra ) //if trg not NULL, the formatted string will also be stored to trg, which have to be //point to a string with 12 chars. extern void printDegrees(unsigned char row, double val, char mode, char hours, char *trg); extern unsigned char usr_choose_table( unsigned char row, char max, char start, const prog_char * ptr, unsigned char len ); extern const prog_char row_yesno[2][4]; extern const prog_char row_onoff[2][4]; extern const prog_char row_cfg[4][6]; extern const prog_char row_view[5][6]; extern const prog_char row_motms[5][4]; extern const prog_char row_usechange[3][4]; extern const prog_char row_blank[17]; #define usr_choose_yesno(row,start) usr_choose_table(row,1,start,(char *)&row_yesno,4) #define setusrFlag(row,start) usr_choose_table(row,1,start,(char *)&row_onoff,4) #define usr_choose_onoff(row,start) usr_choose_table(row,1,start,(char *)&row_onoff,4) #define usr_choose_cfg(row,start) usr_choose_table(row,3,start,(char *)&row_cfg,6) #define usr_choose_view(row,start) usr_choose_table(row,4,start,(char *)&row_view,6) #define usr_choose_motms(row,start) usr_choose_table(row,4,start,(char *)&row_motms,4) #define usr_choose_usechange(row,start) usr_choose_table(row,2,start,(char *)&row_usechange,4) #define usr_choose_usecancel(row,start) usr_choose_table(row,1,start,(char *)&row_usechange,4) extern void showRaDec( struct RADECKOOR *koor ); extern unsigned char setusrRaDec( struct RADECKOOR *koor ); #endif