キーボードの長押しに対応。
Fork of USBDevice by
Diff: USBHID/USBKeyboard.h
- Revision:
- 73:803bc631881e
- Parent:
- 72:8c3160323201
--- a/USBHID/USBKeyboard.h Sat Aug 18 06:37:49 2018 +0000 +++ b/USBHID/USBKeyboard.h Sat Aug 25 07:54:43 2018 +0000 @@ -109,7 +109,7 @@ }; /** - * To send a character defined by a modifier(CTRL, SHIFT, ALT) and the key + * 修飾子(CTRL, SHIFT, ALT)とキーで定義された文字を送信します。 * * @code * //To send CTRL + s (save) @@ -117,61 +117,71 @@ * @endcode * * @param modifier bit 0: KEY_CTRL, bit 1: KEY_SHIFT, bit 2: KEY_ALT (default: 0) - * @param key character to send + * @param key 送信するキャラクタ * @returns true if there is no error, false otherwise */ + /// + /// キーコード + /// bool keyCode(uint8_t key, uint8_t modifier = 0); + /// キーダウン /// + bool keyDown(uint8_t key); + + /// キーアップ /// + bool keyUp(uint8_t); + /** - * Send a character + * キャラクタを送信します。 * - * @param c character to be sent - * @returns true if there is no error, false otherwise + * @param c 送信するキャラクタ + * @returns エラーがない場合はtrueを返し、そうでない場合はfalseを返します。 */ virtual int _putc(int c); /** - * Control media keys + * メディアキーを制御する * - * @param key media key pressed (KEY_NEXT_TRACK, KEY_PREVIOUS_TRACK, KEY_STOP, KEY_PLAY_PAUSE, KEY_MUTE, KEY_VOLUME_UP, KEY_VOLUME_DOWN) + * @param key 押されたメディアキー (KEY_NEXT_TRACK, KEY_PREVIOUS_TRACK, KEY_STOP, KEY_PLAY_PAUSE, KEY_MUTE, KEY_VOLUME_UP, KEY_VOLUME_DOWN) * @returns true if there is no error, false otherwise */ bool mediaControl(MEDIA_KEY key); /* - * To define the report descriptor. Warning: this method has to store the length of the report descriptor in reportLength. + * レポート記述子を定義します。警告:このメソッドは、レポート記述子の長さをreportLengthに格納する必要があります。 * - * @returns pointer to the report descriptor + * @returns レポート記述子へのポインタ */ virtual uint8_t * reportDesc(); /* - * Called when a data is received on the OUT endpoint. Useful to switch on LED of LOCK keys + * OUTエンドポイントでデータが受信されたときに呼び出されます。LOCKキーのLEDをスイッチするのに便利です。 * * @returns if handle by subclass, return true */ virtual bool EP1_OUT_callback(); /** - * Read status of lock keys. Useful to switch-on/off leds according to key pressed. Only the first three bits of the result is important: - * - First bit: NUM_LOCK - * - Second bit: CAPS_LOCK - * - Third bit: SCROLL_LOCK + * ロックキーの状態を読み取ります。押されたキーに応じてLEDをスイッチオン/オフするのに便利です。 + * 結果の最初の3ビットのみが重要です。 + * - 最初のビット: NUM_LOCK + * - 二番目のビット: CAPS_LOCK + * - 三番目のビット: SCROLL_LOCK * - * @returns status of lock keys + * @returns ロックキーのステータス */ uint8_t lockStatus(); protected: /* - * Get configuration descriptor + * 構成記述子を取得する。 * - * @returns pointer to the configuration descriptor + * @returns 構成記述子へのポインタ */ virtual uint8_t * configurationDesc(); private: - //dummy otherwise it doesn,t compile (we must define all methods of an abstract class) + // それ以外の場合は、それはコンパイルされません(抽象クラスのすべてのメソッドを定義する必要があります)。 virtual int _getc() { return -1; };