PokittoLib is the library needed for programming the Pokitto DIY game console (www.pokitto.com)

Dependents:   YATTT sd_map_test cPong SnowDemo ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers HWButtons.h Source File

HWButtons.h

Go to the documentation of this file.
00001 /**************************************************************************/
00002 /*!
00003     @file     HWButtons.h
00004     @author   Jonne Valola
00005 
00006     @section LICENSE
00007 
00008     Software License Agreement (BSD License)
00009 
00010     Copyright (c) 2016, Jonne Valola
00011     All rights reserved.
00012 
00013     Redistribution and use in source and binary forms, with or without
00014     modification, are permitted provided that the following conditions are met:
00015     1. Redistributions of source code must retain the above copyright
00016     notice, this list of conditions and the following disclaimer.
00017     2. Redistributions in binary form must reproduce the above copyright
00018     notice, this list of conditions and the following disclaimer in the
00019     documentation and/or other materials provided with the distribution.
00020     3. Neither the name of the copyright holders nor the
00021     names of its contributors may be used to endorse or promote products
00022     derived from this software without specific prior written permission.
00023 
00024     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
00025     EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00026     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00027     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
00028     DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00029     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00030     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00031     ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00032     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00033     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00034 */
00035 /**************************************************************************/
00036 #ifndef HWBUTTONS_H
00037 #define HWBUTTONS_H
00038 
00039 #include "mbed.h"
00040 #include "Pokitto_settings.h "
00041 
00042 #define BTN_UP      1
00043 #define BTN_RIGHT   2
00044 #define BTN_DOWN    3
00045 #define BTN_LEFT    0
00046 #define BTN_A       4
00047 #define BTN_B       5
00048 #define BTN_C       6
00049 #define NUM_BTN     7
00050 
00051 typedef struct {            /*!< PIN_INT Structure */
00052     __IO uint32_t ISEL;     /*!< Pin Interrupt Mode register */
00053     __IO uint32_t IENR;     /*!< Pin Interrupt Enable (Rising) register */
00054     __IO uint32_t SIENR;    /*!< Set Pin Interrupt Enable (Rising) register */
00055     __IO uint32_t CIENR;    /*!< Clear Pin Interrupt Enable (Rising) register */
00056     __IO uint32_t IENF;     /*!< Pin Interrupt Enable Falling Edge / Active Level register */
00057     __IO uint32_t SIENF;    /*!< Set Pin Interrupt Enable Falling Edge / Active Level register */
00058     __IO uint32_t CIENF;    /*!< Clear Pin Interrupt Enable Falling Edge / Active Level address */
00059     __IO uint32_t RISE;     /*!< Pin Interrupt Rising Edge register */
00060     __IO uint32_t FALL;     /*!< Pin Interrupt Falling Edge register */
00061     __IO uint32_t IST;      /*!< Pin Interrupt Status register */
00062     __IO uint32_t PMCTRL;   /*!< GPIO pattern match interrupt control register          */
00063     __IO uint32_t PMSRC;    /*!< GPIO pattern match interrupt bit-slice source register */
00064     __IO uint32_t PMCFG;    /*!< GPIO pattern match interrupt bit slice configuration register */
00065 } LPC_PIN_INT_T;
00066 
00067 #define LPC_PININT          0xA0004000
00068 #define PININTCH(ch)      (1 << (ch))
00069 
00070 namespace Pokitto {
00071 
00072 extern uint8_t heldStates[];
00073 extern void initButtons();
00074 extern void pollButtons();
00075 
00076 
00077 } // namespace Pokitto
00078 
00079 #endif //HWBUTTONS
00080 
00081