// print text // ---------------------------------------------------------- void RAIO_print_text( uint16_t pos_x, uint16_t pos_y, unsigned char *str, uint8_t BG_color, uint8_t FG_color ) { union my_union number; // set cursor number.value = pos_x; RAIO_SetRegister( CURH0, number.split.low ); RAIO_SetRegister( CURH1, number.split.high ); number.value = pos_y; RAIO_SetRegister( CURV0, number.split.low ); RAIO_SetRegister( CURV1, number.split.high ); // set color Text_Background_Color( BG_color ); Text_Foreground_Color( FG_color ); // set text mode RAIO_SetRegister( MWCR0, 0x80 ); // write text to display TFT_RegWrite( MRWC ); while ( *str != '\0' ) { TFT_DataWrite( *str ); ++str; TFT_wait_for_raio(); } TFT_wait_for_raio(); // set graphic mode RAIO_SetRegister( MWCR0, 0x00 ); }
// draw function point void set_point ( float_t x_real, float_t y_real ) { if ((x_real> window_left) & (x_real < window_right) & (y_real > window_down) & (y_real <window_up)) { Text_Foreground_Color( COLOR_WHITE ); Draw_Line( scale_x( x_real ), scale_y( y_real ), scale_x( x_real ), scale_y( y_real ) ); RAIO_StartDrawing( LINE ); } }
// draw with RAIO // --------------------------------------------- void example_DrawWithRAIO( void ) { // rectangle Draw_Square (0, 0, 319, 239); Text_Foreground_Color ( COLOR_BLACK ); RAIO_StartDrawing ( SQUARE_FILL ); Text_Foreground_Color ( COLOR_BLUE ); Draw_Square (210, 150, 260, 200); // line Draw_Line ( 10, 230, 310, 10 ); Text_Foreground_Color ( COLOR_GREEN ); RAIO_StartDrawing ( LINE ); // circle Draw_Circle ( 90, 65, 25 ); Text_Foreground_Color ( COLOR_RED ); RAIO_StartDrawing ( CIRCLE_FILL ); }
void example_DrawFunction( int16_t function ) { float_t x_real, y_real; int16_t count; RAIO_clear_screen(); // draw x-axis draw_coords_line ( window_left, 0, window_right, 0 ); for( count = (int16_t)window_left; count < (int16_t)window_right; count++ ) { Draw_Line ( scale_x( count ), scale_y( window_up*0.01 ), scale_x( count ), scale_y( window_down*0.01 ) ); Text_Foreground_Color ( COLOR_WHITE ); RAIO_StartDrawing ( LINE ); } // draw y-axis draw_coords_line ( 0, window_up, 0, window_down ); for( count = (int16_t)window_down; count < (int16_t)window_up; count++ ) { Draw_Line ( scale_x( window_left*0.01 ), scale_y( count ), scale_x( window_right*0.01 ), scale_y( count ) ); Text_Foreground_Color ( COLOR_WHITE ); RAIO_StartDrawing ( LINE ); } // draw function for( x_real = window_left; x_real < window_right; x_real=x_real+0.02 ) { switch (function) // -> see FUNCTIONS { case SIN: y_real = sin( x_real ); break; case COS: y_real = cos( x_real ); break; case TAN: y_real = tan( x_real ); break; case PARABOLA: y_real = x_real * x_real; break; case EXPONENT: y_real = exp( x_real ); break; case LOGN : y_real = log( x_real ); break; default: break; }; set_point( x_real, y_real); } }
// draw coordinate system void draw_coords_line (float_t x1, float_t y1, float_t x2, float_t y2) { Text_Foreground_Color( COLOR_WHITE ); Draw_Line( scale_x( x1 ), scale_y( y1 ), scale_x( x2 ), scale_y( y2 ) ); RAIO_StartDrawing( LINE ); }
void DrawScreen(screen_enum_t scn) { int i,j; int sWidth = 0; if(bDisplayInitialized == 0) return; xSemaphoreTake(xDispSemaphore, portMAX_DELAY); { SetDrawingLayer(); switch(scn) { case EmpLoggedInScn: Background_color(color_black); Text_color(color_white); Clear_Active_Window(); Show_String18(gArial18, "Client Name:", 55,5); Show_String18(gArial24, "Vigelette, George", 55,28); // time while the font is still loaded Show_String18(gArial24, "11:32 AM", 385,28); // time while the font is still loaded DisplayImageBlockMode(g3gIcon20.start_addr ,400, 3, g3gIcon20.image_width, g3gIcon20.image_height); // // Layer1_Visible(); // Write_To_Bank1(); // Active_Window(0,479,0,271); // battery DisplayImageBlockMode(gBatteryIcons.start_addr,427, 3, gBatteryIcons.image_width, 20); // buttons // Row 1 DisplayImageBlockMode(gBtnEndShift.start_addr,20, 63, gBtnEndShift.image_width, gBtnEndShift.image_height); DisplayImageBlockMode(gBtnTimesheet.start_addr,250, 63, gBtnTimesheet.image_width, gBtnTimesheet.image_height); // Row 2 DisplayImageBlockMode(gBtnTaskList.start_addr,20, 123, gBtnTaskList.image_width, gBtnTaskList.image_height); DisplayImageBlockMode(gBtnSchedule.start_addr,250, 123, gBtnSchedule.image_width, gBtnSchedule.image_height); // Row 3 DisplayImageBlockMode(gBtnMessages.start_addr,20, 183, gBtnMessages.image_width, gBtnMessages.image_height); DisplayImageBlockMode(gBtnExit.start_addr,250, 183, gBtnExit.image_width, gBtnExit.image_height); sWidth = MeasureString(gArial24, "Jan 21, 2013"); Show_String18(gArial24, "Jan 21, 2013", (480 - sWidth)/2 ,250); break; case EmpLoggedOutScn: break; case ClientScn: break; case ActivationScn: break; case TestScn: // bte fill Background_color(color_black); Text_color(color_white); Graphic_Mode(); BTE_Size_setting(15,68); BTE_ROP_Code(0xcc); //set BTE solid fill for(i=0;i<32;i++) { Text_Foreground_Color(i,0,0); BTE_Source_Destination(0,i*15,0,0); BTE_enable(); Chk_Busy_BTE(); Text_Foreground_Color(0,i*2,0); BTE_Source_Destination(0,i*15,0,68); BTE_enable(); Chk_Busy_BTE(); Text_Foreground_Color(0,0,i); BTE_Source_Destination(0,i*15,0,136); BTE_enable(); Chk_Busy_BTE(); Text_Foreground_Color(i,i*2,i); BTE_Source_Destination(0,i*15,0,204); BTE_enable(); Chk_Busy_BTE(); } break; case ConfigurationScn: Internal_CGROM(); Font_size_16x16_8x16(); Background_color(color_blue); Text_color(color_white); Clear_Active_Window(); Font_Coordinate(5,5); Show_String("Safe-Link Device Configuration ",0); break; case AuthenticatingScn: break; case MessageListScn: break; case NewMessageScn: break; case ReadMessageScn: break; case TaskListScn: break; case TaskViewScn: break; case ScheduleScn: break; case TimeApproveScn: break; case LockedScn: Active_Window(0,479,0,271); DisplayImageBlockMode(gDeviceLockedScreen.start_addr, 0,0,gDeviceLockedScreen.image_width, gDeviceLockedScreen.image_height); break; case SplashScn: Active_Window(0,479,0,271); DisplayImageBlockMode(gsplashScreen.start_addr, 0,0,gsplashScreen.image_width, gsplashScreen.image_height); Text_color(color_white); Geometric_Coordinate(212,268,108,164); Draw_square(); Text_color(color_black); Geometric_Coordinate(213,267,109,163); Draw_square_fill(); Active_Window(0,479,0,271); DisplayImageBlockMode(gCycle.start_addr, 216,112,gCycle.image_width, gCycle.image_height); break; case LoadingAnim: Active_Window(0,479,0,271); Background_color(color_black); Text_color(color_white); Graphic_Mode(); Clear_Active_Window(); Show_String18(gArialBlack24, "Loading", 206 ,116); DisplayImageBlockMode(gProgressBar.start_addr,153, 145, gProgressBar.image_width, 14); break; default: DisplayImageBlockMode(gsplashScreen.start_addr, 0,0,gsplashScreen.image_width, gsplashScreen.image_height); break; } ShowNextScene(); xSemaphoreGive(xDispSemaphore); } }