Beispiel #1
0
void
prvInit()
{
	//LCD init
	LCD_Init();
	IOE_Config();
	LTDC_Cmd( ENABLE );

	LCD_LayerInit();
	LCD_SetLayer( LCD_FOREGROUND_LAYER );
	LCD_Clear( LCD_COLOR_BLACK );
	LCD_SetTextColor( LCD_COLOR_WHITE );

	//Button
	STM_EVAL_PBInit( BUTTON_USER, BUTTON_MODE_GPIO );

	//LED
	STM_EVAL_LEDInit( LED3 );
}
Beispiel #2
0
/*-----------------------------------------------------------*/
int fputc( int ch, FILE *f )
{
static unsigned portSHORT usColumn = 0, usRefColumn = mainCOLUMN_START;
static unsigned portCHAR ucLine = 0;

	if( ( usColumn == 0 ) && ( ucLine == 0 ) )
	{
		LCD_Clear(LCD_White);
	}

	if( ch != '\n' )
	{
		/* Display one character on LCD */
		LCD_PutChar(320 - usRefColumn, ucLine, (u8) ch, LCD_Red, LCD_White);

		/* Decrement the column position by 16 */
		usRefColumn -= mainCOLUMN_INCREMENT;

		/* Increment the character counter */
		usColumn++;
		if( usColumn == mainMAX_COLUMN )
		{
			ucLine += mainROW_INCREMENT;
			usRefColumn = mainCOLUMN_START;
			usColumn = 0;
		}
	}
	else
	{
		/* Move back to the first column of the next line. */
		ucLine += mainROW_INCREMENT;
		usRefColumn = mainCOLUMN_START;
		usColumn = 0;
	}

	/* Wrap back to the top of the display. */
	if( ucLine >= mainMAX_LINE )
	{
		ucLine = 0;
	}

	return ch;
}
Beispiel #3
0
int main()
{
    WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer

    Config_Clocks(); //配置时钟
    Config_Port();

    PGA_IO_Init();// 默认通道CH0


    LCD_IO_set();

    LCD_Init(); //初始化液晶
    LCD_Clear();
    LCD_Write_String(0,0,LCD_BUFFER);
    _EINT();

    while(1);
}
Beispiel #4
0
// Display a string on the LCD with automatic carriage return
void LCD_PrintMsg(u8 *ptr)
{
  u8 Char = 0;
  u8 CharPos = 0;

  LCD_Clear(); /* Clear the LCD display */

  /* Set cursor to home position on line 1 */
  LCD_SendByte(COMMAND_TYPE, LCD_LINE1);

  /* Send String */
  while ((*ptr != 0) && (CharPos < (LCD_LINE_MAX_CHAR * 2)))
  {
    /* Check if string length is bigger than LINE1 */
    if (CharPos == LCD_LINE_MAX_CHAR)
    {
      LCD_SendByte(COMMAND_TYPE, LCD_LINE2); /* Select second line */
    }

    Char = *ptr;

    switch (Char)
    {
      case ('\r'):
        /* Carriage return */
        CharPos++;
        ptr++;
      break;
      case ('\n'):
        CharPos = 0;
        ptr++;
        /* Set cursor to line 2 */
        LCD_SendByte(COMMAND_TYPE, LCD_LINE2);
      break;
      default:
        /* Display characters different from (\r, \n) */
        LCD_SendByte(DATA_TYPE, Char);
        CharPos++;
        ptr++;
      break;
    }
  }
}
/**
* @brief  Display the application header (title) on the LCD screen 
* @param  Title :  pointer to the string to be displayed
* @retval None
*/
void LCD_LOG_SetHeader (uint8_t *Title)
{
  sFONT *cFont;
  uint32_t size = 0 , idx; 
  uint8_t  *ptr = Title;
  uint8_t  tmp[27];
  
  /* center the header */
  while (*ptr++) size ++ ;

  /* truncate extra text */
  if(size > 26)
  {
     size = 26;
  }
  
  for (idx = 0 ; idx < 27 ; idx ++)
  { 
    tmp[idx] = ' '; 
  }

  for (idx = 0 ; idx < size ; idx ++)
  { 
    tmp[idx + (27 - size)/2] = Title[idx];
  }
  
  /* Clear the LCD */
  LCD_Clear(Black);
    
  /* Set the LCD Font */
  LCD_SetFont (&Font12x12);

  cFont = LCD_GetFont();  
  /* Set the LCD Text Color */
  LCD_SetTextColor(White);
  LCD_SetBackColor(Blue);
  LCD_ClearLine(0);
  LCD_DisplayStringLine(cFont->Height, tmp);
  LCD_ClearLine(2 * cFont->Height);

  LCD_SetBackColor(Black);
  LCD_SetFont (&Font8x12);
}
Beispiel #6
0
 int main(void)
 { 
	u8 i=0;
  	HEADCOLOR *imginfo;
	u16 x=0,y=0;
	u16 x0,y0;
 	imginfo=(HEADCOLOR*)gImage_image1;	//得到文件信息 
	delay_init();	    	 //延时函数初始化	  
	uart_init(9600);	 	//串口初始化为9600
	LED_Init();			//LED初始化
 	LCD_Init(); 	    //LCD初始化					 
	delay_ms(1500);		//等待1.5秒	  
	srand(imginfo->h*imginfo->w);
	while(1) 
	{		   
		if(i==0)
		{
			LCD_Clear(0X0000);//黑屏  
			if(imginfo->w>=lcddev.width||imginfo->h>=lcddev.height)
			{
				POINT_COLOR=RED;   	
				delay_ms(200);
				LCD_ShowString(10,70,200,16,16,"The Picture is too large");	
				delay_ms(200);
				continue;
			}
			x0=x;y0=y;
			while((x+imginfo->w)>lcddev.width||x==x0)//超过屏幕尺寸了
			{
				x=rand();//获得随机的x值
			}
			while((y+imginfo->h)>lcddev.height||y==y0)//超过屏幕尺寸了
			{
				y=rand();//获得随机的y值
			}
			image_display(x,y,(u8*)gImage_image1);//在指定地址显示图片
		}
		i++;
		if(i>10)i=0; 
		LED0=!LED0;					 
		delay_ms(200);	
	}											    
}
Beispiel #7
0
void main2(void) {
  PLL_Init();
  LCD_Init();
  OC_Init2();
  TIE  |= 0x04;
  LCD_Clear();
  
  DDRP |= 0x80;  // LED
  asm cli

  while(1) {
    PTP ^= 0x80; // flash LED
    printf("a");   //output a on first line
    main_loc = (main_loc + 1) % 8;  //update location on main line
    Timer_Wait_1ms(500);
    if ( main_loc == 0 )
      LCD_GoTo(1,1);    //wrap around
  } 
}
Beispiel #8
0
//加载主界面
void Load_Sys_ICO(void)
{		  
	u8 t,tx;
	u16 ty;	   
	FileInfoStruct temp; 
	POINT_COLOR=RED;//黑色字体				   
    LCD_Clear(WHITE);//清屏 
	temp.F_Type=T_BMP;//文件属性设置 
	tx=10;ty=10;
	for(t=0;t<9;t++)
	{	   
		temp.F_StartCluster=sys_ico[t];								    
		tx=80*(t%3)+10;//10,90,170	    
		AI_LoadPicFile(&temp,tx,ty,tx+59,ty+60);
		Select_Menu(0,t,0);//加载字体    		  
		if(t>=5)ty=216;
		else if(t>=2)ty=113;  
	}
}
Beispiel #9
0
void main(void) {
	WDTCTL=WDTPW+WDTHOLD;
    BCSCTL1 = CALBC1_16MHZ;      /* Set DCO to16MHz */
    DCOCTL = CALDCO_16MHZ;
	__delay_cycles(100000);			//等待电压稳定
	TCA6416A_Init();
	Slope_Measure_Init();
	HT1621_init();
	LCD_Clear();
	Display_SLOPE();
	HT1621_Reflash(LCD_Buffer);
	//-----设定WDT为16ms定时中断-----
	WDTCTL=WDT_ADLY_16;
	//-----WDT中断使能-----
    IE1|=WDTIE;
	 _enable_interrupts();

	while(1);
}
Beispiel #10
0
int main(int argc, char *argv[])
{
  //BOOTLOADER_reset();

  int r;
  __enable_irq();
  //NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x4000); // make sure that
  // interrupts work
  clock_init(); // hey, you can overclock later here. maybe.



  JSON_init();
  USART_Config();
  TIM_init();

  LCD_Configuration();
  LCD_Initialization();
  LCD_Clear(LCD_Black);

  USART_PutString(HOST_USART,"***** INIT DONE *****\n");

  while(1) {

    r = JSON_render();

    // todo: better error reporting
    if(r == 3) {
      // no free bufs
      continue;
    } else if(r != 0) {
      JSON_init(); // reset buffers in case of errors
      char abuf[32];
      itoa(abuf, r, 10);
      USART_PutString(HOST_USART, abuf);
      USART_PutChar(HOST_USART, 'N');
      USART_PutChar(HOST_USART, '\n');
    }
    //USART1_PutChar('A');
    __asm__("WFI"); // sleep for a bit.
  }
  return 0;
}
Beispiel #11
0
/**
  * @brief Example  main entry point.
  * @par Parameters:
  * None
  * @retval 
  * None
  */
