Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: AdaFruit_RGBLCDShield MCP23017 mbed RTclock
Fork of MCP_test by
keyreaderadafruit.cpp
00001 #include "mbed.h" 00002 #include "keyreaderadafruit.h" 00003 00004 KeyReaderAdafruit::KeyReaderAdafruit(I2C & in_cI2C) 00005 : Keys(in_cI2C) 00006 , m_cMCP(in_cI2C, 0x20 << 1) 00007 , m_cLCD(m_cMCP) 00008 { 00009 m_cLCD.begin(16,2); 00010 } 00011 00012 uint8_t KeyReaderAdafruit::readButtons() 00013 { 00014 int nKeys = m_cLCD.readButtons(); 00015 uint8_t nKeysOut = eButtonNone; 00016 00017 if (nKeys & BUTTON_UP) nKeysOut |= eButtonUp; 00018 if (nKeys & BUTTON_DOWN) nKeysOut |= eButtonDown; 00019 if (nKeys & BUTTON_LEFT) nKeysOut |= eButtonLeft; 00020 if (nKeys & BUTTON_RIGHT) nKeysOut |= eButtonRight; 00021 if (nKeys & BUTTON_SELECT) nKeysOut |= eButtonSelect; 00022 00023 return nKeysOut; 00024 }
Generated on Thu Jul 14 2022 00:55:23 by
1.7.2
