Library for Nuelectronics Nokia 3310/5110 LCD Display and joystick.
Fork of N3310LCD by
Joystick.h
00001 /* 00002 * N3310LCD. A program to interface mbed with the nuelectronics 00003 * Nokia 3310 LCD shield from www.nuelectronics.com. Ported from 00004 * the nuelectronics Arduino code. 00005 * 00006 * Copyright (C) <2009> Petras Saduikis <petras@petras.co.uk> 00007 * 00008 * Converted to a mbed library by Andrew D. Lindsay 00009 * 00010 * This file is part of N3310LCD. 00011 * 00012 * N3310LCD is free software: you can redistribute it and/or modify 00013 * it under the terms of the GNU General Public License as published by 00014 * the Free Software Foundation, either version 3 of the License, or 00015 * (at your option) any later version. 00016 * 00017 * N3310LCD is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU General Public License 00023 * along with N3310LCD. If not, see <http://www.gnu.org/licenses/>. 00024 */ 00025 00026 #ifndef SNATCH59_JOYSTICK_H 00027 #define SNATCH59_JOYSTICK_H 00028 00029 #define NUM_KEYS 5 00030 00031 enum eJoystickKey {LEFT_KEY, CENTER_KEY, DOWN_KEY, UP_KEY, RIGHT_KEY}; 00032 00033 class Joystick 00034 { 00035 public: 00036 Joystick(PinName jstick); 00037 00038 int getKeyState(int i); 00039 void resetKeyState(int i); 00040 void updateADCKey(); // call this to initiate joystick read 00041 00042 private: 00043 // data 00044 int buttonCount[NUM_KEYS]; // debounce counters 00045 int buttonStatus[NUM_KEYS]; // button status - pressed/released 00046 int buttonFlag[NUM_KEYS]; // button on flags for user program 00047 00048 static const int adcKeyVal[NUM_KEYS]; 00049 00050 // I/O 00051 AnalogIn joystick; 00052 00053 // functions 00054 int getKey(int input); 00055 }; 00056 00057 #endif
Generated on Wed Jul 13 2022 14:26:13 by
![doxygen](doxygen.png)