void main(void)
{

    /* Initialize SPI for LCD */
    SPI_DeInit();
    SPI_Init(SPI_FIRSTBIT_MSB, SPI_BAUDRATEPRESCALER_128, SPI_MODE_MASTER, SPI_CLOCKPOLARITY_HIGH, SPI_CLOCKPHASE_2EDGE, SPI_DATADIRECTION_1LINE_TX, SPI_NSS_SOFT, 0x07);
    SPI_Cmd(ENABLE);

    
    /* Configure GPIO used to drive the joystick
	      JOYSTICK_UP    --> PB6
	      JOYSTICK_DOWN  --> PB7
	      JOYSTICK_LEFT --> PB4
	*/
  GPIO_Init(GPIOB, GPIO_PIN_4 | GPIO_PIN_6 | GPIO_PIN_7, GPIO_MODE_IN_FL_IT);
  EXTI_SetExtIntSensitivity(EXTI_PORT_GPIOB, EXTI_SENSITIVITY_FALL_LOW);
	
	enableInterrupts();
    
    
    /* Initialize LCD */
    LCD_Init();

    /* Clear LCD lines */
    LCD_Clear();

    LCD_Backlight(ENABLE);

    LCD_PrintString(LCD_LINE1, ENABLE, DISABLE, "Clock Selection");
    LCD_PrintString(LCD_LINE2, ENABLE, DISABLE, " Use joystick");

    CLK_DeInit();
		CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1);
    /* Output Fcpu on CLK_CCO pin */
    CLK_CCOConfig(CLK_OUTPUT_MASTER);

    while (1)
    {
  
    }

}
Beispiel #12
0
void PowerOnSetProc()
{		 	
	port_b_pullups(TRUE);	output_b(0xff); output_c(0xff);		
	
	set_tris_A(0b00000011);	set_tris_B(0b01111111);

	set_tris_D(0b00000000);	set_tris_E(0b00000000);
	
	set_tris_C(0b10010000);
	
	setup_adc_ports(NO_ANALOGS);
	setup_adc(ADC_OFF);

	setup_comparator(NC_NC_NC_NC);
	setup_vref(FALSE);
	setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);

	setup_timer_2(T2_DIV_BY_4,250,2);		 // 8,000,000 / (4 * 8 * (249 +1)) = 1,000 = 1/1000 sec
	set_timer2(0);
	enable_interrupts(INT_TIMER2);
	
	// LCD 초기화 하기 전에 대기 없으면 이상한 현상이 생김  
	delay_ms(100); 

	LCD_Initialization();				

	setup_psp(PSP_DISABLED);	
	delay_ms(250);
	SerialPortSetup();	

	LCD_Clear();
	enable_interrupts(INT_RDA);	
	enable_interrupts(GLOBAL);	

             //"01234567890123456789"
	strcpy(st, "DIGITAL OPERAT      "); PrintLCD(0,0,st);
	strcpy(st, "[EwDo-21] v2.60     "); PrintLCD(1,0,st);
	strcpy(st, "EunWho Power Electic"); PrintLCD(2,0,st);
	strcpy(st, "TEL 82-51-262-7532  "); PrintLCD(3,0,st);
	delay_ms(3250);
	delay_ms(3250);
}
Beispiel #13
0
int main()
{
	struct Timer fps;
	
	time_t current;
	struct tm *current_tm;
	struct Banner date_banner = {
		.string = date_string,
		.offset = 0
	};

	if (LCD_Init() != 0) {
		printf("Error initializing LCD\n");
		return 1;
	}

	LCD_SetBacklight(1);

	for (;;) {

		timer_start(&fps);

		current = time(NULL);
		current_tm = localtime(&current);
		string_print_date(date_string, current_tm);

		LCD_Clear();
		draw_clock_frame();
		draw_time(current_tm);
		update_banner(&date_banner);
		draw_banner(&date_banner, 0);
		draw_banner(&date_banner, 38);
		LCD_Display();

		if (timer_get_msecs(&fps) < 1000 / FRAMES_PER_SECOND) {
			usleep(1000 * ( 1000 / FRAMES_PER_SECOND ) - timer_get_msecs(&fps));
		}

	}

	return 0;
}
int main(void)
{
	uint8_t i, j;
	SysTick_Config(SystemCoreClock/1000); //1ms tick
	RCC_Init();
	USARTInit();
	LCD_Init();
	LED_Init();
	LED_On();
	LCD_Clear();

	//LCD_char(0, 0, 0);
	LCD_String("abcdefg",0,0);
	LCD_String("6543210",0,3);
	while(1){
		delay_ms(100);
		printf("done!\n\r");
		LED_Toogle();
	}
}
Beispiel #15
0
/* 修复了上下颠倒的BUG,enjoy~
 * 要想中文显示成功
 * 需把字库拷贝到sd卡上,然后把sd卡插到开发板的卡槽上
 */
