Support library for the ESP8266 Wireless Terminal. Can also be used for communicating with any VT100-compatible terminal.
Diff: espterm.cpp
- Revision:
- 5:7379bd37f3e2
- Parent:
- 4:294e8f53ebcd
- Child:
- 6:7e7550084e5f
--- a/espterm.cpp Sun Mar 19 17:19:16 2017 +0000 +++ b/espterm.cpp Sun Mar 19 18:16:17 2017 +0000 @@ -9,11 +9,11 @@ cs = -1; device_ok = false; - on_mouse_click = NULL; + on_mouse = NULL; on_button = NULL; + on_key = NULL; on_esp_reset = NULL; on_char_rx = NULL; - on_key_press = NULL; on_osc_rx = NULL; ser = s; @@ -199,16 +199,16 @@ void ESPTerm::apars_handle_csi(char lead, const int* nums, char keychar) { // Keyboard events - if (on_key_press) { - if (keychar == 'A') on_key_press(KEY_UP); - else if (keychar == 'B') on_key_press(KEY_DOWN); - else if (keychar == 'C') on_key_press(KEY_RIGHT); - else if (keychar == 'D') on_key_press(KEY_LEFT); + if (on_key) { + if (keychar == 'A') on_key(KEY_UP); + else if (keychar == 'B') on_key(KEY_DOWN); + else if (keychar == 'C') on_key(KEY_RIGHT); + else if (keychar == 'D') on_key(KEY_LEFT); } // Screen tapped / clicked - if (on_mouse_click && keychar == 'M') { - on_mouse_click(nums[0], nums[1]); + if (on_mouse && keychar == 'M') { + on_mouse(nums[0], nums[1], (MouseEvent) nums[2]); } // "Device OK" response to "Device Status Query"