int main() { Clr_BUFFER_FLAG(); alt_video_display Display; TOUCH_HANDLE *pTouch; printf("Hi There !\n"); // Write 0x3C on LED[6:0] through the dedicated custom IP IOWR(LED_CTRL_BASE, 0x0, 0x3C); // TOUCH INITIALIZATION pTouch = Touch_Init(LT24_TOUCH_SPI_BASE, LT24_TOUCH_PENIRQ_N_BASE, LT24_TOUCH_PENIRQ_N_IRQ); if (!pTouch){ printf("Failed to init touch\r\n"); }else{ printf("Init touch successfully\r\n"); } // LCD INITIALIZATION LCD_Init(); // my_GUI Clr_BUFFER_FLAG(); Display.interlace = 0; Display.bytes_per_pixel = 2; Display.color_depth = 16; Display.height = SCREEN_HEIGHT; Display.width = SCREEN_WIDTH; my_GUI(&Display, pTouch); return 0; }
void Sys_Init(void) { hostInitialized = true; aptHook(&sysAptCookie, sysAptHook, NULL); Touch_Init(); Touch_DrawOverlay(); }
/** * @brief 主函数 * @param 无 * @retval 无 */ int main(void) { /* LED 端口初始化 */ LED_GPIO_Config(); /* 初始化触屏 */ Touch_Init(); /* 初始化定时器 */ SysTick_Init(); /*CRC和emWin没有关系,只是他们为了库的保护而做的,这样STemWin的库只能用在ST的芯片上面,别的芯片是无法使用的。 */ RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE); /* 初始化GUI */ GUI_Init(); /* 初始化串口*/ USART1_Config(); DEBUG("\r\n wildfire ISO board emWin test \r\n"); GUI_Delay (20); /* 触摸校准demo */ Touch_MainTask(); }
/** * @brief 主函数 * @param 无 * @retval 无 */ int main(void) { /* 系统定时器 1us 定时初始化 */ SysTick_Init(); LCD_Init(); /* GRAM扫描方向为左下脚->右上角 */ Lcd_GramScan(2); LCD_Clear(0, 0, 320, 240, BACKGROUND); /*------------------------------------------------------------------------------------------------------*/ /* 触摸屏IO和中断初始化 */ Touch_Init(); /* 等待触摸屏校正完毕 */ while(Touch_Calibrate() !=0); /* 触摸取色板初始化 */ Palette_Init(); while( 1 ) { if(touch_flag == 1) /*如果触笔按下了*/ { /*获取点的坐标*/ if(Get_touch_point(&display, Read_2046_2(), &touch_para ) !=DISABLE) { Palette_draw_point(display.x,display.y); } } } }
/* * 初始化液晶,串口,触摸屏,flash及sd卡 * */ void ISO_Init(void) { uint8_t k; /* 液晶初始化先于串口,不然会有bug,至于是什么原因我也不知道:( */ LCD_Init(); LCD_Clear(0,0,240,320,WHITE); LCD_DispStr(20,150,"board init,please wait... ",RED); USART1_Config(); /* 初始化sd卡文件系统,因为汉字的字库放在了sd卡里面 */ Sd_fs_init(); #ifdef WORD_MODE /* 显示界面图片 */ Lcd_show_bmp(0, 0,"/boardtest/boardtest.bmp"); #else /* 显示界面图片 */ Lcd_show_bmp(0, 0,"/boardtest/ISO/ui_boardtest.bmp"); #endif Lcd_List(1); /* 初始化外部FLASH */ SPI_FLASH_Init(); //SPI_FLASH_SectorErase(0); /* 触摸屏IO和中断初始化 */ Touch_Init(); /*-------------------------------------------------------------------------------------------------------*/ #if 1 SPI_FLASH_BufferRead(&cal_flag, 0, 1); if( cal_flag == 0x55 ) { SPI_FLASH_BufferRead((void*)cal_p, 1, sizeof(cal_p)); SPI_FLASH_CS_HIGH(); for( k=0; k<6; k++ ) printf("\r\n rx = %LF \r\n",cal_p[k]); } else { /* 等待触摸屏校正完毕 */ while(Touch_Calibrate() !=0); } #elif 0 /* 等待触摸屏校正完毕 */ while(Touch_Calibrate() !=0); #endif }
void BSP_Init(void) { Key_Init(); LED_Init(); //MyLCD_Init(); Touch_Init(); SysTick_Init(); }
int main(void) { // unsigned long x, a, b, c, d; // char cool[5]; //int i = 0; SysTick_Init(); ADC_Init(1); PORTG_Init(1); PORTD_Init(); PORTA_Init(); PORTF_Init(); PORTB_Init(); PORTE_Init(1); PORTH_Init(); LCD_Init(); Touch_Init(); Camera_Init(); /* while(1) { x = ADC_In(); a = x/1000; x -= a * 1000; b = x/100; x -= b * 100; c = x/10; x -= c * 10; d = x; cool[0] = (char)(a + 48); cool[1] = (char)(b + 48); cool[2] = (char)(c + 48); cool[3] = (char)(d + 48); cool[4] = 0; TFT_Fill(purple); TFT_Text(&cool[0], 50, 50, 16, black, purple); } */ while(1) { GPIO_PORTG_DATA_R ^= 0x04; if(ADC_In() != 1023) { TFT_Fill(yellow); } else { TFT_Fill(purple); } } //TFT_H_Line(50,150,50,black); // return 1; }
int main(void) { u8 key; u8 i=0; SystemInit(); delay_init(72); //延时初始化 NVIC_Configuration(); uart_init(9600); LED_Init(); KEY_Init(); LCD_Init(); POINT_COLOR=RED;//设置字体为蓝色 LCD_ShowString(60,50,"Mini STM32"); LCD_ShowString(60,70,"TOUCH TEST"); LCD_ShowString(60,90,"ATOM@ALIENTEK"); LCD_ShowString(60,110,"2011/1/1"); LCD_ShowString(60,130,"Press KEY0 to Adjust"); Touch_Init(); delay_ms(1500); Load_Drow_Dialog(); while(1) { key=KEY_Scan(); if(Pen_Point.Key_Sta==Key_Down)//触摸屏被按下 { Pen_Int_Set(0);//关闭中断 do { Convert_Pos(); Pen_Point.Key_Sta=Key_Up; if(Pen_Point.X0>216&&Pen_Point.Y0<16)Load_Drow_Dialog();//清除 else { Draw_Big_Point(Pen_Point.X0,Pen_Point.Y0);//画图 GPIOC->ODR|=1<<1; //PC1 上拉 } }while(PEN==0);//如果PEN一直有效,则一直执行 Pen_Int_Set(1);//开启中断 }else delay_ms(10); if(key==1)//KEY0按下,则执行校准程序 { LCD_Clear(WHITE);//清屏 Touch_Adjust(); //屏幕校准 Save_Adjdata(); Load_Drow_Dialog(); } i++; if(i==20) { i=0; LED0=!LED0; } }; }
int main() { Clr_BUFFER_FLAG(); alt_video_display Display; TOUCH_HANDLE *pTouch; printf("Hi There !\n"); // Write 0x3C on LED[6:0] through the dedicated custom IP IOWR(LED_CTRL_BASE, 0x0, 0x3C); // TOUCH INITIALIZATION pTouch = Touch_Init(LT24_TOUCH_SPI_BASE, LT24_TOUCH_PENIRQ_N_BASE, LT24_TOUCH_PENIRQ_N_IRQ); if (!pTouch){ printf("Failed to init touch\r\n"); }else{ printf("Init touch successfully\r\n"); } // LCD INITIALIZATION LCD_Init(); // Pattern example //LCD_Pattern_Horizon(); // Sleep 3s //usleep(3*1000*1000); Set_BUFFER_FLAG(); unsigned int X, Y; unsigned int posTamper =0; while(1){ if(Touch_GetXY(pTouch, &X, &Y)){ //printf("X: %d Y: %d\n",X,Y); LCD_WR_DATA(Y); LCD_WR_REG(X); //we can modify the character (the image become progressively red when we touch it), we might do the same for the background IOWR_16DIRECT(PIC_MEM_BASE,posTamper,0xF800); posTamper++; } } // Painter demo /*Clr_BUFFER_FLAG(); Display.interlace = 0; Display.bytes_per_pixel = 2; Display.color_depth = 16; Display.height = SCREEN_HEIGHT; Display.width = SCREEN_WIDTH; GUI(&Display, pTouch);*/ return 0; }
/*! * @brief Initialisation thread. runs once. */ void InitThread(void *data) { for (;;) { OS_SemaphoreWait(InitSemaphore, 0); Random_Init(); //Switches mate Switch_Init(S1Callback, (void *) 0, S2Callback, (void *) 0); Toggle_Init(ToggleModeFinished); Game_Init(GameModeFinished); Touch_Init(); //Initialize all the modules LEDs_Init(); I2C_Init(100000, MODULE_CLOCK); Accel_Init(&AccelSetup); PIT_Init(MODULE_CLOCK, &PitCallback, (void *) 0); PIT_Set(500000000, bFALSE); PIT_Enable(bTRUE); Packet_Init(BAUD_RATE, MODULE_CLOCK); Flash_Init(); CMD_Init(); //Best to do this one last //TODO: disabled for yellow RTC_Init((void (*)(void*))OS_SemaphoreSignal, (void *) RtcSemaphore); Timer_Init(); Timer_Set(&PacketTimer); Timer_Set(&AccTimer); CMD_SpecialGetStartupValues(); LEDs_On(LED_ORANGE); } }
void Hardware_::Init() { BOARD_INIT(); // Resetting because of a brownout power goes down. // Stay down buddy if (MCUSR == 4) PowerOff(); // now in bootloader Backlight_Init(); Timer_Init(); Accelerometer_Init(); ADC_Init(); USBInit(); Touch_Init(); sei(); // Attach stdout to usb serial StdOutInit(); }
int main(void){ HeartBeat_Init(); DAC_Init(1024); // initialize with command: Vout = Vref Timer0A_Init(dt[0]); LCD_Init(); // Initialize RNG Random_Init(121213); // Initialize touchscreen GPIO Touch_Init(); //lenPush = 1; //for(i=0; i<50; i=i+1){ InitializeBars(); for(i=0; i<400; i=i+1){ MovingColorBars(); } for(i=0; i<400; i=i+1){ DestabilizeBars(); } for(i=0; i<350; i=i+1){ FinishBars(); } for(i=0; i<1000; i=i+1){ Random4BPPTestSprite(); } LCD_ColorFill(convertColor(0, 0, 0)); Buttons_Init(); play = 0; while(1){ if (instrument == 0){ Music_Play(Wave[0], 64, strobePtr, 35); } if (instrument == 1){ Music_Play(Trumpet[0], 32, strobePtr, 35); } if (instrument == 2){ Music_Play(Flute[0], 32, strobePtr, 35); } } }
/************************************************************************************* * 函数名称:main() * 参数 :void * 返回值 :void * 描述 :程序主入口main函数 *************************************************************************************/ int main(void) { u16 i,j; u16 t=0; /*****************************初始化****************************************/ //初始化系统时钟,设置时钟为168Mhz // LED_Init(); SysTick_Init(168); TIM4_Init(); // TIM3_init();//pwm TIM5_PWM_Init(); TIM5_PWM_OUTPUT(40,20,10,50); COM6_Init(115200);//串口6初始化 bsp_InitDAC();//这样初始化adc和dac不会出问题 bsp_InitADC(); bsp_InitDAC(); TFTLCD_Init(); Touch_Init(); //EXTI_Configuration(); GUI_Init(); //GUI 初始化 GUI_Clear(); Timer2_Init(20); //初始化LED的GPIO配置 WaveTaskCreat(); while(1) { if(Wave_updat == 1) { Get_Signal(); //Clculate_Signal(); } Updata_signal(); GUI_Exec(); } }
/********************************************************************* * * LCD_X_DisplayDriver * * Function description: * This function is called by the display driver for several purposes. * To support the according task the routine needs to be adapted to * the display controller. Please note that the commands marked with * 'optional' are not cogently required and should only be adapted if * the display controller supports these features. * * Parameter: * LayerIndex - Index of layer to be configured * Cmd - Please refer to the details in the switch statement below * pData - Pointer to a LCD_X_DATA structure * * Return Value: * < -1 - Error * -1 - Command not handled * 0 - Ok */ int LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void * pData) { int r; (void) LayerIndex; (void) pData; switch (Cmd) { case LCD_X_INITCONTROLLER: { // // Called during the initialization process in order to set up the // display controller and put it into operation. If the display // controller is not initialized by any external routine this needs // to be adapted by the customer... // // ... Lcd_Init(); Touch_Init(); return 0; } default: r = -1; } return r; }
void AppTaskGUI(void *p_arg) { // uint8_t i; GUI_COLOR Colorsback; OS_ERR err; OSTimeGet(&err); (void) p_arg; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_CRC, ENABLE); // ¿ªÆôCRC ¹¦ÄÜ Lcd_Init(); // LCD ³õʼ»¯ Touch_Init(); // ÏÔʾÆÁ³õʼ»¯ WM_SetCreateFlags(WM_CF_MEMDEV); // ¿ªÆô ´°¿Ú ÄÚ´æÔÊÐí GUI_Init(); // £Ç£Õ£É¿ªÊ¼ GUI_Clear(); // ÇåÆÁ // FistPageDrawLine(); // CPU_SR_ALLOC(); // CPU_CRITICAL_ENTER(); // ½ûÖ¹ÖÐ¶Ï backWIn_init(); //µ÷ÓÃÏÔʾÆÁÏÔʾ½çÃæ Draw_init(); // GUI_CURSOR_Show(); //ÏÔʾָÕë pageChangFlag=0; while(1) { if(pageChangFlag) { GUI_SelectLayer(1); GUI_TOUCH_SetLayer(1); Colorsback=GUI_GetBkColor(); GUI_SetBkColor(GUI_DARKBLUE); GUI_SetFont(GUI_FONT_8X16); GUI_DispStringAt("Station : ",10,10); GUI_DispDec(pageChangFlag,1); GUI_GotoXY(98,39); GUI_DispFloat(getInformation[pageChangFlag-1].K_tmp,4); GUI_GotoXY(98,58); GUI_DispFloat(getInformation[pageChangFlag-1].K_hemo,4); GUI_GotoXY(336,39); GUI_DispFloat(getInformation[pageChangFlag-1].T_tmp,4); GUI_GotoXY(336,58); GUI_DispFloat(getInformation[pageChangFlag-1].T_hemp,4); GUI_SetBkColor(Colorsback); DrawingNewAnew(pageChangFlag); COMAND=0x04; // ÏÔʾҳÃæ DATA=1; GUI_Delay(100); }else { GUI_SelectLayer(0); GUI_TOUCH_SetLayer(0); COMAND=0x04; // ÏÔʾҳÃæ DATA=0; showShuJu(); } GUI_Delay(300); } }
/**************************************************************/ //程 序 名: main() //开 发 者: MingH //入口参数: 无 //功能说明: 主函数 //**************************************************************/ int main(void) { unsigned char err_code; RCC_Config(); // 时钟初始化配置 Beep_Init(); // 蜂鸣器初始化配置 Touch_Init(); Pcie_Gpio_Init(); Tim3_Init(); RGB_Init(); //RGB 初始化 RCC_GetClocksFreq(&RCC_ClockFreq); SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK); USB2Serial_Init(); // 串口初始化配置 Pwm_Init(); Adc_Init(); I2C_GPIO_Configuration(); err_code = LIS3DH_Init(); if (NO_ERROR == err_code) { printf("\r\nLIS3DH Init is succeed! \r\n"); } else { printf("\r\nLIS3DH Init is failed! \r\n"); } RTC_Init(); // RTC 初始化配置 if(SD_Init() == SD_OK) { printf ("\r\n发现SD卡!\r\n"); } else { printf("\r\n没有发现 SD 卡设备! \r\n"); } printf("\r\n\r\n"); save_sd_detect = SD_Detect(); //初始化SD卡插入状态 SysTick_Delay_ms(500); TIM_Cmd(TIM1, DISABLE); TIM_CtrlPWMOutputs(TIM1, DISABLE); while (1) { if(read_sd_detect_flag){ if (save_sd_detect != SD_Detect()){ /* 蜂鸣器响 */ TIM_Cmd(TIM1, ENABLE); TIM_CtrlPWMOutputs(TIM1, ENABLE); sd_detect_change = 1; //SD卡插入状态有变 buzzer_delay = 0; if (SD_Detect() != SD_NOT_PRESENT){ if(SD_Init() == SD_OK) { printf ("\r\n发现SD卡!\r\n"); } else { printf("\r\n没有发现 SD 卡设备! \r\n"); } printf("\r\n\r\n"); } } save_sd_detect = SD_Detect(); read_sd_detect_flag = 0; } Time_Show(); Test_Pcie_Gpio(); Touch_Key_Proc(); if (read_lis3dh_flag){ Collect_Data(ACCdata); for (i=0; i<3; i++){ if (oldACCdata[i] < ACCdata[i]){ ACCdiff[i] = ACCdata[i] - oldACCdata[i]; } else{ ACCdiff[i] = oldACCdata[i] - ACCdata[i]; } } RGB_Control(ACCdiff[0]<<1, ACCdiff[1]<<1, ACCdiff[2]<<1); for (i=0; i<3; i++){ oldACCdata[i] = ACCdata[i]; } read_lis3dh_flag = 0; } if (one_second_flag){ printf("X=%d, Y=%d, Z=%d\r\n\r\n", ACCdata[1], ACCdata[0], ACCdata[2]); Adc_Proc(); one_second_flag = 0; } } }
int main(void) { char * s = "abcdefghijklmnopqrstuvwxyz"; char * s2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; char * s3 = "~!@#$%^&*()_+-=1234567890"; char adc_str[30]; unsigned int adc_data; unsigned int last_adc = 0; unsigned int dcolor = 0; unsigned int adc_avg = 0; int i = 0; GraphicsInit(); drawScreen( BLACK ); drawBox( 30, 30, 80, 80, BLUE ); drawCircle( 100, 100, 10, YELLOW ); drawTriangle( 20, 150, 10, 290, 200, 200, ORANGE ); drawString( 0, 0, s, GREEN ); drawString( 0, 8, s2, YELLOW ); drawString( 0, 16, s3, RED ); Touch_Init(); //read adc5 // Power-up GPIO LPC_SC->PCONP |= ( 1 << 12 ); //clk is at cclk/8 = 15MHz LPC_SC->PCLKSEL0 |= (1 << 25); LPC_SC->PCLKSEL0 |= (1 << 24); //ADC mode LPC_PINCON->PINSEL3 |= ( 1 << 31 ); LPC_PINCON->PINSEL3 |= ( 1 << 30 ); // 10 no pul up or pull down LPC_PINCON->PINMODE3 |= ( 1 << 31 ); LPC_PINCON->PINMODE3 |= ( 0 << 30 ); while(1){ // start adc conversion adc_avg = 0; /*for( i = 0; i < 10; i++){ LPC_ADC->ADCR = ADC_START | ADC_WORK | ADC_AD5; //wait for it to finish while( (LPC_ADC->ADGDR & ADC_DONE) == 0 ); //stop conversion LPC_ADC->ADCR = ~(ADC_START | ADC_WORK | ADC_AD5); //get result adc_data = (LPC_ADC->ADDR5 >> 4) & 0x0FFF; adc_avg += adc_data; }*/ //adc_data = adc_avg / 10; adc_data = 2045; if( (adc_data > last_adc + 20) || (adc_data < last_adc - 20) ){ last_adc = adc_data; if( adc_data < 500 ){ dcolor = BLACK; }else if( adc_data > 500 && adc_data < 1000 ){ dcolor = GREY; }else if( adc_data > 100 && adc_data < 1500 ){ dcolor = BLUE; }else if( adc_data > 1500 && adc_data < 2000 ){ dcolor = CYAN; }else if( adc_data > 2000 && adc_data < 2500 ){ dcolor = GREEN; }else if( adc_data > 2500 && adc_data < 3000 ){ dcolor = YELLOW; }else if( adc_data > 3000 && adc_data < 3500 ){ dcolor = BROWN; }else if( adc_data > 3500 && adc_data < 4000 ){ dcolor = ORANGE; }else{ dcolor = RED; } drawScreen( dcolor ); itoa(adc_data, adc_str, 10); drawString( 0, 0, adc_str, BLACK ); } } return 0 ; }
/* ********************************************************************************************************* * Description: Main function * Arguments : None * Returns : None ********************************************************************************************************* */ int main (void) { u8 key; u8 x0,y0,x1,y1,x2,y2; u8 r,a,b; unsigned char flag; tccolor=Blue; SystemInit(); UART0_Init(); LCD_Init (); LPC_GPIO0->FIODIR |= 0x00002C0; //P0.6 0.7 0.9 Output LPC_GPIO2->FIODIR |= 0x00000FF; //P2.13 input P2.0...P2.7 Output Touch_Init(); LCD_Color(0,0,239,239,White); Load_Drow_Dialog(); LCD_Color(279,0,40,40,White); while(1) { if(len==8) { len=0; flag=data[6]; switch(flag) { case 0x01: x0=data[0];y0=data[1];x1=data[2];y1=data[3]; pencolor=colorchange(data[7]); LCD_Color(0,0,239,239,pencolor); LCD_DrawLine(x0,y0,x1,y1); break; case 0x02: x0=data[0];y0=data[1];x1=data[2];y1=data[3];x2=data[4];y2=data[5]; pencolor=colorchange(data[7]); LCD_Color(0,0,239,239,pencolor); LCD_DrawTriangle(x0,y0,x1,y1,x2,y2); break; case 0x03: x0=data[0];y0=data[1];x1=data[2];y1=data[3]; pencolor=colorchange(data[7]); LCD_Color(0,0,239,239,pencolor); LCD_DrawRectangle(x0,y0,x1,y1); break; case 0x04: x0=data[0];y0=data[1];r=data[2]; pencolor=colorchange(data[7]); LCD_Color(0,0,239,239,pencolor); LCD_DrawCircle(x0,y0,r); break; case 0x05: x0=data[0];y0=data[1];a=data[2];b=data[3]; pencolor=colorchange(data[7]); LCD_Color(0,0,239,239,pencolor); LCD_DrawEllipse(x0,y0,a,b); } } key = KEY_Scan(); if(Pen_Point.Key_Sta==Key_Down) //Touch screen is pressed { Pen_Int_Set(0); //Closed interrupt do { Convert_Pos(); Pen_Point.Key_Sta=Key_Up; // Draw_Big_Point(Pen_Point.X0,Pen_Point.Y0); //Drawing if(Pen_Point.Y0>=240) { Load_Drow_Dialog(); switch(Pen_Point.X0/40) { case 0:LCD_Color(279,0,40,40,White);tccolor=Blue;break; case 1:LCD_Color(279,40,40,40,White);tccolor=Yellow;break; case 2:LCD_Color(279,80,40,40,White);tccolor=Green;break; case 3:LCD_Color(279,120,40,40,White);tccolor=Red;break; case 4:LCD_Color(279,160,40,40,White);tccolor=Purple;break; case 5:LCD_Color(279,200,40,40,White);tccolor=Cyan;break; } } /* else { LCD_Color(0,0,239,239,tccolor); }*/ }while(PEN==0); //While the Touch screen is pressing Pen_Int_Set(1); //Opene the interrupt } else delay1ms(1); } }
int main (void) { int buf[318]; int x, x2; int y, y2; int r; int i; wiringPiSetup(); //设置树莓派GPIO SetPinNU(0,1,2,3,4,5,6,7,8,10,9,11,15,16,14,12,13); //设置引脚(参考树莓派GPIO映射图) SetLCDSize(LCD_28); //设置使用的LCD尺寸 Touch_Init(); //初始化触摸 setFont(8,12); //设置字体为8x12 setColor(0x07e0); //设置字体颜色 setBackColor(0xf800); //设置背景颜色 printf("Init is ok!\n"); while(1) { clrScr(); setColorRGB(255, 0, 0); fillRect(0, 0, 319, 13); setColorRGB(64, 64, 64); fillRect(0, 226, 319, 239); setColorRGB(255, 255, 255); setBackColorRGB(255, 0, 0); print("* Universal Color TFT Display Library *", CENTER,1,0); setBackColorRGB(64, 64, 64); setColorRGB(255,255,0); print("<http://electronics.henningkarlsen.com>", CENTER,227,0); setColorRGB(0, 0, 255); drawRect(0, 14,319,225); // Draw crosshairs setColorRGB(0, 0, 255); setBackColorRGB(0, 0, 0); drawLine(159, 15, 159, 224); drawLine(1, 119, 318, 119); for (i=9; i<310; i+=10) drawLine(i, 117, i, 121); for (i=19; i<220; i+=10) drawLine(157, i, 161, i); // Draw sin-, cos- and tan-lines setColorRGB(0,255,255); print("Sin", 5, 15,0); for (i=1; i<318; i++) { drawPixel(i,119+(sin(((i*1.13)*3.14)/180)*95)); } setColorRGB(255,0,0); print("Cos", 5, 27,0); for (i=1; i<318; i++) { drawPixel(i,119+(cos(((i*1.13)*3.14)/180)*95)); } setColorRGB(255,255,0); print("Tan", 5, 39,0); for (i=1; i<318; i++) { drawPixel(i,119+(tan(((i*1.13)*3.14)/180))); } delay(2000); setColorRGB(0,0,0); fillRect(1,15,318,224); setColorRGB(0, 0, 255); setBackColorRGB(0, 0, 0); drawLine(159, 15, 159, 224); drawLine(1, 119, 318, 119); // Draw a moving sinewave x=1; for (i=1; i<(318*20); i++) { x++; if (x==319) x=1; if (i>319) { if ((x==159)||(buf[x-1]==119)) setColorRGB(0,0,255); else setColorRGB(0,0,0); drawPixel(x,buf[x-1]); } setColorRGB(0,255,255); y=119+(sin(((i*1.1)*3.14)/180)*(90-(i / 100))); drawPixel(x,y); buf[x-1]=y; } delay(2000); setColorRGB(0,0,0); fillRect(1,15,318,224); // Draw some filled rectangles for (i=1; i<6; i++) { switch (i) { case 1: setColorRGB(255,0,255); break; case 2: setColorRGB(255,0,0); break; case 3: setColorRGB(0,255,0); break; case 4: setColorRGB(0,0,255); break; case 5: setColorRGB(255,255,0); break; } fillRect(70+(i*20), 30+(i*20), 130+(i*20), 90+(i*20)); } delay(2000); setColorRGB(0,0,0); fillRect(1,15,318,224); // Draw some filled, rounded rectangles for (i=1; i<6; i++) { switch (i) { case 1: setColorRGB(255,0,255); break; case 2: setColorRGB(255,0,0); break; case 3: setColorRGB(0,255,0); break; case 4: setColorRGB(0,0,255); break; case 5: setColorRGB(255,255,0); break; } fillRoundRect(190-(i*20), 30+(i*20), 250-(i*20), 90+(i*20)); } delay(2000); setColorRGB(0,0,0); fillRect(1,15,318,224); // Draw some filled circles for (i=1; i<6; i++) { switch (i) { case 1: setColorRGB(255,0,255); break; case 2: setColorRGB(255,0,0); break; case 3: setColorRGB(0,255,0); break; case 4: setColorRGB(0,0,255); break; case 5: setColorRGB(255,255,0); break; } fillCircle(100+(i*20),60+(i*20), 30); } delay(2000); setColorRGB(0,0,0); fillRect(1,15,318,224); // Draw some lines in a pattern setColorRGB(255,0,0); for (i=15; i<224; i+=5) { drawLine(1, i, (i*1.44)-10, 224); } setColorRGB(255,0,0); for (i=224; i>15; i-=5) { drawLine(318, i, (i*1.44)-11, 15); } setColorRGB(0,255,255); for (i=224; i>15; i-=5) { drawLine(1, i, 331-(i*1.44), 15); } setColorRGB(0,255,255); for (i=15; i<224; i+=5) { drawLine(318, i, 330-(i*1.44), 224); } delay(2000); setColorRGB(0,0,0); fillRect(1,15,318,224); // Draw some random circle fillScrRGB(0, 0, 255); setColorRGB(255, 0, 0); fillRoundRect(80, 70, 239, 169); setColorRGB(255, 255, 255); setBackColorRGB(255, 0, 0); print("That's it!", CENTER, 93,0); print("Restarting in a", CENTER, 119,0); print("few seconds...", CENTER, 142,0); setColorRGB(0, 255, 0); setBackColorRGB(0, 0, 255); print("Runtime: (msecs)", CENTER, 210,0); printNumI(millis(), CENTER, 225,0,0); delay (2000); if(Touch_DataAvailable()) { Touch_Read(); x=Touch_GetX(); y=Touch_GetY(); printf("%d,%d\n",x,y); } } }