Example #1
0
static int PD_Read(MWCOORD *px, MWCOORD *py, MWCOORD *pz, int *pb)
{
   short m_button = 0;
   short tp_x = -1;
   short tp_y = -1;

   get_touch(&m_button,&tp_x,&tp_y);
   *px = tp_x;
   *py = tp_y;
   *pb = (m_button == 1?MWBUTTON_L:0);
	*pz = 0;

  	if((*px == -1 || *py == -1) && *pb == MWBUTTON_L)
     	return 3;			/* only have button data */
   else if((*px == -1 || *py == -1) && *pb == 0)
		return 0;			/* don't have any data   */
	else
	   return 2;			/* have full set of data */
}
Example #2
0
void main() {
unsigned int x=0;
char txt[7];
char pins;
unsigned int clpin[8];
config();
flash();
uart1_init(9600);
uart1_write_text("hello");
clpin[0]=touch(0);
clpin[1]=touch(1);
clpin[2]=touch(2);
clpin[3]=touch(3);
clpin[4]=touch(8);
clpin[5]=touch(9);
clpin[6]=touch(10);
clpin[7]=touch(12);
while(1)
{
//delay_ms(100);
uart1_write_text("pin=");
x=touch(2);
inttostr(x,txt);
uart1_write_text(txt);
uart1_write(13);
uart1_write_text("pin=");
pins=get_touch(clpin);
inttostr(pins,txt);
uart1_write_text(txt);
uart1_write(13);

led(pins);


}




}
Example #3
0
void md_init_no_logo(void)
{
u08 force_setup;

    cli();    // disable interrupts
    hw_init();

#ifdef MOUSE_UART3
sbi(PORTD, 7); cbi(DDRD, 7);   //!!!! mouse uart
sbi(PORTD, 6); sbi(DDRD, 6);   //!!!! mouse uart
#endif

    sei();    // enable interrupts - the Donkey is off and running

    #ifdef TIME_CLOCK
       if(1) {   //!!! for time clock maximum wrap test
          time.hours= 23;
          time.mins = 59;
          time.secs = 00;
          time.month = 12;
          time.day  = 31;
          time.year = 2007;
          time.weekday = 6;
          time.adjust = 0;
       } 
    #endif

#ifdef PANEL_CODE
    lcd_init();          // initialize LCD hardware
    lcd_set_stdout();    // make printf() use bitmapped chars
#endif

#ifdef VCHAR_CODE
//  vchar_init();        // initialize vector characters
//  vchar_set_stdout();  // make printf use vector chars
#endif

    lcd_backlight(0xFF);

    force_setup = 0;
    user_input_init();

#ifdef CKSUM_CODE
    check_flash(DELAY_FLAG);   // verify FLASH checksum - can also add HALT_FLAG
#endif

#ifdef CKPT_CODE
    check_point(0);   // see if last run produced a system RAM checkpoint dump to eeprom
#endif

void contrast_demo(void);
//contrast_demo();

//zadc_demo(2);
//sketch_a_etch();

//void gps_demo(void);
//gps_demo();

//fill_screen(BLACK);
//arc(80,40, 20, 30,170, 10);
//arc(80,40, 10, 40,160, 1);
//wait_until_touched();
//wait_while_touched();


#ifdef USER_INPUT
    delay_ms(10);  // allow some time to pass
	               // might be needed for first get_touch?

    if(get_touch(1) || MouseRB || MouseLB) {   // if screen touched on powerup,  force setup menus
       lcd_clear();
       force_setup = 1;
       set_charsize(3);
       lcd_textPS(0, 0, "Setup");
       set_charsize(1);
//     wait_while_touched();        // not a good idea.  touch cal could be off
       delay_ms(2000);
    }

    calibrate_touch(force_setup);   // calibrate touch screen if not already done 

    misc_setup(force_setup);        // setup backlight, etc, if not already done

    #ifdef UART0   // do com0 setup menu, if not already done or forced setup
       com_setup(0, force_setup);     
    #endif

    #ifdef UART1   // do com1 setup menu, if not already done or forced setup
       com_setup(1, force_setup);
    #endif
#endif   // no user input device: set default com port parameters


// if library build then do donkey splash screen for 2.5 seconds

#ifdef LIBRARY_BUILD
  lcd_clear();
#endif

#ifdef MENU_CODE
 MenuBeep = 1; 
#endif


}