From af815a234f4fc9820e0c3e1b5e084150f49ec539 Mon Sep 17 00:00:00 2001 From: KlausMu Date: Thu, 14 Mar 2024 17:48:52 +0100 Subject: [PATCH] folders removed which are not used anymore --- Platformio/include/README | 39 - Platformio/lib/ESP32-BLE-Keyboard/.piopm | 1 - .../lib/ESP32-BLE-Keyboard/BleKeyboard.cpp | 552 -------------- .../lib/ESP32-BLE-Keyboard/BleKeyboard.h | 189 ----- Platformio/lib/ESP32-BLE-Keyboard/README.md | 162 ----- .../SendKeyStrokes/SendKeyStrokes.ino | 46 -- .../lib/ESP32-BLE-Keyboard/keywords.txt | 24 - .../lib/ESP32-BLE-Keyboard/library.properties | 9 - Platformio/lib/Keypad/LICENSE | 675 ------------------ Platformio/lib/Keypad/README.md | 9 - .../examples/CustomKeypad/CustomKeypad.ino | 37 - .../examples/DynamicKeypad/DynamicKeypad.ino | 213 ------ .../examples/EventKeypad/EventKeypad.ino | 73 -- .../examples/HelloKeypad/HelloKeypad.ino | 35 - .../examples/HelloKeypad3/HelloKeypad3.ino | 68 -- .../lib/Keypad/examples/MultiKey/MultiKey.ino | 78 -- .../examples/loopCounter/loopCounter.ino | 46 -- Platformio/lib/Keypad/keywords.txt | 38 - Platformio/lib/Keypad/library.properties | 9 - Platformio/lib/Keypad/src/Key.cpp | 61 -- Platformio/lib/Keypad/src/Key.h | 68 -- Platformio/lib/Keypad/src/Keypad.cpp | 306 -------- Platformio/lib/Keypad/src/Keypad.h | 149 ---- Platformio/lib/README | 46 -- Platformio/test/README | 11 - 25 files changed, 2944 deletions(-) delete mode 100644 Platformio/include/README delete mode 100644 Platformio/lib/ESP32-BLE-Keyboard/.piopm delete mode 100644 Platformio/lib/ESP32-BLE-Keyboard/BleKeyboard.cpp delete mode 100644 Platformio/lib/ESP32-BLE-Keyboard/BleKeyboard.h delete mode 100644 Platformio/lib/ESP32-BLE-Keyboard/README.md delete mode 100644 Platformio/lib/ESP32-BLE-Keyboard/examples/SendKeyStrokes/SendKeyStrokes.ino delete mode 100644 Platformio/lib/ESP32-BLE-Keyboard/keywords.txt delete mode 100644 Platformio/lib/ESP32-BLE-Keyboard/library.properties delete mode 100644 Platformio/lib/Keypad/LICENSE delete mode 100644 Platformio/lib/Keypad/README.md delete mode 100644 Platformio/lib/Keypad/examples/CustomKeypad/CustomKeypad.ino delete mode 100644 Platformio/lib/Keypad/examples/DynamicKeypad/DynamicKeypad.ino delete mode 100644 Platformio/lib/Keypad/examples/EventKeypad/EventKeypad.ino delete mode 100644 Platformio/lib/Keypad/examples/HelloKeypad/HelloKeypad.ino delete mode 100644 Platformio/lib/Keypad/examples/HelloKeypad3/HelloKeypad3.ino delete mode 100644 Platformio/lib/Keypad/examples/MultiKey/MultiKey.ino delete mode 100644 Platformio/lib/Keypad/examples/loopCounter/loopCounter.ino delete mode 100644 Platformio/lib/Keypad/keywords.txt delete mode 100644 Platformio/lib/Keypad/library.properties delete mode 100644 Platformio/lib/Keypad/src/Key.cpp delete mode 100644 Platformio/lib/Keypad/src/Key.h delete mode 100644 Platformio/lib/Keypad/src/Keypad.cpp delete mode 100644 Platformio/lib/Keypad/src/Keypad.h delete mode 100644 Platformio/lib/README delete mode 100644 Platformio/test/README diff --git a/Platformio/include/README b/Platformio/include/README deleted file mode 100644 index 194dcd4..0000000 --- a/Platformio/include/README +++ /dev/null @@ -1,39 +0,0 @@ - -This directory is intended for project header files. - -A header file is a file containing C declarations and macro definitions -to be shared between several project source files. You request the use of a -header file in your project source file (C, C++, etc) located in `src` folder -by including it, with the C preprocessing directive `#include'. - -```src/main.c - -#include "header.h" - -int main (void) -{ - ... -} -``` - -Including a header file produces the same results as copying the header file -into each source file that needs it. Such copying would be time-consuming -and error-prone. With a header file, the related declarations appear -in only one place. If they need to be changed, they can be changed in one -place, and programs that include the header file will automatically use the -new version when next recompiled. The header file eliminates the labor of -finding and changing all the copies as well as the risk that a failure to -find one copy will result in inconsistencies within a program. - -In C, the usual convention is to give header files names that end with `.h'. -It is most portable to use only letters, digits, dashes, and underscores in -header file names, and at most one dot. - -Read more about using header files in official GCC documentation: - -* Include Syntax -* Include Operation -* Once-Only Headers -* Computed Includes - -https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/Platformio/lib/ESP32-BLE-Keyboard/.piopm b/Platformio/lib/ESP32-BLE-Keyboard/.piopm deleted file mode 100644 index 83d5c7f..0000000 --- a/Platformio/lib/ESP32-BLE-Keyboard/.piopm +++ /dev/null @@ -1 +0,0 @@ -{"type": "library", "name": "ESP32 BLE Keyboard", "version": "0.3.2", "spec": {"owner": "t-vk", "id": 6749, "name": "ESP32 BLE Keyboard", "requirements": null, "uri": null}} \ No newline at end of file diff --git a/Platformio/lib/ESP32-BLE-Keyboard/BleKeyboard.cpp b/Platformio/lib/ESP32-BLE-Keyboard/BleKeyboard.cpp deleted file mode 100644 index a6216e3..0000000 --- a/Platformio/lib/ESP32-BLE-Keyboard/BleKeyboard.cpp +++ /dev/null @@ -1,552 +0,0 @@ -#include "BleKeyboard.h" - -#if defined(USE_NIMBLE) -#include -#include -#include -#include -#else -#include -#include -#include -#include "BLE2902.h" -#include "BLEHIDDevice.h" -#endif // USE_NIMBLE -#include "HIDTypes.h" -#include -#include "sdkconfig.h" - - -#if defined(CONFIG_ARDUHAL_ESP_LOG) - #include "esp32-hal-log.h" - #define LOG_TAG "" -#else - #include "esp_log.h" - static const char* LOG_TAG = "BLEDevice"; -#endif - - -// Report IDs: -#define KEYBOARD_ID 0x01 -#define MEDIA_KEYS_ID 0x02 - -static const uint8_t _hidReportDescriptor[] = { - USAGE_PAGE(1), 0x01, // USAGE_PAGE (Generic Desktop Ctrls) - USAGE(1), 0x06, // USAGE (Keyboard) - COLLECTION(1), 0x01, // COLLECTION (Application) - // ------------------------------------------------- Keyboard - REPORT_ID(1), KEYBOARD_ID, // REPORT_ID (1) - USAGE_PAGE(1), 0x07, // USAGE_PAGE (Kbrd/Keypad) - USAGE_MINIMUM(1), 0xE0, // USAGE_MINIMUM (0xE0) - USAGE_MAXIMUM(1), 0xE7, // USAGE_MAXIMUM (0xE7) - LOGICAL_MINIMUM(1), 0x00, // LOGICAL_MINIMUM (0) - LOGICAL_MAXIMUM(1), 0x01, // Logical Maximum (1) - REPORT_SIZE(1), 0x01, // REPORT_SIZE (1) - REPORT_COUNT(1), 0x08, // REPORT_COUNT (8) - HIDINPUT(1), 0x02, // INPUT (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) - REPORT_COUNT(1), 0x01, // REPORT_COUNT (1) ; 1 byte (Reserved) - REPORT_SIZE(1), 0x08, // REPORT_SIZE (8) - HIDINPUT(1), 0x01, // INPUT (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) - REPORT_COUNT(1), 0x05, // REPORT_COUNT (5) ; 5 bits (Num lock, Caps lock, Scroll lock, Compose, Kana) - REPORT_SIZE(1), 0x01, // REPORT_SIZE (1) - USAGE_PAGE(1), 0x08, // USAGE_PAGE (LEDs) - USAGE_MINIMUM(1), 0x01, // USAGE_MINIMUM (0x01) ; Num Lock - USAGE_MAXIMUM(1), 0x05, // USAGE_MAXIMUM (0x05) ; Kana - HIDOUTPUT(1), 0x02, // OUTPUT (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) - REPORT_COUNT(1), 0x01, // REPORT_COUNT (1) ; 3 bits (Padding) - REPORT_SIZE(1), 0x03, // REPORT_SIZE (3) - HIDOUTPUT(1), 0x01, // OUTPUT (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) - REPORT_COUNT(1), 0x06, // REPORT_COUNT (6) ; 6 bytes (Keys) - REPORT_SIZE(1), 0x08, // REPORT_SIZE(8) - LOGICAL_MINIMUM(1), 0x00, // LOGICAL_MINIMUM(0) - LOGICAL_MAXIMUM(1), 0x65, // LOGICAL_MAXIMUM(0x65) ; 101 keys - USAGE_PAGE(1), 0x07, // USAGE_PAGE (Kbrd/Keypad) - USAGE_MINIMUM(1), 0x00, // USAGE_MINIMUM (0) - USAGE_MAXIMUM(1), 0x65, // USAGE_MAXIMUM (0x65) - HIDINPUT(1), 0x00, // INPUT (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) - END_COLLECTION(0), // END_COLLECTION - // ------------------------------------------------- Media Keys - USAGE_PAGE(1), 0x0C, // USAGE_PAGE (Consumer) - USAGE(1), 0x01, // USAGE (Consumer Control) - COLLECTION(1), 0x01, // COLLECTION (Application) - REPORT_ID(1), MEDIA_KEYS_ID, // REPORT_ID (3) - USAGE_PAGE(1), 0x0C, // USAGE_PAGE (Consumer) - LOGICAL_MINIMUM(1), 0x00, // LOGICAL_MINIMUM (0) - LOGICAL_MAXIMUM(1), 0x01, // LOGICAL_MAXIMUM (1) - REPORT_SIZE(1), 0x01, // REPORT_SIZE (1) - REPORT_COUNT(1), 0x10, // REPORT_COUNT (16) - USAGE(1), 0xB5, // USAGE (Scan Next Track) ; bit 0: 1 - USAGE(1), 0xB6, // USAGE (Scan Previous Track) ; bit 1: 2 - USAGE(1), 0xB7, // USAGE (Stop) ; bit 2: 4 - USAGE(1), 0xCD, // USAGE (Play/Pause) ; bit 3: 8 - USAGE(1), 0xE2, // USAGE (Mute) ; bit 4: 16 - USAGE(1), 0xE9, // USAGE (Volume Increment) ; bit 5: 32 - USAGE(1), 0xEA, // USAGE (Volume Decrement) ; bit 6: 64 - USAGE(2), 0x23, 0x02, // Usage (WWW Home) ; bit 7: 128 - USAGE(2), 0x94, 0x01, // Usage (My Computer) ; bit 0: 1 - // original from BLE-Keyboard - // USAGE(2), 0x92, 0x01, // Usage (Calculator) ; bit 1: 2 - // changed for usage in OMOTE - USAGE(1), 0xB3, // USAGE (Fast Forward); bit 1: 2 - USAGE(2), 0x2A, 0x02, // Usage (WWW fav) ; bit 2: 4 - USAGE(2), 0x21, 0x02, // Usage (WWW search) ; bit 3: 8 - USAGE(2), 0x26, 0x02, // Usage (WWW stop) ; bit 4: 16 - USAGE(2), 0x24, 0x02, // Usage (WWW back) ; bit 5: 32 - USAGE(2), 0x83, 0x01, // Usage (Media sel) ; bit 6: 64 - // original from BLE-Keyboard - // USAGE(2), 0x8A, 0x01, // Usage (Mail) ; bit 7: 128 - // changed for usage in OMOTE - USAGE(1), 0xB4, // USAGE (Rewind) ; bit 7: 128 - HIDINPUT(1), 0x02, // INPUT (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) - END_COLLECTION(0) // END_COLLECTION -}; - -BleKeyboard::BleKeyboard(std::string deviceName, std::string deviceManufacturer, uint8_t batteryLevel) - : hid(0) - , deviceName(std::string(deviceName).substr(0, 15)) - , deviceManufacturer(std::string(deviceManufacturer).substr(0,15)) - , batteryLevel(batteryLevel) {} - -void BleKeyboard::begin(void) -{ - BLEDevice::init(deviceName); - BLEServer* pServer = BLEDevice::createServer(); - pServer->setCallbacks(this); - - hid = new BLEHIDDevice(pServer); - inputKeyboard = hid->inputReport(KEYBOARD_ID); // <-- input REPORTID from report map - outputKeyboard = hid->outputReport(KEYBOARD_ID); - inputMediaKeys = hid->inputReport(MEDIA_KEYS_ID); - - outputKeyboard->setCallbacks(this); - - hid->manufacturer()->setValue(deviceManufacturer); - - hid->pnp(0x02, vid, pid, version); - hid->hidInfo(0x00, 0x01); - - -#if defined(USE_NIMBLE) - - BLEDevice::setSecurityAuth(true, true, true); - -#else - - BLESecurity* pSecurity = new BLESecurity(); - pSecurity->setAuthenticationMode(ESP_LE_AUTH_REQ_SC_MITM_BOND); - -#endif // USE_NIMBLE - - hid->reportMap((uint8_t*)_hidReportDescriptor, sizeof(_hidReportDescriptor)); - hid->startServices(); - - onStarted(pServer); - - advertising = pServer->getAdvertising(); - advertising->setAppearance(HID_KEYBOARD); - advertising->addServiceUUID(hid->hidService()->getUUID()); - advertising->setScanResponse(false); - advertising->start(); - hid->setBatteryLevel(batteryLevel); - - ESP_LOGD(LOG_TAG, "Advertising started!"); -} - -void BleKeyboard::end(void) -{ -} - -bool BleKeyboard::isConnected(void) { - return this->connected; -} - -void BleKeyboard::setBatteryLevel(uint8_t level) { - this->batteryLevel = level; - if (hid != 0) - this->hid->setBatteryLevel(this->batteryLevel); -} - -//must be called before begin in order to set the name -void BleKeyboard::setName(std::string deviceName) { - this->deviceName = deviceName; -} - -/** - * @brief Sets the waiting time (in milliseconds) between multiple keystrokes in NimBLE mode. - * - * @param ms Time in milliseconds - */ -void BleKeyboard::setDelay(uint32_t ms) { - this->_delay_ms = ms; -} - -void BleKeyboard::set_vendor_id(uint16_t vid) { - this->vid = vid; -} - -void BleKeyboard::set_product_id(uint16_t pid) { - this->pid = pid; -} - -void BleKeyboard::set_version(uint16_t version) { - this->version = version; -} - -void BleKeyboard::sendReport(KeyReport* keys) -{ - if (this->isConnected()) - { - this->inputKeyboard->setValue((uint8_t*)keys, sizeof(KeyReport)); - this->inputKeyboard->notify(); -#if defined(USE_NIMBLE) - // vTaskDelay(delayTicks); - this->delay_ms(_delay_ms); -#endif // USE_NIMBLE - } -} - -void BleKeyboard::sendReport(MediaKeyReport* keys) -{ - if (this->isConnected()) - { - this->inputMediaKeys->setValue((uint8_t*)keys, sizeof(MediaKeyReport)); - this->inputMediaKeys->notify(); -#if defined(USE_NIMBLE) - //vTaskDelay(delayTicks); - this->delay_ms(_delay_ms); -#endif // USE_NIMBLE - } -} - -extern -const uint8_t _asciimap[128] PROGMEM; - -#define SHIFT 0x80 -const uint8_t _asciimap[128] = -{ - 0x00, // NUL - 0x00, // SOH - 0x00, // STX - 0x00, // ETX - 0x00, // EOT - 0x00, // ENQ - 0x00, // ACK - 0x00, // BEL - 0x2a, // BS Backspace - 0x2b, // TAB Tab - 0x28, // LF Enter - 0x00, // VT - 0x00, // FF - 0x00, // CR - 0x00, // SO - 0x00, // SI - 0x00, // DEL - 0x00, // DC1 - 0x00, // DC2 - 0x00, // DC3 - 0x00, // DC4 - 0x00, // NAK - 0x00, // SYN - 0x00, // ETB - 0x00, // CAN - 0x00, // EM - 0x00, // SUB - 0x00, // ESC - 0x00, // FS - 0x00, // GS - 0x00, // RS - 0x00, // US - - 0x2c, // ' ' - 0x1e|SHIFT, // ! - 0x34|SHIFT, // " - 0x20|SHIFT, // # - 0x21|SHIFT, // $ - 0x22|SHIFT, // % - 0x24|SHIFT, // & - 0x34, // ' - 0x26|SHIFT, // ( - 0x27|SHIFT, // ) - 0x25|SHIFT, // * - 0x2e|SHIFT, // + - 0x36, // , - 0x2d, // - - 0x37, // . - 0x38, // / - 0x27, // 0 - 0x1e, // 1 - 0x1f, // 2 - 0x20, // 3 - 0x21, // 4 - 0x22, // 5 - 0x23, // 6 - 0x24, // 7 - 0x25, // 8 - 0x26, // 9 - 0x33|SHIFT, // : - 0x33, // ; - 0x36|SHIFT, // < - 0x2e, // = - 0x37|SHIFT, // > - 0x38|SHIFT, // ? - 0x1f|SHIFT, // @ - 0x04|SHIFT, // A - 0x05|SHIFT, // B - 0x06|SHIFT, // C - 0x07|SHIFT, // D - 0x08|SHIFT, // E - 0x09|SHIFT, // F - 0x0a|SHIFT, // G - 0x0b|SHIFT, // H - 0x0c|SHIFT, // I - 0x0d|SHIFT, // J - 0x0e|SHIFT, // K - 0x0f|SHIFT, // L - 0x10|SHIFT, // M - 0x11|SHIFT, // N - 0x12|SHIFT, // O - 0x13|SHIFT, // P - 0x14|SHIFT, // Q - 0x15|SHIFT, // R - 0x16|SHIFT, // S - 0x17|SHIFT, // T - 0x18|SHIFT, // U - 0x19|SHIFT, // V - 0x1a|SHIFT, // W - 0x1b|SHIFT, // X - 0x1c|SHIFT, // Y - 0x1d|SHIFT, // Z - 0x2f, // [ - 0x31, // bslash - 0x30, // ] - 0x23|SHIFT, // ^ - 0x2d|SHIFT, // _ - 0x35, // ` - 0x04, // a - 0x05, // b - 0x06, // c - 0x07, // d - 0x08, // e - 0x09, // f - 0x0a, // g - 0x0b, // h - 0x0c, // i - 0x0d, // j - 0x0e, // k - 0x0f, // l - 0x10, // m - 0x11, // n - 0x12, // o - 0x13, // p - 0x14, // q - 0x15, // r - 0x16, // s - 0x17, // t - 0x18, // u - 0x19, // v - 0x1a, // w - 0x1b, // x - 0x1c, // y - 0x1d, // z - 0x2f|SHIFT, // { - 0x31|SHIFT, // | - 0x30|SHIFT, // } - 0x35|SHIFT, // ~ - 0 // DEL -}; - - -uint8_t USBPutChar(uint8_t c); - -// press() adds the specified key (printing, non-printing, or modifier) -// to the persistent key report and sends the report. Because of the way -// USB HID works, the host acts like the key remains pressed until we -// call release(), releaseAll(), or otherwise clear the report and resend. -size_t BleKeyboard::press(uint8_t k) -{ - uint8_t i; - if (k >= 136) { // it's a non-printing key (not a modifier) - k = k - 136; - } else if (k >= 128) { // it's a modifier key - _keyReport.modifiers |= (1<<(k-128)); - k = 0; - } else { // it's a printing key - k = pgm_read_byte(_asciimap + k); - if (!k) { - setWriteError(); - return 0; - } - if (k & 0x80) { // it's a capital letter or other character reached with shift - _keyReport.modifiers |= 0x02; // the left shift modifier - k &= 0x7F; - } - } - - // Add k to the key report only if it's not already present - // and if there is an empty slot. - if (_keyReport.keys[0] != k && _keyReport.keys[1] != k && - _keyReport.keys[2] != k && _keyReport.keys[3] != k && - _keyReport.keys[4] != k && _keyReport.keys[5] != k) { - - for (i=0; i<6; i++) { - if (_keyReport.keys[i] == 0x00) { - _keyReport.keys[i] = k; - break; - } - } - if (i == 6) { - setWriteError(); - return 0; - } - } - sendReport(&_keyReport); - return 1; -} - -size_t BleKeyboard::press(const MediaKeyReport k) -{ - uint16_t k_16 = k[1] | (k[0] << 8); - uint16_t mediaKeyReport_16 = _mediaKeyReport[1] | (_mediaKeyReport[0] << 8); - - mediaKeyReport_16 |= k_16; - _mediaKeyReport[0] = (uint8_t)((mediaKeyReport_16 & 0xFF00) >> 8); - _mediaKeyReport[1] = (uint8_t)(mediaKeyReport_16 & 0x00FF); - - sendReport(&_mediaKeyReport); - return 1; -} - -// release() takes the specified key out of the persistent key report and -// sends the report. This tells the OS the key is no longer pressed and that -// it shouldn't be repeated any more. -size_t BleKeyboard::release(uint8_t k) -{ - uint8_t i; - if (k >= 136) { // it's a non-printing key (not a modifier) - k = k - 136; - } else if (k >= 128) { // it's a modifier key - _keyReport.modifiers &= ~(1<<(k-128)); - k = 0; - } else { // it's a printing key - k = pgm_read_byte(_asciimap + k); - if (!k) { - return 0; - } - if (k & 0x80) { // it's a capital letter or other character reached with shift - _keyReport.modifiers &= ~(0x02); // the left shift modifier - k &= 0x7F; - } - } - - // Test the key report to see if k is present. Clear it if it exists. - // Check all positions in case the key is present more than once (which it shouldn't be) - for (i=0; i<6; i++) { - if (0 != k && _keyReport.keys[i] == k) { - _keyReport.keys[i] = 0x00; - } - } - - sendReport(&_keyReport); - return 1; -} - -size_t BleKeyboard::release(const MediaKeyReport k) -{ - uint16_t k_16 = k[1] | (k[0] << 8); - uint16_t mediaKeyReport_16 = _mediaKeyReport[1] | (_mediaKeyReport[0] << 8); - mediaKeyReport_16 &= ~k_16; - _mediaKeyReport[0] = (uint8_t)((mediaKeyReport_16 & 0xFF00) >> 8); - _mediaKeyReport[1] = (uint8_t)(mediaKeyReport_16 & 0x00FF); - - sendReport(&_mediaKeyReport); - return 1; -} - -void BleKeyboard::releaseAll(void) -{ - _keyReport.keys[0] = 0; - _keyReport.keys[1] = 0; - _keyReport.keys[2] = 0; - _keyReport.keys[3] = 0; - _keyReport.keys[4] = 0; - _keyReport.keys[5] = 0; - _keyReport.modifiers = 0; - _mediaKeyReport[0] = 0; - _mediaKeyReport[1] = 0; - sendReport(&_keyReport); -} - -size_t BleKeyboard::write(uint8_t c) -{ - uint8_t p = press(c); // Keydown - release(c); // Keyup - return p; // just return the result of press() since release() almost always returns 1 -} - -size_t BleKeyboard::write(const MediaKeyReport c) -{ - uint16_t p = press(c); // Keydown - release(c); // Keyup - return p; // just return the result of press() since release() almost always returns 1 -} - -size_t BleKeyboard::write(const uint8_t *buffer, size_t size) { - size_t n = 0; - while (size--) { - if (*buffer != '\r') { - if (write(*buffer)) { - n++; - } else { - break; - } - } - buffer++; - } - return n; -} - -void BleKeyboard::onConnect(BLEServer* pServer) { - this->connected = true; - -#if !defined(USE_NIMBLE) - - BLE2902* desc = (BLE2902*)this->inputKeyboard->getDescriptorByUUID(BLEUUID((uint16_t)0x2902)); - desc->setNotifications(true); - desc = (BLE2902*)this->inputMediaKeys->getDescriptorByUUID(BLEUUID((uint16_t)0x2902)); - desc->setNotifications(true); - -#endif // !USE_NIMBLE - -} - -void BleKeyboard::onDisconnect(BLEServer* pServer) { - this->connected = false; - -#if !defined(USE_NIMBLE) - - BLE2902* desc = (BLE2902*)this->inputKeyboard->getDescriptorByUUID(BLEUUID((uint16_t)0x2902)); - desc->setNotifications(false); - desc = (BLE2902*)this->inputMediaKeys->getDescriptorByUUID(BLEUUID((uint16_t)0x2902)); - desc->setNotifications(false); - - advertising->start(); - -#endif // !USE_NIMBLE -} - -void BleKeyboard::onWrite(BLECharacteristic* me) { - uint8_t* value = (uint8_t*)(me->getValue().c_str()); - (void)value; - ESP_LOGI(LOG_TAG, "special keys: %d", *value); -} - -void BleKeyboard::delay_ms(uint64_t ms) { - uint64_t m = esp_timer_get_time(); - if(ms){ - uint64_t e = (m + (ms * 1000)); - if(m > e){ //overflow - while(esp_timer_get_time() > e) { } - } - while(esp_timer_get_time() < e) {} - } -} \ No newline at end of file diff --git a/Platformio/lib/ESP32-BLE-Keyboard/BleKeyboard.h b/Platformio/lib/ESP32-BLE-Keyboard/BleKeyboard.h deleted file mode 100644 index f30dd40..0000000 --- a/Platformio/lib/ESP32-BLE-Keyboard/BleKeyboard.h +++ /dev/null @@ -1,189 +0,0 @@ -// uncomment the following line to use NimBLE library -//#define USE_NIMBLE - -#ifndef ESP32_BLE_KEYBOARD_H -#define ESP32_BLE_KEYBOARD_H -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) - -#if defined(USE_NIMBLE) - -#include "NimBLECharacteristic.h" -#include "NimBLEHIDDevice.h" - -#define BLEDevice NimBLEDevice -#define BLEServerCallbacks NimBLEServerCallbacks -#define BLECharacteristicCallbacks NimBLECharacteristicCallbacks -#define BLEHIDDevice NimBLEHIDDevice -#define BLECharacteristic NimBLECharacteristic -#define BLEAdvertising NimBLEAdvertising -#define BLEServer NimBLEServer - -#else - -#include "BLEHIDDevice.h" -#include "BLECharacteristic.h" - -#endif // USE_NIMBLE - -#include "Print.h" - -#define BLE_KEYBOARD_VERSION "0.0.4" -#define BLE_KEYBOARD_VERSION_MAJOR 0 -#define BLE_KEYBOARD_VERSION_MINOR 0 -#define BLE_KEYBOARD_VERSION_REVISION 4 - -const uint8_t KEY_LEFT_CTRL = 0x80; -const uint8_t KEY_LEFT_SHIFT = 0x81; -const uint8_t KEY_LEFT_ALT = 0x82; -const uint8_t KEY_LEFT_GUI = 0x83; -const uint8_t KEY_RIGHT_CTRL = 0x84; -const uint8_t KEY_RIGHT_SHIFT = 0x85; -const uint8_t KEY_RIGHT_ALT = 0x86; -const uint8_t KEY_RIGHT_GUI = 0x87; - -const uint8_t KEY_UP_ARROW = 0xDA; -const uint8_t KEY_DOWN_ARROW = 0xD9; -const uint8_t KEY_LEFT_ARROW = 0xD8; -const uint8_t KEY_RIGHT_ARROW = 0xD7; -const uint8_t KEY_BACKSPACE = 0xB2; -const uint8_t KEY_TAB = 0xB3; -const uint8_t KEY_RETURN = 0xB0; -const uint8_t KEY_ESC = 0xB1; -const uint8_t KEY_INSERT = 0xD1; -const uint8_t KEY_PRTSC = 0xCE; -const uint8_t KEY_DELETE = 0xD4; -const uint8_t KEY_PAGE_UP = 0xD3; -const uint8_t KEY_PAGE_DOWN = 0xD6; -const uint8_t KEY_HOME = 0xD2; -const uint8_t KEY_END = 0xD5; -const uint8_t KEY_CAPS_LOCK = 0xC1; -const uint8_t KEY_F1 = 0xC2; -const uint8_t KEY_F2 = 0xC3; -const uint8_t KEY_F3 = 0xC4; -const uint8_t KEY_F4 = 0xC5; -const uint8_t KEY_F5 = 0xC6; -const uint8_t KEY_F6 = 0xC7; -const uint8_t KEY_F7 = 0xC8; -const uint8_t KEY_F8 = 0xC9; -const uint8_t KEY_F9 = 0xCA; -const uint8_t KEY_F10 = 0xCB; -const uint8_t KEY_F11 = 0xCC; -const uint8_t KEY_F12 = 0xCD; -const uint8_t KEY_F13 = 0xF0; -const uint8_t KEY_F14 = 0xF1; -const uint8_t KEY_F15 = 0xF2; -const uint8_t KEY_F16 = 0xF3; -const uint8_t KEY_F17 = 0xF4; -const uint8_t KEY_F18 = 0xF5; -const uint8_t KEY_F19 = 0xF6; -const uint8_t KEY_F20 = 0xF7; -const uint8_t KEY_F21 = 0xF8; -const uint8_t KEY_F22 = 0xF9; -const uint8_t KEY_F23 = 0xFA; -const uint8_t KEY_F24 = 0xFB; - -const uint8_t KEY_NUM_0 = 0xEA; -const uint8_t KEY_NUM_1 = 0xE1; -const uint8_t KEY_NUM_2 = 0xE2; -const uint8_t KEY_NUM_3 = 0xE3; -const uint8_t KEY_NUM_4 = 0xE4; -const uint8_t KEY_NUM_5 = 0xE5; -const uint8_t KEY_NUM_6 = 0xE6; -const uint8_t KEY_NUM_7 = 0xE7; -const uint8_t KEY_NUM_8 = 0xE8; -const uint8_t KEY_NUM_9 = 0xE9; -const uint8_t KEY_NUM_SLASH = 0xDC; -const uint8_t KEY_NUM_ASTERISK = 0xDD; -const uint8_t KEY_NUM_MINUS = 0xDE; -const uint8_t KEY_NUM_PLUS = 0xDF; -const uint8_t KEY_NUM_ENTER = 0xE0; -const uint8_t KEY_NUM_PERIOD = 0xEB; - -typedef uint8_t MediaKeyReport[2]; - -const MediaKeyReport KEY_MEDIA_NEXT_TRACK = {1, 0}; -const MediaKeyReport KEY_MEDIA_PREVIOUS_TRACK = {2, 0}; -const MediaKeyReport KEY_MEDIA_STOP = {4, 0}; -const MediaKeyReport KEY_MEDIA_PLAY_PAUSE = {8, 0}; -const MediaKeyReport KEY_MEDIA_MUTE = {16, 0}; -const MediaKeyReport KEY_MEDIA_VOLUME_UP = {32, 0}; -const MediaKeyReport KEY_MEDIA_VOLUME_DOWN = {64, 0}; -const MediaKeyReport KEY_MEDIA_WWW_HOME = {128, 0}; -const MediaKeyReport KEY_MEDIA_LOCAL_MACHINE_BROWSER = {0, 1}; // Opens "My Computer" on Windows -// original from BLE-Keyboard -// const MediaKeyReport KEY_MEDIA_CALCULATOR = {0, 2}; -// changed for usage in OMOTE -const MediaKeyReport KEY_MEDIA_FASTFORWARD = {0, 2}; -const MediaKeyReport KEY_MEDIA_WWW_BOOKMARKS = {0, 4}; -const MediaKeyReport KEY_MEDIA_WWW_SEARCH = {0, 8}; -const MediaKeyReport KEY_MEDIA_WWW_STOP = {0, 16}; -const MediaKeyReport KEY_MEDIA_WWW_BACK = {0, 32}; -const MediaKeyReport KEY_MEDIA_CONSUMER_CONTROL_CONFIGURATION = {0, 64}; // Media Selection -// original from BLE-Keyboard -// const MediaKeyReport KEY_MEDIA_EMAIL_READER = {0, 128}; -// changed for usage in OMOTE -const MediaKeyReport KEY_MEDIA_REWIND = {0, 128}; - - -// Low level key report: up to 6 keys and shift, ctrl etc at once -typedef struct -{ - uint8_t modifiers; - uint8_t reserved; - uint8_t keys[6]; -} KeyReport; - -class BleKeyboard : public Print, public BLEServerCallbacks, public BLECharacteristicCallbacks -{ -private: - BLEHIDDevice* hid; - BLECharacteristic* inputKeyboard; - BLECharacteristic* outputKeyboard; - BLECharacteristic* inputMediaKeys; - BLEAdvertising* advertising; - KeyReport _keyReport; - MediaKeyReport _mediaKeyReport; - std::string deviceName; - std::string deviceManufacturer; - uint8_t batteryLevel; - bool connected = false; - uint32_t _delay_ms = 7; - void delay_ms(uint64_t ms); - - uint16_t vid = 0x05ac; - uint16_t pid = 0x820a; - uint16_t version = 0x0210; - -public: - BleKeyboard(std::string deviceName = "ESP32 Keyboard", std::string deviceManufacturer = "Espressif", uint8_t batteryLevel = 100); - void begin(void); - void end(void); - void sendReport(KeyReport* keys); - void sendReport(MediaKeyReport* keys); - size_t press(uint8_t k); - size_t press(const MediaKeyReport k); - size_t release(uint8_t k); - size_t release(const MediaKeyReport k); - size_t write(uint8_t c); - size_t write(const MediaKeyReport c); - size_t write(const uint8_t *buffer, size_t size); - void releaseAll(void); - bool isConnected(void); - void setBatteryLevel(uint8_t level); - void setName(std::string deviceName); - void setDelay(uint32_t ms); - - void set_vendor_id(uint16_t vid); - void set_product_id(uint16_t pid); - void set_version(uint16_t version); -protected: - virtual void onStarted(BLEServer *pServer) { }; - virtual void onConnect(BLEServer* pServer) override; - virtual void onDisconnect(BLEServer* pServer) override; - virtual void onWrite(BLECharacteristic* me) override; - -}; - -#endif // CONFIG_BT_ENABLED -#endif // ESP32_BLE_KEYBOARD_H diff --git a/Platformio/lib/ESP32-BLE-Keyboard/README.md b/Platformio/lib/ESP32-BLE-Keyboard/README.md deleted file mode 100644 index eac0d4e..0000000 --- a/Platformio/lib/ESP32-BLE-Keyboard/README.md +++ /dev/null @@ -1,162 +0,0 @@ -# ESP32 BLE Keyboard library - -This library allows you to make the ESP32 act as a Bluetooth Keyboard and control what it does. -You might also be interested in: -- [ESP32-BLE-Mouse](https://github.com/T-vK/ESP32-BLE-Mouse) -- [ESP32-BLE-Gamepad](https://github.com/lemmingDev/ESP32-BLE-Gamepad) - - -## Features - - - [x] Send key strokes - - [x] Send text - - [x] Press/release individual keys - - [x] Media keys are supported - - [ ] Read Numlock/Capslock/Scrolllock state - - [x] Set battery level (basically works, but doesn't show up in Android's status bar) - - [x] Compatible with Android - - [x] Compatible with Windows - - [x] Compatible with Linux - - [x] Compatible with MacOS X (not stable, some people have issues, doesn't work with old devices) - - [x] Compatible with iOS (not stable, some people have issues, doesn't work with old devices) - -## Installation -- (Make sure you can use the ESP32 with the Arduino IDE. [Instructions can be found here.](https://github.com/espressif/arduino-esp32#installation-instructions)) -- [Download the latest release of this library from the release page.](https://github.com/T-vK/ESP32-BLE-Keyboard/releases) -- In the Arduino IDE go to "Sketch" -> "Include Library" -> "Add .ZIP Library..." and select the file you just downloaded. -- You can now go to "File" -> "Examples" -> "ESP32 BLE Keyboard" and select any of the examples to get started. - -## Example - -``` C++ -/** - * This example turns the ESP32 into a Bluetooth LE keyboard that writes the words, presses Enter, presses a media key and then Ctrl+Alt+Delete - */ -#include - -BleKeyboard bleKeyboard; - -void setup() { - Serial.begin(115200); - Serial.println("Starting BLE work!"); - bleKeyboard.begin(); -} - -void loop() { - if(bleKeyboard.isConnected()) { - Serial.println("Sending 'Hello world'..."); - bleKeyboard.print("Hello world"); - - delay(1000); - - Serial.println("Sending Enter key..."); - bleKeyboard.write(KEY_RETURN); - - delay(1000); - - Serial.println("Sending Play/Pause media key..."); - bleKeyboard.write(KEY_MEDIA_PLAY_PAUSE); - - delay(1000); - - // - // Below is an example of pressing multiple keyboard modifiers - // which by default is commented out. - // - /* Serial.println("Sending Ctrl+Alt+Delete..."); - bleKeyboard.press(KEY_LEFT_CTRL); - bleKeyboard.press(KEY_LEFT_ALT); - bleKeyboard.press(KEY_DELETE); - delay(100); - bleKeyboard.releaseAll(); - */ - - } - Serial.println("Waiting 5 seconds..."); - delay(5000); -} -``` - -## API docs -The BleKeyboard interface is almost identical to the Keyboard Interface, so you can use documentation right here: -https://www.arduino.cc/reference/en/language/functions/usb/keyboard/ - -Just remember that you have to use `bleKeyboard` instead of just `Keyboard` and you need these two lines at the top of your script: -``` -#include -BleKeyboard bleKeyboard; -``` - -In addition to that you can send media keys (which is not possible with the USB keyboard library). Supported are the following: -- KEY_MEDIA_NEXT_TRACK -- KEY_MEDIA_PREVIOUS_TRACK -- KEY_MEDIA_STOP -- KEY_MEDIA_PLAY_PAUSE -- KEY_MEDIA_MUTE -- KEY_MEDIA_VOLUME_UP -- KEY_MEDIA_VOLUME_DOWN -- KEY_MEDIA_WWW_HOME -- KEY_MEDIA_LOCAL_MACHINE_BROWSER // Opens "My Computer" on Windows -- KEY_MEDIA_CALCULATOR -- KEY_MEDIA_WWW_BOOKMARKS -- KEY_MEDIA_WWW_SEARCH -- KEY_MEDIA_WWW_STOP -- KEY_MEDIA_WWW_BACK -- KEY_MEDIA_CONSUMER_CONTROL_CONFIGURATION // Media Selection -- KEY_MEDIA_EMAIL_READER - -There is also Bluetooth specific information that you can set (optional): -Instead of `BleKeyboard bleKeyboard;` you can do `BleKeyboard bleKeyboard("Bluetooth Device Name", "Bluetooth Device Manufacturer", 100);`. (Max lenght is 15 characters, anything beyond that will be truncated.) -The third parameter is the initial battery level of your device. To adjust the battery level later on you can simply call e.g. `bleKeyboard.setBatteryLevel(50)` (set battery level to 50%). -By default the battery level will be set to 100%, the device name will be `ESP32 Bluetooth Keyboard` and the manufacturer will be `Espressif`. -There is also a `setDelay` method to set a delay between each key event. E.g. `bleKeyboard.setDelay(10)` (10 milliseconds). The default is `8`. -This feature is meant to compensate for some applications and devices that can't handle fast input and will skip letters if too many keys are sent in a small time frame. - -## NimBLE-Mode -The NimBLE mode enables a significant saving of RAM and FLASH memory. - -### Comparison (SendKeyStrokes.ino at compile-time) - -**Standard** -``` -RAM: [= ] 9.3% (used 30548 bytes from 327680 bytes) -Flash: [======== ] 75.8% (used 994120 bytes from 1310720 bytes) -``` - -**NimBLE mode** -``` -RAM: [= ] 8.3% (used 27180 bytes from 327680 bytes) -Flash: [==== ] 44.2% (used 579158 bytes from 1310720 bytes) -``` - -### Comparison (SendKeyStrokes.ino at run-time) - -| | Standard | NimBLE mode | difference -|---|--:|--:|--:| -| `ESP.getHeapSize()` | 296.804 | 321.252 | **+ 24.448** | -| `ESP.getFreeHeap()` | 143.572 | 260.764 | **+ 117.192** | -| `ESP.getSketchSize()` | 994.224 | 579.264 | **- 414.960** | - -## How to activate NimBLE mode? - -### ArduinoIDE: -Uncomment the first line in BleKeyboard.h -```C++ -#define USE_NIMBLE -``` - -### PlatformIO: -Change your `platformio.ini` to the following settings -```ini -lib_deps = - NimBLE-Arduino - -build_flags = - -D USE_NIMBLE -``` - -## Credits - -Credits to [chegewara](https://github.com/chegewara) and [the authors of the USB keyboard library](https://github.com/arduino-libraries/Keyboard/) as this project is heavily based on their work! -Also, credits to [duke2421](https://github.com/T-vK/ESP32-BLE-Keyboard/issues/1) who helped a lot with testing, debugging and fixing the device descriptor! -And credits to [sivar2311](https://github.com/sivar2311) for adding NimBLE support, greatly reducing the memory footprint, fixing advertising issues and for adding the `setDelay` method. diff --git a/Platformio/lib/ESP32-BLE-Keyboard/examples/SendKeyStrokes/SendKeyStrokes.ino b/Platformio/lib/ESP32-BLE-Keyboard/examples/SendKeyStrokes/SendKeyStrokes.ino deleted file mode 100644 index 03d1e70..0000000 --- a/Platformio/lib/ESP32-BLE-Keyboard/examples/SendKeyStrokes/SendKeyStrokes.ino +++ /dev/null @@ -1,46 +0,0 @@ -/** - * This example turns the ESP32 into a Bluetooth LE keyboard that writes the words, presses Enter, presses a media key and then Ctrl+Alt+Delete - */ -#include - -BleKeyboard bleKeyboard; - -void setup() { - Serial.begin(115200); - Serial.println("Starting BLE work!"); - bleKeyboard.begin(); -} - -void loop() { - if(bleKeyboard.isConnected()) { - Serial.println("Sending 'Hello world'..."); - bleKeyboard.print("Hello world"); - - delay(1000); - - Serial.println("Sending Enter key..."); - bleKeyboard.write(KEY_RETURN); - - delay(1000); - - Serial.println("Sending Play/Pause media key..."); - bleKeyboard.write(KEY_MEDIA_PLAY_PAUSE); - - delay(1000); - - // - // Below is an example of pressing multiple keyboard modifiers - // which by default is commented out. - /* - Serial.println("Sending Ctrl+Alt+Delete..."); - bleKeyboard.press(KEY_LEFT_CTRL); - bleKeyboard.press(KEY_LEFT_ALT); - bleKeyboard.press(KEY_DELETE); - delay(100); - bleKeyboard.releaseAll(); - */ - } - - Serial.println("Waiting 5 seconds..."); - delay(5000); -} diff --git a/Platformio/lib/ESP32-BLE-Keyboard/keywords.txt b/Platformio/lib/ESP32-BLE-Keyboard/keywords.txt deleted file mode 100644 index 0aa35b7..0000000 --- a/Platformio/lib/ESP32-BLE-Keyboard/keywords.txt +++ /dev/null @@ -1,24 +0,0 @@ -####################################### -# Syntax Coloring Map For ESP32 BLE Keyboard -####################################### -# Class -####################################### - -BleKeyboard KEYWORD1 - -####################################### -# Methods and Functions -####################################### - -begin KEYWORD2 -end KEYWORD2 -write KEYWORD2 -press KEYWORD2 -release KEYWORD2 -releaseAll KEYWORD2 -setBatteryLevel KEYWORD2 -isConnected KEYWORD2 - -####################################### -# Constants -####################################### diff --git a/Platformio/lib/ESP32-BLE-Keyboard/library.properties b/Platformio/lib/ESP32-BLE-Keyboard/library.properties deleted file mode 100644 index 263a10f..0000000 --- a/Platformio/lib/ESP32-BLE-Keyboard/library.properties +++ /dev/null @@ -1,9 +0,0 @@ -name=ESP32 BLE Keyboard -version=0.3.2 -author=T-vK -maintainer=T-vK -sentence=Bluetooth LE Keyboard library for the ESP32. -paragraph=Bluetooth LE Keyboard library for the ESP32. -category=Communication -url=https://github.com/T-vK/ESP32-BLE-Keyboard -architectures=esp32 diff --git a/Platformio/lib/Keypad/LICENSE b/Platformio/lib/Keypad/LICENSE deleted file mode 100644 index 733c072..0000000 --- a/Platformio/lib/Keypad/LICENSE +++ /dev/null @@ -1,675 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - {one line to give the program's name and a brief idea of what it does.} - Copyright (C) {year} {name of author} - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - {project} Copyright (C) {year} {fullname} - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. - diff --git a/Platformio/lib/Keypad/README.md b/Platformio/lib/Keypad/README.md deleted file mode 100644 index 1f6e876..0000000 --- a/Platformio/lib/Keypad/README.md +++ /dev/null @@ -1,9 +0,0 @@ -## Keypad library for Arduino - -**Authors:** *Mark Stanley***,** *Alexander Brevig* - - -This repository is a copy of the code found here [[Arduino Playground]](http://playground.arduino.cc/Code/Keypad). - -The source and file structure has been modified to conform to the newer `1.5r2` library specification and is not compatible with legacy IDE's. -For these IDE's, visit the link above to grab the pre `1.0` compatible version, or download it directly here: [[pre `1.0` version]](http://playground.arduino.cc/uploads/Code/keypad.zip). \ No newline at end of file diff --git a/Platformio/lib/Keypad/examples/CustomKeypad/CustomKeypad.ino b/Platformio/lib/Keypad/examples/CustomKeypad/CustomKeypad.ino deleted file mode 100644 index 659c186..0000000 --- a/Platformio/lib/Keypad/examples/CustomKeypad/CustomKeypad.ino +++ /dev/null @@ -1,37 +0,0 @@ -/* @file CustomKeypad.pde -|| @version 1.0 -|| @author Alexander Brevig -|| @contact alexanderbrevig@gmail.com -|| -|| @description -|| | Demonstrates changing the keypad size and key values. -|| # -*/ -#include - -const byte ROWS = 4; //four rows -const byte COLS = 4; //four columns -//define the cymbols on the buttons of the keypads -char hexaKeys[ROWS][COLS] = { - {'0','1','2','3'}, - {'4','5','6','7'}, - {'8','9','A','B'}, - {'C','D','E','F'} -}; -byte rowPins[ROWS] = {3, 2, 1, 0}; //connect to the row pinouts of the keypad -byte colPins[COLS] = {7, 6, 5, 4}; //connect to the column pinouts of the keypad - -//initialize an instance of class NewKeypad -Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); - -void setup(){ - Serial.begin(9600); -} - -void loop(){ - char customKey = customKeypad.getKey(); - - if (customKey){ - Serial.println(customKey); - } -} diff --git a/Platformio/lib/Keypad/examples/DynamicKeypad/DynamicKeypad.ino b/Platformio/lib/Keypad/examples/DynamicKeypad/DynamicKeypad.ino deleted file mode 100644 index 530b523..0000000 --- a/Platformio/lib/Keypad/examples/DynamicKeypad/DynamicKeypad.ino +++ /dev/null @@ -1,213 +0,0 @@ -/* @file DynamicKeypad.pde -|| @version 1.2 -|| @author Mark Stanley -|| @contact mstanley@technologist.com -|| -|| 07/11/12 - Re-modified (from DynamicKeypadJoe2) to use direct-connect kpds -|| 02/28/12 - Modified to use I2C i/o G. D. (Joe) Young -|| -|| -|| @dificulty: Intermediate -|| -|| @description -|| | This is a demonstration of keypadEvents. It's used to switch between keymaps -|| | while using only one keypad. The main concepts being demonstrated are: -|| | -|| | Using the keypad events, PRESSED, HOLD and RELEASED to simplify coding. -|| | How to use setHoldTime() and why. -|| | Making more than one thing happen with the same key. -|| | Assigning and changing keymaps on the fly. -|| | -|| | Another useful feature is also included with this demonstration although -|| | it's not really one of the concepts that I wanted to show you. If you look -|| | at the code in the PRESSED event you will see that the first section of that -|| | code is used to scroll through three different letters on each key. For -|| | example, pressing the '2' key will step through the letters 'd', 'e' and 'f'. -|| | -|| | -|| | Using the keypad events, PRESSED, HOLD and RELEASED to simplify coding -|| | Very simply, the PRESSED event occurs imediately upon detecting a pressed -|| | key and will not happen again until after a RELEASED event. When the HOLD -|| | event fires it always falls between PRESSED and RELEASED. However, it will -|| | only occur if a key has been pressed for longer than the setHoldTime() interval. -|| | -|| | How to use setHoldTime() and why -|| | Take a look at keypad.setHoldTime(500) in the code. It is used to set the -|| | time delay between a PRESSED event and the start of a HOLD event. The value -|| | 500 is in milliseconds (mS) and is equivalent to half a second. After pressing -|| | a key for 500mS the HOLD event will fire and any code contained therein will be -|| | executed. This event will stay active for as long as you hold the key except -|| | in the case of bug #1 listed above. -|| | -|| | Making more than one thing happen with the same key. -|| | If you look under the PRESSED event (case PRESSED:) you will see that the '#' -|| | is used to print a new line, Serial.println(). But take a look at the first -|| | half of the HOLD event and you will see the same key being used to switch back -|| | and forth between the letter and number keymaps that were created with alphaKeys[4][5] -|| | and numberKeys[4][5] respectively. -|| | -|| | Assigning and changing keymaps on the fly -|| | You will see that the '#' key has been designated to perform two different functions -|| | depending on how long you hold it down. If you press the '#' key for less than the -|| | setHoldTime() then it will print a new line. However, if you hold if for longer -|| | than that it will switch back and forth between numbers and letters. You can see the -|| | keymap changes in the HOLD event. -|| | -|| | -|| | In addition... -|| | You might notice a couple of things that you won't find in the Arduino language -|| | reference. The first would be #include . This is a standard library from -|| | the C programming language and though I don't normally demonstrate these types of -|| | things from outside the Arduino language reference I felt that its use here was -|| | justified by the simplicity that it brings to this sketch. -|| | That simplicity is provided by the two calls to isalpha(key) and isdigit(key). -|| | The first one is used to decide if the key that was pressed is any letter from a-z -|| | or A-Z and the second one decides if the key is any number from 0-9. The return -|| | value from these two functions is either a zero or some positive number greater -|| | than zero. This makes it very simple to test a key and see if it is a number or -|| | a letter. So when you see the following: -|| | -|| | if (isalpha(key)) // this tests to see if your key was a letter -|| | -|| | And the following may be more familiar to some but it is equivalent: -|| | -|| | if (isalpha(key) != 0) // this tests to see if your key was a letter -|| | -|| | And Finally... -|| | To better understand how the event handler affects your code you will need to remember -|| | that it gets called only when you press, hold or release a key. However, once a key -|| | is pressed or held then the event handler gets called at the full speed of the loop(). -|| | -|| # -*/ -#include -#include - -const byte ROWS = 4; //four rows -const byte COLS = 3; //three columns -// Define the keymaps. The blank spot (lower left) is the space character. -char alphaKeys[ROWS][COLS] = { - { 'a','d','g' }, - { 'j','m','p' }, - { 's','v','y' }, - { ' ','.','#' } -}; - -char numberKeys[ROWS][COLS] = { - { '1','2','3' }, - { '4','5','6' }, - { '7','8','9' }, - { ' ','0','#' } -}; - -boolean alpha = false; // Start with the numeric keypad. - -byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad -byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad - -// Create two new keypads, one is a number pad and the other is a letter pad. -Keypad numpad( makeKeymap(numberKeys), rowPins, colPins, sizeof(rowPins), sizeof(colPins) ); -Keypad ltrpad( makeKeymap(alphaKeys), rowPins, colPins, sizeof(rowPins), sizeof(colPins) ); - - -unsigned long startTime; -const byte ledPin = 13; // Use the LED on pin 13. - -void setup() { - Serial.begin(9600); - pinMode(ledPin, OUTPUT); - digitalWrite(ledPin, LOW); // Turns the LED on. - ltrpad.begin( makeKeymap(alphaKeys) ); - numpad.begin( makeKeymap(numberKeys) ); - ltrpad.addEventListener(keypadEvent_ltr); // Add an event listener. - ltrpad.setHoldTime(500); // Default is 1000mS - numpad.addEventListener(keypadEvent_num); // Add an event listener. - numpad.setHoldTime(500); // Default is 1000mS -} - -char key; - -void loop() { - - if( alpha ) - key = ltrpad.getKey( ); - else - key = numpad.getKey( ); - - if (alpha && millis()-startTime>100) { // Flash the LED if we are using the letter keymap. - digitalWrite(ledPin,!digitalRead(ledPin)); - startTime = millis(); - } -} - -static char virtKey = NO_KEY; // Stores the last virtual key press. (Alpha keys only) -static char physKey = NO_KEY; // Stores the last physical key press. (Alpha keys only) -static char buildStr[12]; -static byte buildCount; -static byte pressCount; - -static byte kpadState; - -// Take care of some special events. - -void keypadEvent_ltr(KeypadEvent key) { - // in here when in alpha mode. - kpadState = ltrpad.getState( ); - swOnState( key ); -} // end ltrs keypad events - -void keypadEvent_num( KeypadEvent key ) { - // in here when using number keypad - kpadState = numpad.getState( ); - swOnState( key ); -} // end numbers keypad events - -void swOnState( char key ) { - switch( kpadState ) { - case PRESSED: - if (isalpha(key)) { // This is a letter key so we're using the letter keymap. - if (physKey != key) { // New key so start with the first of 3 characters. - pressCount = 0; - virtKey = key; - physKey = key; - } - else { // Pressed the same key again... - virtKey++; // so select the next character on that key. - pressCount++; // Tracks how many times we press the same key. - } - if (pressCount > 2) { // Last character reached so cycle back to start. - pressCount = 0; - virtKey = key; - } - Serial.print(virtKey); // Used for testing. - } - if (isdigit(key) || key == ' ' || key == '.') - Serial.print(key); - if (key == '#') - Serial.println(); - break; - - case HOLD: - if (key == '#') { // Toggle between keymaps. - if (alpha == true) { // We are currently using a keymap with letters - alpha = false; // Now we want a keymap with numbers. - digitalWrite(ledPin, LOW); - } - else { // We are currently using a keymap with numbers - alpha = true; // Now we want a keymap with letters. - } - } - else { // Some key other than '#' was pressed. - buildStr[buildCount++] = (isalpha(key)) ? virtKey : key; - buildStr[buildCount] = '\0'; - Serial.println(); - Serial.println(buildStr); - } - break; - - case RELEASED: - if (buildCount >= sizeof(buildStr)) buildCount = 0; // Our string is full. Start fresh. - break; - } // end switch-case -}// end switch on state function - diff --git a/Platformio/lib/Keypad/examples/EventKeypad/EventKeypad.ino b/Platformio/lib/Keypad/examples/EventKeypad/EventKeypad.ino deleted file mode 100644 index 4c8d27e..0000000 --- a/Platformio/lib/Keypad/examples/EventKeypad/EventKeypad.ino +++ /dev/null @@ -1,73 +0,0 @@ -/* @file EventSerialKeypad.pde - || @version 1.0 - || @author Alexander Brevig - || @contact alexanderbrevig@gmail.com - || - || @description - || | Demonstrates using the KeypadEvent. - || # - */ -#include - -const byte ROWS = 4; //four rows -const byte COLS = 3; //three columns -char keys[ROWS][COLS] = { - {'1','2','3'}, - {'4','5','6'}, - {'7','8','9'}, - {'*','0','#'} -}; - -byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad -byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad - -Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); -byte ledPin = 13; - -boolean blink = false; -boolean ledPin_state; - -void setup(){ - Serial.begin(9600); - pinMode(ledPin, OUTPUT); // Sets the digital pin as output. - digitalWrite(ledPin, HIGH); // Turn the LED on. - ledPin_state = digitalRead(ledPin); // Store initial LED state. HIGH when LED is on. - keypad.addEventListener(keypadEvent); // Add an event listener for this keypad -} - -void loop(){ - char key = keypad.getKey(); - - if (key) { - Serial.println(key); - } - if (blink){ - digitalWrite(ledPin,!digitalRead(ledPin)); // Change the ledPin from Hi2Lo or Lo2Hi. - delay(100); - } -} - -// Taking care of some special events. -void keypadEvent(KeypadEvent key){ - switch (keypad.getState()){ - case PRESSED: - if (key == '#') { - digitalWrite(ledPin,!digitalRead(ledPin)); - ledPin_state = digitalRead(ledPin); // Remember LED state, lit or unlit. - } - break; - - case RELEASED: - if (key == '*') { - digitalWrite(ledPin,ledPin_state); // Restore LED state from before it started blinking. - blink = false; - } - break; - - case HOLD: - if (key == '*') { - blink = true; // Blink the LED when holding the * key. - } - break; - } -} diff --git a/Platformio/lib/Keypad/examples/HelloKeypad/HelloKeypad.ino b/Platformio/lib/Keypad/examples/HelloKeypad/HelloKeypad.ino deleted file mode 100644 index 261f044..0000000 --- a/Platformio/lib/Keypad/examples/HelloKeypad/HelloKeypad.ino +++ /dev/null @@ -1,35 +0,0 @@ -/* @file HelloKeypad.pde -|| @version 1.0 -|| @author Alexander Brevig -|| @contact alexanderbrevig@gmail.com -|| -|| @description -|| | Demonstrates the simplest use of the matrix Keypad library. -|| # -*/ -#include - -const byte ROWS = 4; //four rows -const byte COLS = 3; //three columns -char keys[ROWS][COLS] = { - {'1','2','3'}, - {'4','5','6'}, - {'7','8','9'}, - {'*','0','#'} -}; -byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad -byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad - -Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); - -void setup(){ - Serial.begin(9600); -} - -void loop(){ - char key = keypad.getKey(); - - if (key){ - Serial.println(key); - } -} diff --git a/Platformio/lib/Keypad/examples/HelloKeypad3/HelloKeypad3.ino b/Platformio/lib/Keypad/examples/HelloKeypad3/HelloKeypad3.ino deleted file mode 100644 index 5605b72..0000000 --- a/Platformio/lib/Keypad/examples/HelloKeypad3/HelloKeypad3.ino +++ /dev/null @@ -1,68 +0,0 @@ -#include - - -const byte ROWS = 2; // use 4X4 keypad for both instances -const byte COLS = 2; -char keys[ROWS][COLS] = { - {'1','2'}, - {'3','4'} -}; -byte rowPins[ROWS] = {5, 4}; //connect to the row pinouts of the keypad -byte colPins[COLS] = {7, 6}; //connect to the column pinouts of the keypad -Keypad kpd( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); - - -const byte ROWSR = 2; -const byte COLSR = 2; -char keysR[ROWSR][COLSR] = { - {'a','b'}, - {'c','d'} -}; -byte rowPinsR[ROWSR] = {3, 2}; //connect to the row pinouts of the keypad -byte colPinsR[COLSR] = {7, 6}; //connect to the column pinouts of the keypad -Keypad kpdR( makeKeymap(keysR), rowPinsR, colPinsR, ROWSR, COLSR ); - - -const byte ROWSUR = 4; -const byte COLSUR = 1; -char keysUR[ROWSUR][COLSUR] = { - {'M'}, - {'A'}, - {'R'}, - {'K'} -}; -// Digitran keypad, bit numbers of PCF8574 i/o port -byte rowPinsUR[ROWSUR] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad -byte colPinsUR[COLSUR] = {8}; //connect to the column pinouts of the keypad - -Keypad kpdUR( makeKeymap(keysUR), rowPinsUR, colPinsUR, ROWSUR, COLSUR ); - - -void setup(){ -// Wire.begin( ); - kpdUR.begin( makeKeymap(keysUR) ); - kpdR.begin( makeKeymap(keysR) ); - kpd.begin( makeKeymap(keys) ); - Serial.begin(9600); - Serial.println( "start" ); -} - -//byte alternate = false; -char key, keyR, keyUR; -void loop(){ - -// alternate = !alternate; - key = kpd.getKey( ); - keyUR = kpdUR.getKey( ); - keyR = kpdR.getKey( ); - - if (key){ - Serial.println(key); - } - if( keyR ) { - Serial.println( keyR ); - } - if( keyUR ) { - Serial.println( keyUR ); - } -} diff --git a/Platformio/lib/Keypad/examples/MultiKey/MultiKey.ino b/Platformio/lib/Keypad/examples/MultiKey/MultiKey.ino deleted file mode 100644 index 850dc1a..0000000 --- a/Platformio/lib/Keypad/examples/MultiKey/MultiKey.ino +++ /dev/null @@ -1,78 +0,0 @@ -/* @file MultiKey.ino -|| @version 1.0 -|| @author Mark Stanley -|| @contact mstanley@technologist.com -|| -|| @description -|| | The latest version, 3.0, of the keypad library supports up to 10 -|| | active keys all being pressed at the same time. This sketch is an -|| | example of how you can get multiple key presses from a keypad or -|| | keyboard. -|| # -*/ - -#include - -const byte ROWS = 4; //four rows -const byte COLS = 3; //three columns -char keys[ROWS][COLS] = { -{'1','2','3'}, -{'4','5','6'}, -{'7','8','9'}, -{'*','0','#'} -}; -byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the kpd -byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the kpd - -Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); - -unsigned long loopCount; -unsigned long startTime; -String msg; - - -void setup() { - Serial.begin(9600); - loopCount = 0; - startTime = millis(); - msg = ""; -} - - -void loop() { - loopCount++; - if ( (millis()-startTime)>5000 ) { - Serial.print("Average loops per second = "); - Serial.println(loopCount/5); - startTime = millis(); - loopCount = 0; - } - - // Fills kpd.key[ ] array with up-to 10 active keys. - // Returns true if there are ANY active keys. - if (kpd.getKeys()) - { - for (int i=0; i - - -const byte ROWS = 4; //four rows -const byte COLS = 3; //three columns -char keys[ROWS][COLS] = { - {'1','2','3'}, - {'4','5','6'}, - {'7','8','9'}, - {'*','0','#'} -}; -byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad -byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad - -Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); - -unsigned long loopCount = 0; -unsigned long timer_ms = 0; - -void setup(){ - Serial.begin(9600); - - // Try playing with different debounceTime settings to see how it affects - // the number of times per second your loop will run. The library prevents - // setting it to anything below 1 millisecond. - kpd.setDebounceTime(10); // setDebounceTime(mS) -} - -void loop(){ - char key = kpd.getKey(); - - // Report the number of times through the loop in 1 second. This will give - // you a relative idea of just how much the debounceTime has changed the - // speed of your code. If you set a high debounceTime your loopCount will - // look good but your keypresses will start to feel sluggish. - if ((millis() - timer_ms) > 1000) { - Serial.print("Your loop code ran "); - Serial.print(loopCount); - Serial.println(" times over the last second"); - loopCount = 0; - timer_ms = millis(); - } - loopCount++; - if(key) - Serial.println(key); -} diff --git a/Platformio/lib/Keypad/keywords.txt b/Platformio/lib/Keypad/keywords.txt deleted file mode 100644 index e400940..0000000 --- a/Platformio/lib/Keypad/keywords.txt +++ /dev/null @@ -1,38 +0,0 @@ -# Keypad Library data types -KeyState KEYWORD1 -Keypad KEYWORD1 -KeypadEvent KEYWORD1 - -# Keypad Library constants -NO_KEY LITERAL1 -IDLE LITERAL1 -PRESSED LITERAL1 -HOLD LITERAL1 -RELEASED LITERAL1 - -# Keypad Library methods & functions -addEventListener KEYWORD2 -bitMap KEYWORD2 -findKeyInList KEYWORD2 -getKey KEYWORD2 -getKeys KEYWORD2 -getState KEYWORD2 -holdTimer KEYWORD2 -isPressed KEYWORD2 -keyStateChanged KEYWORD2 -numKeys KEYWORD2 -pin_mode KEYWORD2 -pin_write KEYWORD2 -pin_read KEYWORD2 -setDebounceTime KEYWORD2 -setHoldTime KEYWORD2 -waitForKey KEYWORD2 - -# this is a macro that converts 2d arrays to pointers -makeKeymap KEYWORD2 - -# List of objects created in the example sketches. -kpd KEYWORD3 -keypad KEYWORD3 -kbrd KEYWORD3 -keyboard KEYWORD3 diff --git a/Platformio/lib/Keypad/library.properties b/Platformio/lib/Keypad/library.properties deleted file mode 100644 index 5a9d012..0000000 --- a/Platformio/lib/Keypad/library.properties +++ /dev/null @@ -1,9 +0,0 @@ -name=Keypad -version=3.1.1 -author=Mark Stanley, Alexander Brevig -maintainer=Community https://github.com/Chris--A/Keypad -sentence=Keypad is a library for using matrix style keypads with the Arduino. -paragraph=As of version 3.0 it now supports mulitple keypresses. This library is based upon the Keypad Tutorial. It was created to promote Hardware Abstraction. It improves readability of the code by hiding the pinMode and digitalRead calls for the user. -category=Device Control -url=http://playground.arduino.cc/Code/Keypad -architectures=* \ No newline at end of file diff --git a/Platformio/lib/Keypad/src/Key.cpp b/Platformio/lib/Keypad/src/Key.cpp deleted file mode 100644 index 4c9718d..0000000 --- a/Platformio/lib/Keypad/src/Key.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* -|| @file Key.cpp -|| @version 1.0 -|| @author Mark Stanley -|| @contact mstanley@technologist.com -|| -|| @description -|| | Key class provides an abstract definition of a key or button -|| | and was initially designed to be used in conjunction with a -|| | state-machine. -|| # -|| -|| @license -|| | This library is free software; you can redistribute it and/or -|| | modify it under the terms of the GNU Lesser General Public -|| | License as published by the Free Software Foundation; version -|| | 2.1 of the License. -|| | -|| | This library is distributed in the hope that it will be useful, -|| | but WITHOUT ANY WARRANTY; without even the implied warranty of -|| | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -|| | Lesser General Public License for more details. -|| | -|| | You should have received a copy of the GNU Lesser General Public -|| | License along with this library; if not, write to the Free Software -|| | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -|| # -|| -*/ -#include - - -// default constructor -Key::Key() { - kchar = NO_KEY; - kstate = IDLE; - stateChanged = false; -} - -// constructor -Key::Key(char userKeyChar) { - kchar = userKeyChar; - kcode = -1; - kstate = IDLE; - stateChanged = false; -} - - -void Key::key_update (char userKeyChar, KeyState userState, boolean userStatus) { - kchar = userKeyChar; - kstate = userState; - stateChanged = userStatus; -} - - - -/* -|| @changelog -|| | 1.0 2012-06-04 - Mark Stanley : Initial Release -|| # -*/ diff --git a/Platformio/lib/Keypad/src/Key.h b/Platformio/lib/Keypad/src/Key.h deleted file mode 100644 index 0977fa0..0000000 --- a/Platformio/lib/Keypad/src/Key.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -|| -|| @file Key.h -|| @version 1.0 -|| @author Mark Stanley -|| @contact mstanley@technologist.com -|| -|| @description -|| | Key class provides an abstract definition of a key or button -|| | and was initially designed to be used in conjunction with a -|| | state-machine. -|| # -|| -|| @license -|| | This library is free software; you can redistribute it and/or -|| | modify it under the terms of the GNU Lesser General Public -|| | License as published by the Free Software Foundation; version -|| | 2.1 of the License. -|| | -|| | This library is distributed in the hope that it will be useful, -|| | but WITHOUT ANY WARRANTY; without even the implied warranty of -|| | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -|| | Lesser General Public License for more details. -|| | -|| | You should have received a copy of the GNU Lesser General Public -|| | License along with this library; if not, write to the Free Software -|| | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -|| # -|| -*/ - -#ifndef Keypadlib_KEY_H_ -#define Keypadlib_KEY_H_ - -#include - -#define OPEN LOW -#define CLOSED HIGH - -typedef unsigned int uint; -typedef enum{ IDLE, PRESSED, HOLD, RELEASED } KeyState; - -const char NO_KEY = '\0'; - -class Key { -public: - // members - char kchar; - int kcode; - KeyState kstate; - boolean stateChanged; - - // methods - Key(); - Key(char userKeyChar); - void key_update(char userKeyChar, KeyState userState, boolean userStatus); - -private: - -}; - -#endif - -/* -|| @changelog -|| | 1.0 2012-06-04 - Mark Stanley : Initial Release -|| # -*/ diff --git a/Platformio/lib/Keypad/src/Keypad.cpp b/Platformio/lib/Keypad/src/Keypad.cpp deleted file mode 100644 index c4d8cfc..0000000 --- a/Platformio/lib/Keypad/src/Keypad.cpp +++ /dev/null @@ -1,306 +0,0 @@ -/* -|| -|| @file Keypad.cpp -|| @version 3.1 -|| @author Mark Stanley, Alexander Brevig -|| @contact mstanley@technologist.com, alexanderbrevig@gmail.com -|| -|| @description -|| | This library provides a simple interface for using matrix -|| | keypads. It supports multiple keypresses while maintaining -|| | backwards compatibility with the old single key library. -|| | It also supports user selectable pins and definable keymaps. -|| # -|| -|| @license -|| | This library is free software; you can redistribute it and/or -|| | modify it under the terms of the GNU Lesser General Public -|| | License as published by the Free Software Foundation; version -|| | 2.1 of the License. -|| | -|| | This library is distributed in the hope that it will be useful, -|| | but WITHOUT ANY WARRANTY; without even the implied warranty of -|| | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -|| | Lesser General Public License for more details. -|| | -|| | You should have received a copy of the GNU Lesser General Public -|| | License along with this library; if not, write to the Free Software -|| | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -|| # -|| -*/ -#include - -// <> Allows custom keymap, pin configuration, and keypad sizes. -Keypad::Keypad(char *userKeymap, byte *row, byte *col, byte numRows, byte numCols) { - rowPins = row; - columnPins = col; - sizeKpd.rows = numRows; - sizeKpd.columns = numCols; - - begin(userKeymap); - - setDebounceTime(10); - setHoldTime(500); - keypadEventListener = 0; - - startTime = 0; - single_key = false; -} - -// Let the user define a keymap - assume the same row/column count as defined in constructor -void Keypad::begin(char *userKeymap) { - keymap = userKeymap; -} - -// Returns a single key only. Retained for backwards compatibility. -char Keypad::getKey() { - single_key = true; - - if (getKeys() && key[0].stateChanged && (key[0].kstate==PRESSED)) - return key[0].kchar; - - single_key = false; - - return NO_KEY; -} - -// Populate the key list. -bool Keypad::getKeys() { - bool keyActivity = false; - - // Limit how often the keypad is scanned. This makes the loop() run 10 times as fast. - if ( (millis()-startTime)>debounceTime ) { - scanKeys(); - keyActivity = updateList(); - startTime = millis(); - } - - return keyActivity; -} - -// Private : Hardware scan -void Keypad::scanKeys() { - // Re-intialize the row pins. Allows sharing these pins with other hardware. - for (byte r=0; r -1) { - nextKeyState(idx, button); - } - // Key is NOT on the list so add it. - if ((idx == -1) && button) { - for (byte i=0; iholdTime) // Waiting for a key HOLD... - transitionTo (idx, HOLD); - else if (button==OPEN) // or for a key to be RELEASED. - transitionTo (idx, RELEASED); - break; - case HOLD: - if (button==OPEN) - transitionTo (idx, RELEASED); - break; - case RELEASED: - transitionTo (idx, IDLE); - break; - } -} - -// New in 2.1 -bool Keypad::isPressed(char keyChar) { - for (byte i=0; i THIS FILE -| -|- platformio.ini -|--src - |- main.c - -and a contents of `src/main.c`: -``` -#include -#include - -int main (void) -{ - ... -} - -``` - -PlatformIO Library Dependency Finder will find automatically dependent -libraries scanning project source files. - -More information about PlatformIO Library Dependency Finder -- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/Platformio/test/README b/Platformio/test/README deleted file mode 100644 index 9b1e87b..0000000 --- a/Platformio/test/README +++ /dev/null @@ -1,11 +0,0 @@ - -This directory is intended for PlatformIO Test Runner and project tests. - -Unit Testing is a software testing method by which individual units of -source code, sets of one or more MCU program modules together with associated -control data, usage procedures, and operating procedures, are tested to -determine whether they are fit for use. Unit testing finds problems early -in the development cycle. - -More information about PlatformIO Unit Testing: -- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html