int main(void)
{
   /* USART1 config */
		//USART1_Config();
		//printf("\r\n this is a fatfs test demo \r\n");
	
		LCD_Init();
	
		/* 设置Lcd Gram 扫描方向为: 右下角->左上角 */		
		Lcd_GramScan( 3 );	
		LCD_Clear(0, 0, 320, 240, BACKGROUND);	
		
		/* 初始化sd卡文件系统,因为汉字的字库和bmp图片放在了sd卡里面 */
		Sd_fs_init();
	

		Screen_shot(0,0,320,240,"/myscreen");
		
		while(1);
}
Beispiel #16
0
void FM_DisplayChannel(int channel, xpos, ypos){
	LCD_Clear();
	LCD_GoTo(xpos,ypos);
	if(channel<1000){
		LCD_WriteInt(digitAtPos(channel,1), true);
		LCD_GoTo(xpos+LARGE_SPACE, ypos);
		LCD_WriteInt(digitAtPos(channel,2), true);
		LCD_GoTo(xpos+LARGE_SPACE+SMALL_SPACE, ypos);
		LCD_WriteInt(digitAtPos(channel,3),true);
	}
	else{
		LCD_WriteInt(digitAtPos(channel,1), true);
		LCD_GoTo(xpos+LARGE_SPACE, ypos);
		LCD_WriteInt(digitAtPos(channel,2), true);
		LCD_GoTo(xpos+LARGE_SPACE+LARGE_SPACE, ypos);
		LCD_WriteInt(digitAtPos(channel,3),true);
		LCD_GoTo(xpos+2*LARGE_SPACE+SMALL_SPACE);
		LCD_WriteInt(digitAtPos(channel,4),true);
	}
}
/**
 *	Draw the list of coordinates currently in the database
 *
 *	@author HP Truong, Jacob Barnett
 *
 *	@param void
 *	@return void 
 */
