• Main Page
  • Modules
  • Index
  • File List
  • Globals

projects/nrfgo_sdk/display_joystick_example/main.c

Go to the documentation of this file.
00001 /* Copyright (c) 2009 Nordic Semiconductor. All Rights Reserved.
00002  *
00003  * The information contained herein is confidential property of Nordic
00004  * Semiconductor ASA.Terms and conditions of usage are described in detail
00005  * in NORDIC SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
00006  *
00007  * Licensees are granted free, non-transferable use of the information. NO
00008  * WARRENTY of ANY KIND is provided. This heading must NOT be removed from
00009  * the file.
00010  *
00011  * $LastChangedRevision: 2503 $
00012  */
00013 
00028 #include "nrf24le1.h"
00029 #include "lib_display.h"
00030 #include "hal_delay.h"
00031 
00032 void main(void)
00033 {
00034   lib_display_js_states_t js_status = JS_BUTTON_NONE;
00035   lib_display_js_states_t js_status_last = JS_BUTTON_NONE;
00036 
00037   // Initialize the LCD display
00038   lcd_init();
00039 
00040   // Clear the display and print a welcome message
00041   lcd_write_string("Welcome to the", 0, 0);
00042   lcd_write_string("joystick test", 1, 0);
00043 
00044   // Wait for any joystick movement before continuing
00045   while(js_get_status() == JS_BUTTON_NONE){}
00046 
00047   for(;;)
00048   {
00049     // Get the current status of the joystick
00050     js_status = js_get_status();
00051 
00052     // See if the status has changed from the last time
00053     if( js_status != js_status_last )
00054     {
00055       // Check the status and print a suitable text on the display
00056       switch( js_status  )
00057       {
00058         case JS_BUTTON_NONE:
00059           lcd_clear();
00060           break;
00061         case JS_BUTTON_PUSH:
00062           lcd_clear();
00063           lcd_write_string("Push", 0, 6);
00064           break;
00065         case JS_BUTTON_RIGHT:
00066           lcd_clear();
00067           lcd_write_string("Right", 0, 11);
00068           break;
00069         case JS_BUTTON_LEFT:
00070           lcd_clear();
00071           lcd_write_string("Left", 0, 0);
00072           break;
00073         case JS_BUTTON_UP:
00074           lcd_clear();
00075           lcd_write_string("Up", 0, 7);
00076           break;
00077         case JS_BUTTON_DOWN:
00078           lcd_clear();
00079           lcd_write_string("Down", 1, 6);
00080           break;
00081       }
00082       js_status_last = js_status;
00083     }
00084   }
00085 }
00086 

Generated on Fri Apr 20 2012 14:11:45 for nRFGo SDK by  doxygen 1.7.2