Exemplo n.º 1
0
void main (void)
{
  int i;

  //初始化 GPIO
  init_gpio();
  
#if(CARD) 
  i=8;
#else
  i=19;
#endif
  
  while(1)
  {
#if(CARD)
    //D1至D8依次触发点亮、熄灭
    LPLD_GPIO_Toggle_b(PTD, i);
    i+=1;
    if(i==16)
       i=8;
#else
    //D1至D4依次触发点亮、熄灭
    LPLD_GPIO_Toggle_b(PTB, i);
    i+=1;
    if(i==24)
       i=20;
#endif
    delay();
  }
}
Exemplo n.º 2
0
void portc4_isr(void)
{
	if(LPLD_GPIO_IsPinxExt(PORTC, GPIO_Pin4))
	{
		delay();
		if(PTCn_I(4)==0)
		{
			printf("Button1-PTB6 Interrupt!\r\n");
			LPLD_GPIO_Toggle_b(PTC, 0);
		}
	}
}
void main (void)
{
  char i;
  
  gpio_init ();
  
  uart_init();
  LPLD_UART_PutCharArr(UART0, "Input something:\r\n", 20);
  
  while(1)
  {
      if (flag)
      {
        for (i = 20; i < 25; i ++)
         LPLD_GPIO_Toggle_b(PTB, i);
        flag = 0;
      }
  } 
  
}
Exemplo n.º 4
0
void pit_isr1() //100ms中断,系统板闪灯
{
	TIME_PASSED ++;
	if (__start_beep >= 0) {
		yesbeep();
		__start_beep --;
	}
	else nobeep();
	//if (!GetCmdAction()) is_enabled = 0;
	//unsigned char keyCode=scan_switch();
	LPLD_GPIO_Toggle_b(PTA, 15);
	
	// Send cur_point and direction to other car
	static char __bluetooth_buf[3] = {0};
	extern enum DIRECTION __actor_head_direction;
	extern struct Point __actor_cur_point;
	__bluetooth_buf[0] = 0xff; // Package header
	__bluetooth_buf[1] = (char) graph_get_point_number(point_map_to_standard(__actor_cur_point));
	__bluetooth_buf[2] = (char) direction_map_to_standard(__actor_head_direction);
	LPLD_UART_PutCharArr(UART4, __bluetooth_buf, sizeof(__bluetooth_buf));
}