void draw_from_db(void) {
	LCD_Clear(LCD_COLOR_WHITE);
	LCD_SetTextColor(LCD_COLOR_RED);
	memcpy ( (void *)(LCD_FRAME_BUFFER + BUFFER_OFFSET), (void *) ((uint8_t*) (&background)), sizeof(background));
	
	uint8_t len = coordinate_db_get_len();
	if (len == 0) {
		return;
	}

	static coordinate next_coord;

	for (uint8_t i = 0; i < len; i++) {
		coordinate_db_get_entry(i, &next_coord);
		xs[i] = next_coord.x;
		ys[i] = next_coord.y;
	}

	draw_points(1, 1, xs, ys, len);
}
Beispiel #18
0
int main() {
    PWR_Init();
    CLOCK_Init();
    UART_Initialize();
    if(PWR_CheckPowerSwitch()) PWR_Shutdown();
#if SPI_BOOTLOADER
    Initialize_ButtonMatrix();
    SPIFlash_Init(); //This must come before LCD_Init() for 7e
    SPI_FlashBlockWriteEnable(1); //Enable writing to all banks of SPIFlash
    LCD_Init();
    LCD_Clear(0x0000);
    BACKLIGHT_Init();
    BACKLIGHT_Brightness(5);
    LCD_SetFont(0);
    LCD_SetFontColor(0xffff);
    dump_bootloader(0);
#else
    dump_bootloader(1);
#endif
}
Beispiel #19
0
/*******************************************************************************
* Function Name  : LCD_DisplayError
* Description    : Displays error message on the LCD screen and prompt user to 
*                  reset the application.
* Input          : err: Error code.
* Output         : None
* Return         : None
*******************************************************************************/
void LCD_DisplayError(uint32_t err)
{
  I2S_CODEC_LCDConfig();

  /* Enable the FSMC that share a pin w/ I2C1 (LBAR) */
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);

  LCD_SetTextColor(Red); 

  /* Clear the LCD */
  LCD_Clear(White);


  /* The memory initialazation failed */
  if (err == 1)
  {
    LCD_DisplayStringLine(Line7, memerr); 
  }

  /* The audio file initialization failed (wrong audio format or wrong file) */
  if (err == 2)
  {
    LCD_DisplayStringLine(Line7, fileerr); 
  }

  /* I2C communication failure occured */
  if (err == 3)
  {
    LCD_DisplayStringLine(Line7, i2cerr); 
  }

  LCD_DisplayStringLine(Line8, "Push JoyStick to    ");
  LCD_DisplayStringLine(Line9, "exit.               ");

  /* Disable the FSMC that share a pin w/ I2C1 (LBAR) */
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, DISABLE);

  while(ReadKey() == NOKEY)
  {
  }
}
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
void COMP_PulseWidthMeasurement(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f30x.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f30x.c file
     */

  /* Initialize the TFT-LCD */
  STM32303C_LCD_Init();
  
  /* Clear the TFT-LCD */
  LCD_Clear(LCD_COLOR_WHITE);
  
  /* DAC Channel1 configuration */
  DAC_Config();
  
  /* COMP1 Configuration */
  COMP_Config();
  
  /* TIM2 Configuration in input capture mode */
  TIM_Config();
  
  /* Displays PulseWidthMeasurement message on line 0 */
  LCD_DisplayStringLine(LINE(0), (uint8_t *)MESSAGE1);

  /* Infinite loop */
  while (1)
  {
    if (DisplayActive != 0)
    {
      /* Compute the pulse width in us */
      MeasuredPulse = (uint32_t)(((uint64_t) Capture * 1000000) / ((uint32_t)SystemCoreClock));
      
      /* Display measured pulse width on LCD */
      LCD_Display(MeasuredPulse);  
      DisplayActive = 0;
    }
  }
}
Beispiel #21
0
void sys_sonic(void)
{
	rt_uint32_t key_value;
    
	while(1)
	{
		LCD_Clear();
		LCD_SetXY(0,0); LCD_WriteString("====pole_test====");
		LCD_SetXY(0, 1); LCD_WriteString("1.step1");
        LCD_SetXY(0, 2); LCD_WriteString("2.xypid");
        LCD_SetXY(0, 3); LCD_WriteString("3.pw1");
        LCD_SetXY(0, 4); LCD_WriteString("4.dis");
        
        LCD_SetXY(10, 1); LCD_WriteString("5.sd save");
        LCD_SetXY(10, 2); LCD_WriteString("6.");
        LCD_SetXY(10, 3); LCD_WriteString("7.");
        LCD_SetXY(10, 4); LCD_WriteString("8.");
		
		if(rt_mb_recv(&Mb_Key, &key_value, RT_WAITING_NO) == RT_EOK)
		{
			switch(key_value)
			{
				case key1:  _step1();       break;
				case key2:  pw1_pid();      break;
                case key3:  sonic_pw1();    break;
                case key4:  
                    Input_DoubleValue(&std_fdis, "f dis");    
                    Input_DoubleValue(&std_sdis, "s dis");
                case key5:
                {
                    int _sonicx = 0 ;
                    Input_IntValue(&_sonicx, "_sonicx");
                    sonic_SDsave(_sonicx, "sonic_data", 500);
                }  
                break;
                case keyback:               return;
			}
		}
		Delay_ms(10);
	}
}
Beispiel #22
0
void FLASH_writeCommand(u8 bytes, u8 xdata *dataOut)
{
	u8 xdata i;
	i  = 0;

	if(dataOut[0]==0xB2 && dataOut[1]==0x55 && dataOut[2]==0x55)//erase flash make si468x into flash progarming state
	{		
		power_flag = 0;

		StartFirmwareUpdate();
		wait_ms(1);	
		load_init__command();

		firmware_download_flag = 1;

		IE2 &= ~0x20;    	// disable Timer interrupt
		IE3 &= ~0x04; 		// disable wt interrupt

#ifndef OPTION__OPERATE_AS_SLAVE_NO_MMI			
		LCD_Clear(LCD_CLEAR_ALL);
		LCD_DisplayStr("Update flash\n",0,0);
		LCD_DisplayStr("Doing...\n",0,1);
#endif //OPTION__OPERATE_AS_SLAVE_NO_MMI	
	}
	else if(dataOut[0]==0x05 && dataOut[1]==0xFE && dataOut[2]==0xC0 && dataOut[3]==0xDE)//sector erase 0xDEC0
	{
		si468x_writeCommand(bytes,dataOut);
	}
	else
	{
		//si468x_writeCommand(bytes,dataOut);
		if(dataOut[0]==0x05 && dataOut[1]==0xF0 && dataOut[2]==0x0C && dataOut[3]==0xED)//0xED0C
		{
			si468x_SSB = 0;
		}
		while(bytes--)
		{
			si468x_write(dataOut[i++]);
		}
	}
}
/*..........................................................................*/
void BSP_init(void) {
    EXTI_InitTypeDef exti_init;

    SystemInit();         /* initialize STM32 system (clock, PLL and Flash) */

             /* initialize LEDs, Key Button, and LCD on STM3210X-EVAL board */
    STM_EVAL_LEDInit(LED1);
    STM_EVAL_LEDInit(LED2);
    STM_EVAL_LEDInit(LED3);
    STM_EVAL_LEDInit(LED4);

                    /* initialize the EXTI Line0 interrupt used for testing */
    exti_init.EXTI_Mode    = EXTI_Mode_Interrupt;
    exti_init.EXTI_Trigger = EXTI_Trigger_Rising;
    exti_init.EXTI_Line    = EXTI_Line0;
    exti_init.EXTI_LineCmd = ENABLE;
    EXTI_Init(&exti_init);

    STM3210C_LCD_Init();                              /* initialize the LCD */
    LCD_Clear(White);                                      /* clear the LCD */
    LCD_SetBackColor(Grey);
    LCD_SetTextColor(Black);
    LCD_DisplayString(Line0, 0, "   Quantum Leaps    ");
    LCD_DisplayString(Line1, 0, "     DPP example    ");
    LCD_DisplayString(Line2, 0, " QP/C (QK)          ");
    LCD_DisplayString(Line2, 14*16, QF_getVersion());
    LCD_SetBackColor(White);
    LCD_DisplayString(Line5, 0, "DPP:");
    LCD_SetBackColor(Black);
    LCD_SetTextColor(Yellow);
    LCD_DisplayString(Line9, 0, "  state-machine.com ");
    LCD_SetBackColor(Blue);
    LCD_SetTextColor(White);
    LCD_DisplayString(Line5, 4*16, "0 ,1 ,2 ,3 ,4    ");

    if (QS_INIT((void *)0) == 0) {    /* initialize the QS software tracing */
        Q_ERROR();
    }

    QS_OBJ_DICTIONARY(&l_SysTick_Handler);
}
Beispiel #24
0
void Lcd_Note(uint8_t test_num)
{
	uint8_t lcd_char[50];
	Lcd_GramScan( 1 );												//设置扫描方向
	LCD_Clear(12,86,206,165,BACKGROUND);			//清除屏幕
	
//	LCD_Clear(12,72,215,152,BACKGROUND);							//RED	 清除				
	//LCD_DispEnCh(50,90,test_name[test_num-1],RED);	
	
	sprintf(lcd_char,"%s程序运行中:",test_name[test_num-1]);

	LCD_DispEnCh(15,90,lcd_char,BLACK);		
	
	
	LCD_DispEnCh(10,230,"软件或硬件复位返回选择界面",BLACK);	
	
	



}
Beispiel #25
0
static void CalibrateCore( MENU_Event_t event, uint8_t *cal )
{
    if ( event == MENU_EVENT_SELECT )
    {
        memcpy( &cal[ 1 ], &gADC[ 1 ], 5 );

        return;
    }

    if ( event == MENU_EVENT_INIT )
    {
        LCD_Clear();
    }

    LCD_MoveTo( 0, 0 );
    LCD_Printf( "C %02x %02x %02x %02x %02x",  cal[ 4 ],  cal[ 1 ],  cal[ 2 ],  cal[ 3 ],  cal[ 5 ]);

    LCD_MoveTo( 0, 1 );
    LCD_Printf( "L %02x %02x %02x %02x %02x", gADC[ 4 ], gADC[ 1 ], gADC[ 2 ], gADC[ 3 ], gADC[ 5 ]);

} // CalibrateCore
Beispiel #26
0
/**
  * @brief  主函数
  * @param  无  
  * @retval 无
  */
