xwhatsit firmware: added column tester
authorPurdea Andrei <andrei@purdea.ro>
Mon, 8 Jun 2020 23:00:12 +0000 (02:00 +0300)
committerPurdea Andrei <andrei@purdea.ro>
Mon, 8 Jun 2020 23:00:23 +0000 (02:00 +0300)
keyboards/xwhatsit/matrix.c
keyboards/xwhatsit/matrix_manipulate.h
keyboards/xwhatsit/util_comm.c
keyboards/xwhatsit/util_comm.h

index 41565c3..962dd2c 100644 (file)
@@ -249,6 +249,20 @@ void shift_select_nothing(void)
     writePin(CAPSENSE_SHIFT_STCP, 0);
 }
 
+void shift_data(uint32_t data)
+{
+    int i;
+    for (i=SHIFT_BITS-1; i>=0; i--)
+    {
+        writePin(CAPSENSE_SHIFT_DIN, (data >> (SHIFT_BITS - 1)) & 1);
+        writePin(CAPSENSE_SHIFT_SHCP, 1);
+        writePin(CAPSENSE_SHIFT_SHCP, 0);
+        data <<= 1;
+    }
+    writePin(CAPSENSE_SHIFT_STCP, 1);
+    writePin(CAPSENSE_SHIFT_STCP, 0);
+}
+
 void shift_select_col_no_strobe(uint8_t col)
 {
     int i;
index f0c0cc7..8ae562a 100644 (file)
@@ -11,6 +11,7 @@ void matrix_scan_raw(matrix_row_t current_matrix[]);
 extern uint16_t cal_thresholds[CAPSENSE_CAL_BINS];
 extern matrix_row_t assigned_to_threshold[CAPSENSE_CAL_BINS][MATRIX_ROWS];
 uint16_t measure_middle_keymap_coords(uint8_t col, uint8_t row, uint8_t time, uint8_t reps);
+void shift_data(uint32_t data);
 
 #endif
 
index 3c5c1a3..6d196b0 100644 (file)
@@ -161,6 +161,15 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
                 response[9] = CAPSENSE_CAL_ENABLED;
                 break;
             }
+        case UTIL_COMM_SHIFT_DATA:
+            {
+                response[2] = UTIL_COMM_RESPONSE_OK;
+                uint32_t shdata = (((uint32_t)(data[3])) << 0) |
+                                (((uint32_t)(data[4])) << 8) |
+                                (((uint32_t)(data[5])) << 16) |
+                                (((uint32_t)(data[6])) << 24);
+                shift_data(shdata);
+            }
         default:
             break;
     }
index 90ce014..62cea2e 100644 (file)
@@ -3,7 +3,7 @@
 
 #define UTIL_COMM_VERSION_MAJOR 2
 #define UTIL_COMM_VERSION_MID 0
-#define UTIL_COMM_VERSION_MINOR 2
+#define UTIL_COMM_VERSION_MINOR 3
 
 
 #define UTIL_COMM_MAGIC { 0x55, 0xAA }
@@ -19,6 +19,7 @@ enum command {
     UTIL_COMM_ERASE_EEPROM,
     UTIL_COMM_GET_SIGNAL_VALUE,
     UTIL_COMM_GET_KEYBOARD_DETAILS,
+    UTIL_COMM_SHIFT_DATA,
 };
 
 enum response {