BLE switch interface with GROVE joystic for micro:bit http://mahoro-ba.net/e2073.html

Dependencies:   microbit

Files at this revision

API Documentation at this revision

Comitter:
masakjm
Date:
Sun Feb 24 05:24:50 2019 +0000
Parent:
11:8e0b379efcb3
Child:
13:39ecc149d163
Commit message:
bug fix

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
microbit_switch_if_joy.h Show annotated file Show diff for this revision Revisions of this file
readme.txt Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Feb 22 21:17:13 2019 +0000
+++ b/main.cpp	Sun Feb 24 05:24:50 2019 +0000
@@ -19,7 +19,7 @@
 //---------------------------------
 
 #define VERSION     "JOY-190218"
-#define NO_DEBUG
+//#define NO_DEBUG
 
 #include "microbit_switch_if_joy.h"
 #include "KeyValueInt.h"
@@ -300,7 +300,7 @@
     if (code) {
         uint8_t key = code & 0xff;
         uint8_t modif = code >> 8;
-
+                
         if (key > KEYMAP_SIZE ) {
             DispChar  ='I';      // キーコード設定間違い
         } else {
@@ -508,6 +508,7 @@
     while (true) {
         ble.waitForEvent();        // BLEイベントを待つ
 
+        wait(0.05);
         joyStatus = readJoyStatus(joyStatusLast);  // Joystick の状態を読む
         joyAction(joyStatusLast, joyStatus);
         joyStatusLast = joyStatus;      
--- a/microbit_switch_if_joy.h	Fri Feb 22 21:17:13 2019 +0000
+++ b/microbit_switch_if_joy.h	Sun Feb 24 05:24:50 2019 +0000
@@ -1,7 +1,7 @@
 //=================================
 // microbit_switch_if_joy
 //=================================
-//    BLE switch interface with GROVE joystic for micro:bit 
+//    BLE switch interface with GROVE joystic for micro:bit
 //    The MIT License (MIT)   Copyright (c) 2019 Masatomo Kojima
 
 #include "mbed.h"
@@ -67,7 +67,7 @@
 const int keyCodeGroup1[NUM_GROUP1][NUM_G1MEMBER] = { // 中央 左 右 上 下
     {KEY_ENTER,   KEY_TAB,     KEY_SPACE,   0,           KEY_ENTER  },
     {KEY_HOME,    RIGHT_ARROW, LEFT_ARROW,  DOWN_ARROW,  UP_ARROW   },
-    {KEY_NUMPAD1, KEY_NUMPAD2, KEY_NUMPAD3, KEY_NUMPAD4, KEY_NUMPAD5},
+    {MODIFY_SHIFT+'1', MODIFY_SHIFT+'2', MODIFY_SHIFT+'3', MODIFY_SHIFT+'4', MODIFY_SHIFT+'5'},
     {KEY_ENTER,   MODIFY_OPTION+MODIFY_SHIFT+KEY_TAB, MODIFY_OPTION+KEY_TAB,
                   MODIFY_OPTION+DOWN_ARROW, MODIFY_OPTION+UP_ARROW},
 //    {KEY_ENTER,   MODIFY_SHIFT+KEY_TAB, KEY_TAB, KEY_SPACE, MODIFY_SHIFT+KEY_SPACE},
--- a/readme.txt	Fri Feb 22 21:17:13 2019 +0000
+++ b/readme.txt	Sun Feb 24 05:24:50 2019 +0000
@@ -30,5 +30,5 @@
 //
 
 Version
-JOY-190223  初版リリース(3SW-190215から派生)
+JOY-190224  初版リリース(3SW-190215から派生)
             
\ No newline at end of file