int main(void)
{  
  LCD_Init();	
  
	LCD_Clear(0, 0, 240, 320, BACKGROUND);	
  
	LCD_DispChar(60, 60, 'A', RED);

  
	LCD_DispStr(10, 10, (uint8_t *)"This is a lcd demo to display ascii", RED);	
	
	LCD_DispStr(40, 100, (uint8_t *)"count:", RED);
	
	for( n=0; n<500000; n++ )
	{
		LCD_DisNum(100, 100, n, RED);
		Lcd_Delay(0xAFFf>>4);
	}
	
	while( 1 ){}
}
Beispiel #27
0
void main ( void )
{
	
	init_timer0();
	enable_timer(0);
	Delay(1000);
	LCD_Init();
	LCD_Clear();
	LCD_DisplayString(1,1,"Welcome To Arya Omnitalk");
	
	
	SET_PORT1_PIN_DIRN_OUT(1<<24);
	LCD_BKLIT_OFF;
	while(1)
	{		
		LCD_BKLIT_OFF;
		Delay(10);
		LCD_BKLIT_ON;
		Delay(10);
	}
}
Beispiel #28
0
int main()
{
    char str[50];
    int len = 0;
    SystemInit();

    /*Connect RS->P1_16, RW->P1_17, EN->P1_18 and data bus(D4:D7 - P1_20:P1_23)*/
    LCD_SetUp(P1_16,P1_17,P1_18,P_NC,P_NC,P_NC,P_NC,P1_20,P1_21,P1_22,P1_23);
    LCD_Init(2,16);
    UART0_Init(9600);
    LCD_DisplayString("send data from  serial terminal");
    while(1)
    {
        len = UART0_RxString(str);
        UART0_Printf("Received String:%s   size=%2d\n\r",str,len);
        LCD_Clear();
        LCD_Printf("str:%s size=%2d",str,len);
    }


}
Beispiel #29
0
/**
 * Initialize the display.
 */
