示例#1
0
文件: main.c 项目: stevenc49/dotcsc
void sw_task()
{
    while(1)
    {
        if(lcd_switch_pressed(1))
            lcd_string_array_cycle();
        else if(lcd_switch_pressed(2))
            lcd_string_array_cycle_reverse();

        nrk_wait_until_next_period();
    }
}
示例#2
0
文件: main.c 项目: nycdarren/mrk
void cycling_task()
{
    while(1)
    {
        if(lcd_string_array_autocycling_get())
        {
            lcd_string_array_cycle();
            lcd_wait_us(LCD_AUTOCYCLING_TIME);
        }
        else
        {
            if(lcd_switch_pressed(1))
                lcd_string_array_cycle();
            else if(lcd_switch_pressed(2))
                lcd_string_array_cycle_reverse();

            nrk_wait_until_next_period();
        }
    }
}
示例#3
0
文件: main.c 项目: adamselevan/dicio
void Task1()
{
  uint8_t secret = 0;
  char* s = "Screen 1\\nWelcome!\\nScreen 2\\nDriver\\r\\nScreen 3\\n \\dTest\\d";
  char* s_secret = "Congrats\\ndude\\nYou\\nfound it\\nSecret\\ncode!";

  // Initialize FireFly LCD v1.2 board
  lcd_setup();

  // Set LEDs
  lcd_led_set(1, 0);
  lcd_led_set(2, 0);
  lcd_led_set(3, 1);

  lcd_string_display_escape("FireFly\\nLCD v1.2");
  lcd_wait_us(2000000); // Wait 2 seconds

  lcd_string_display_escape("Basic\\nLCD");
  lcd_wait_us(2000000); // Wait 2 seconds

  lcd_string_display_escape("Driver\\nTest");
  lcd_wait_us(2000000); // Wait 2 seconds

  // Load initial string array
  lcd_string_array_load(s);

  // Switch input loop
  while(1)
  {
    if(lcd_switch_pressed(1)) // If switch 1 is pressed
    {
      if(!secret)
        lcd_led_set(1, 1); // Set LED 1

      // Buzz
      lcd_buzz(30);

      if(lcd_switch_pressed(2)) // If both switches are pressed
      {
        // Load new string array
        lcd_string_array_load(s_secret);

        // Set LEDs
        lcd_led_set(1, 1);
        lcd_led_set(2, 1);
        lcd_led_set(3, 1);

        secret = 1;
      }
      else
      {
        // Cycle string array
        lcd_string_array_cycle();
      }
    }
    else if(lcd_switch_pressed(2)) // If switch 2 is pressed
    {
      if(!secret)
        lcd_led_set(2, 1); // Set LED 2

      // Buzz
      lcd_buzz(30);

      // Reverse cycle string array
      lcd_string_array_cycle_reverse();
    }
    else if(!secret) // If no switches pressed
    {
      lcd_led_set(1, 0); // Clear LED 1
      lcd_led_set(2, 0); // Clear LED 2
    }

    if(secret)
    {
      // Toggle LEDs
      lcd_led_toggle(1);
      lcd_led_toggle(2);
      lcd_led_toggle(3);
    }

    nrk_wait_until_next_period();
  }
}