Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: microbit_switch_if.h
- Revision:
- 3:b6e9850d3e76
- Parent:
- 2:7e88b89dcca0
diff -r 7e88b89dcca0 -r b6e9850d3e76 microbit_switch_if.h
--- a/microbit_switch_if.h Mon Sep 17 06:57:10 2018 +0000
+++ b/microbit_switch_if.h Sat Sep 22 00:31:39 2018 +0000
@@ -15,11 +15,11 @@
//----------------------
// Keybord
//----------------------
-const char KEY_BS = 8; /* Keyboard Backspace */
-const char KEY_TAB = 9; /* Keyboard Tab */
-const char KEY_ENTER = 10; /* Keyboard Return (Enter) */
-//const char KEY_ESC = 27; /* Keyboard Escape */
-const char KEY_SPACE = 32; /* Keyboard Space */
+const int KEY_BS = 8; /* Keyboard Backspace */
+const int KEY_TAB = 9; /* Keyboard Tab */
+const int KEY_ENTER = 10; /* Keyboard Return (Enter) */
+//const int KEY_ESC = 27; /* Keyboard Escape */
+const int KEY_SPACE = 32; /* Keyboard Space */
//----------------------
// Setting
@@ -27,21 +27,21 @@
#define NUM_GROUP1 6
#define NUM_GROUP2 5
-#define MODIF_CTRL 0x100
-#define MODIF_SHIFT 0x200
-#define MODIF_OPTION 0x400 /* alt or option */
-#define MODIF_COMMAND 0x800 /* command or Windows */
+#define MODIFY_CTRL 0x100
+#define MODIFY_SHIFT 0x200
+#define MODIFY_OPTION 0x400 /* option or alt */
+#define MODIFY_COMMAND 0x800 /* command or Windows */
const int keyCodeGroup0[3] = { // Button A, Button B, Button A&B
'A',
'B',
- MODIF_COMMAND + 'h' // アプリ終了
+ MODIFY_COMMAND + 'h' // アプリ終了
};
const int keyCodeGroup1[NUM_GROUP1][2] = { // Switch 1 2
{KEY_SPACE, KEY_ENTER},
{RIGHT_ARROW, LEFT_ARROW},
{DOWN_ARROW, UP_ARROW},
- {MODIF_OPTION + DOWN_ARROW, MODIF_OPTION + UP_ARROW},
+ {MODIFY_OPTION + DOWN_ARROW, MODIFY_OPTION + UP_ARROW},
{'1', '3'},
{'h', 'j'}
};
@@ -49,11 +49,11 @@
KEY_TAB,
RIGHT_ARROW,
LEFT_ARROW,
- MODIF_COMMAND + 'r', // 再読み込み
- MODIF_OPTION + DOWN_ARROW
+ MODIFY_COMMAND + 'r', // 再読み込み
+ MODIFY_OPTION + DOWN_ARROW
};
-//in "BLE_API\Keyboad_types.h"
+//in "BLE_HID\Keyboad_types.h"
//enum FUNCTION_KEY {
// KEY_F1 = 128, /* F1 key */
// KEY_F2, /* F2 key */
@@ -92,10 +92,11 @@
//----------------------
// State
//----------------------
-#define STATE_NORMAL 0 // 通常起動時
-#define STATE_SETTING 1 // パラメータ設定時
-#define STATE_OPERATING 2 // 操作時
-
+enum STATE {
+ STATE_DESABLE_INPUT, // 入力無効時
+ STATE_SETTING, // パラメータ設定時
+ STATE_OPERATING, // 操作時
+};
//----------------------
// Disable debug messages by setting NO_DEBUG
//----------------------
@@ -129,7 +130,7 @@
/**
* Initialize security manager: set callback functions and required security level
*/
-void initializeSecurity(BLE &ble);
+void initializeSecurity(BLE &_ble);
/**
* - Initialize auxiliary services required by the HID-over-GATT Profile.
@@ -138,5 +139,14 @@
* Demos only have to set a custom device name and appearance, and their HID
* service.
*/
-void initializeHOGP(BLE &ble);
+void initializeHOGP(BLE &_ble);
+
+enum BLE_MESSAGE {
+ BLE_NO_MESSAGE, // メッセージ無し
+ BLE_CONNECTED, // BLE接続完了
+ BLE_PAIRING_SUCCESS, // ペアリング成功
+ BLE_PAIRING_FAILED, // ペアリング失敗
+};
+
+const char bleDispChar[]={0, 'C', 'P', 'F'};
\ No newline at end of file