void LCD_Init() {
	// Initialize SysTick
	SysTickInit(1000);

	// Wait 50 ms for voltage to settle.
	_delay_ms(50);
	LCD_DataOut();
	RCC_AHBPeriphClockCmd(CLK(LCD_DATA_PORT),ENABLE);
	RCC_AHBPeriphClockCmd(CLK(LCD_CTRL_PORT),ENABLE);

	GPIO_InitTypeDef GPIO_InitStructure;
	GPIO_InitStructure.GPIO_Pin=(LCD_RS|LCD_RW|LCD_E);
	GPIO_InitStructure.GPIO_Mode=GPIO_Mode_OUT;
	GPIO_InitStructure.GPIO_OType=GPIO_OType_PP;
	GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
	GPIO_InitStructure.GPIO_PuPd=GPIO_PuPd_NOPULL;
	GPIO_Init(PORT(LCD_CTRL_PORT),&GPIO_InitStructure);

	//clear all control signals initially
	GPIO_ResetBits(PORT(LCD_CTRL_PORT),LCD_RW|LCD_RS|LCD_E);

	//initialization in 4-bit interface
	LCD_Write(0b0011);
	_delay_ms(5);

	LCD_Write(0b0011);
	_delay_ms(1);

	LCD_Write(0b0011);
	_delay_ms(1);

	LCD_Write(0b0010);
	_delay_ms(1);

	// 2 row display
	LCD_SendCommand(LCD_CMD_FUNCTION|LCD_2_ROWS_BIT);
	LCD_SendCommand(LCD_CMD_DISPLAY_ON_OFF|LCD_DISPLAY_ON_BIT|LCD_CURSOR_ON_BIT|LCD_BLINK_ON_BIT);
	LCD_Clear();

}
Beispiel #30
0
void _step1(void)
{    
    double dis = 0;
    struct Point goal_point;
    gps_t gps_save = GPS;
    
    SONICx_ENABLE(0X03);
    
    Speed_Y = rbyCoef * -600;
    while((double)(sonic_data[F_SONIC-1].data)>600 || (double)(sonic_data[F_SONIC-1].data)<150)
    {
        LCD_Clear();
        LCD_SetXY(0, 0);
        LCD_Printf("_step2: not see pole");
        LCD_SetXY(0, 1);
        LCD_Printf("angle:%f", GPS.radian);
        Delay_ms(5);
    }
    /* check again */
    Delay_ms(30);
    dis = sonic_data[F_SONIC-1].data;
    if(dis<500 && dis>150)
    {
        /* be sure seeing the first pole */
        
        double l_disx = (dis + 220 - std_overDesign);   /* local delta distance - x_direction */
        double l_disy = -450*rbyCoef;                   /* local delta distance - y_direction */
        double theta = GPS.radian;
        
        Speed_Y = 0;
        msg("see pole, dis:%f", dis);
        
        /* local to global */
        goal_point = GPS.position;
        goal_point.x +=  l_disx*cos(theta) - l_disy*sin(theta);
        goal_point.y +=  l_disx*sin(theta) + l_disy*cos(theta);
        
        _set_keep(goal_point, gps_save.radian, 1000, 150, 5);
    }
}