Эх сурвалжийг харах

Added caps lock talk to keyboard

Per Mårtensson 3 жил өмнө
parent
commit
948e28b00b

+ 1 - 0
sw/key800/include/abc800_gpio.h

@@ -29,6 +29,7 @@ namespace abc800 {
         public:
             void init();
             uint8_t sendkey(uint8_t key);
+            uint8_t sendfunction(uint8_t key);
             uint8_t abc800_getkey();
             uint8_t abc800_getupdown();
 

+ 8 - 0
sw/key800/src/abc800_gpio.cpp

@@ -56,6 +56,14 @@ namespace abc800 {
         }
         return 0;
     }
+    uint8_t gpio::sendfunction(uint8_t key){
+        if (key!=0xff){
+            ESP_LOGD(TAG,"OUT CODE %02x",key);
+
+            Serial1.write(key);
+        }
+        return 0;
+    }
     uint8_t gpio::abc800_getupdown(){
         return (digitalRead(K800_KD));
     }

+ 10 - 1
sw/key800/src/abc800_hidboot.cpp

@@ -16,10 +16,11 @@ e-mail   :  support@circuitsathome.com
 */
 #include "Arduino.h"
 #include "abc800_hidboot.h"
+#include <SoftwareSerial.h>
 #include "keyboardpipe.h"
 #include "esp_log.h"
 static const char TAG[] = __FILE__;
-
+extern SoftwareSerial abc800_serial_keyboard;
 
 /**
  * \brief Parse HID keyboard report.
@@ -84,6 +85,14 @@ uint8_t KeyboardReportParser::HandleLockingKeys( uint8_t key,USBHostKeyboard *po
 			break;
 		case KEY_CAPS_LOCK:
 			kbdLockingKeys.kbdLeds.bmCapsLock = ~kbdLockingKeys.kbdLeds.bmCapsLock;
+			if (kbdLockingKeys.kbdLeds.bmCapsLock )
+			{
+				abc800_serial_keyboard.write(136);
+			}
+			else
+			{
+				abc800_serial_keyboard.write(8);
+			}
 			break;
 		case KEY_SCROLL_LOCK:
 			kbdLockingKeys.kbdLeds.bmScrollLock = ~kbdLockingKeys.kbdLeds.bmScrollLock;

+ 2 - 2
sw/key800/src/abc800_keyboard.cpp

@@ -41,7 +41,7 @@ namespace abc800
                 }else{
                     abc800_gpio.sendkey(abc800_keyboard.getABC800Keycode(key)); 
                 }
-                vTaskDelay((key.ascii == 0x13 ? 100 : 4) / portTICK_PERIOD_MS);
+                vTaskDelay((key.ascii == 0x13 ? 100 : 0) / portTICK_PERIOD_MS);
             }
         }
     }
@@ -60,7 +60,7 @@ namespace abc800
                 {
                     ESP_LOGI(TAG,"RESET");
                     digitalWrite(A800_RST,LOW);
-                    delay(200);
+                    delay(100);
                     digitalWrite(A800_RST,HIGH);
 
                 }