-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keyboard can connect, and keyboard data gets to the parser, but the parser does nothing with it.
- Loading branch information
1 parent
dfb9ebc
commit da9469f
Showing
14 changed files
with
211 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/components/bluepad32/include/uni_hid_parser_keyboard.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/**************************************************************************** | ||
http://retro.moe/unijoysticle2 | ||
Copyright 2023 Ricardo Quesada | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
****************************************************************************/ | ||
|
||
#ifndef UNI_HID_PARSER_KEYBOARD_H | ||
#define UNI_HID_PARSER_KEYBOARD_H | ||
|
||
#include <stdint.h> | ||
|
||
#include "uni_hid_parser.h" | ||
|
||
// Mouse devices | ||
void uni_hid_parser_keyboard_setup(struct uni_hid_device_s* d); | ||
void uni_hid_parser_keyboard_parse_input_report(struct uni_hid_device_s* d, const uint8_t* report, uint16_t len); | ||
void uni_hid_parser_keyboard_init_report(struct uni_hid_device_s* d); | ||
void uni_hid_parser_keyboard_parse_usage(struct uni_hid_device_s* d, | ||
hid_globals_t* globals, | ||
uint16_t usage_page, | ||
uint16_t usage, | ||
int32_t value); | ||
void uni_hid_parser_keyboard_device_dump(struct uni_hid_device_s* d); | ||
|
||
#endif // UNI_HID_PARSER_KEYBOARD_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/**************************************************************************** | ||
http://retro.moe/unijoysticle2 | ||
Copyright 2023 Ricardo Quesada | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
****************************************************************************/ | ||
|
||
#ifndef UNI_KEYBOARD_H | ||
#define UNI_KEYBOARD_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include <stdint.h> | ||
|
||
#include "uni_common.h" | ||
|
||
typedef struct { | ||
uint8_t modifiers; | ||
uint8_t pressed_keys[16]; | ||
} uni_keyboard_t; | ||
|
||
void uni_keyboard_dump(const uni_keyboard_t* kb); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // UNI_KEYBOARD_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/**************************************************************************** | ||
http://retro.moe/unijoysticle2 | ||
Copyright 2023 Ricardo Quesada | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
****************************************************************************/ | ||
|
||
#include "uni_hid_parser_keyboard.h" | ||
|
||
#include <math.h> | ||
#include <time.h> | ||
|
||
#include "hid_usage.h" | ||
#include "uni_common.h" | ||
#include "uni_controller.h" | ||
#include "uni_hid_device.h" | ||
#include "uni_hid_parser.h" | ||
#include "uni_log.h" | ||
|
||
void uni_hid_parser_keyboard_setup(uni_hid_device_t* d) { | ||
uni_hid_device_set_ready_complete(d); | ||
} | ||
|
||
void uni_hid_parser_keyboard_parse_input_report(struct uni_hid_device_s* d, const uint8_t* report, uint16_t len) { | ||
ARG_UNUSED(d); | ||
printf_hexdump(report, len); | ||
} | ||
|
||
void uni_hid_parser_keyboard_init_report(uni_hid_device_t* d) { | ||
// Reset old state. Each report contains a full-state. | ||
uni_controller_t* ctl = &d->controller; | ||
memset(ctl, 0, sizeof(*ctl)); | ||
ctl->klass = UNI_CONTROLLER_CLASS_KEYBOARD; | ||
} | ||
|
||
void uni_hid_parser_keyboard_parse_usage(uni_hid_device_t* d, | ||
hid_globals_t* globals, | ||
uint16_t usage_page, | ||
uint16_t usage, | ||
int32_t value) { | ||
ARG_UNUSED(globals); | ||
ARG_UNUSED(d); | ||
|
||
switch (usage_page) { | ||
case HID_USAGE_PAGE_KEYBOARD_KEYPAD: | ||
logi("page:%d, usage:%d, value:%d\n", usage_page, usage, value); | ||
break; | ||
|
||
case HID_USAGE_PAGE_CONSUMER: | ||
logi("page:%d, usage:%d, value:%d\n", usage_page, usage, value); | ||
break; | ||
|
||
// unknown usage page | ||
default: | ||
logi("Keyboard: Unsupported page: 0x%04x, usage: 0x%04x, value=0x%x\n", usage_page, usage, value); | ||
break; | ||
} | ||
} | ||
|
||
void uni_hid_parser_keyboard_device_dump(struct uni_hid_device_s* d) { | ||
ARG_UNUSED(d); | ||
|
||
logi("\tuni_hid_parser_keyboard_device_dump: implement me: \n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/**************************************************************************** | ||
http://retro.moe/unijoysticle2 | ||
Copyright 2022 Ricardo Quesada | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
****************************************************************************/ | ||
|
||
#include "uni_keyboard.h" | ||
#include "uni_log.h" | ||
|
||
void uni_keyboard_dump(const uni_keyboard_t* kb) { | ||
ARG_UNUSED(kb); | ||
// Don't add "\n" | ||
logi("uni_keyboard_dump: implement me"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters