Functions

nRFgo LCD display and joystick example
[Projects]


Example application using the nRF6350 LCD and joystick module for the nRFgo Motherboard. The application reads the input from the joystick and displays the joystick direction in the LCD display.

The application can be used with nRF24LE1 only.

Functions

void main (void)

Function Documentation

void main ( void   )

Definition at line 32 of file main.c.

{
  lib_display_js_states_t js_status = JS_BUTTON_NONE;
  lib_display_js_states_t js_status_last = JS_BUTTON_NONE;

  // Initialize the LCD display
  lcd_init();

  // Clear the display and print a welcome message
  lcd_write_string("Welcome to the", 0, 0);
  lcd_write_string("joystick test", 1, 0);

  // Wait for any joystick movement before continuing
  while(js_get_status() == JS_BUTTON_NONE){}

  for(;;)
  {
    // Get the current status of the joystick
    js_status = js_get_status();

    // See if the status has changed from the last time
    if( js_status != js_status_last )
    {
      // Check the status and print a suitable text on the display
      switch( js_status  )
      {
        case JS_BUTTON_NONE:
          lcd_clear();
          break;
        case JS_BUTTON_PUSH:
          lcd_clear();
          lcd_write_string("Push", 0, 6);
          break;
        case JS_BUTTON_RIGHT:
          lcd_clear();
          lcd_write_string("Right", 0, 11);
          break;
        case JS_BUTTON_LEFT:
          lcd_clear();
          lcd_write_string("Left", 0, 0);
          break;
        case JS_BUTTON_UP:
          lcd_clear();
          lcd_write_string("Up", 0, 7);
          break;
        case JS_BUTTON_DOWN:
          lcd_clear();
          lcd_write_string("Down", 1, 6);
          break;
      }
      js_status_last = js_status;
    }
  }
}