Closed reggi closed 4 months ago
Let's see:
can act as an external keyboard over USB (is this what a HID Keyboard is)
Yep.
Is it possible to do both via devicescript?
We do have hid keyboard driver in jacdac (https://github.com/microsoft/jacdac-c/blob/main/services/hidkeyboard.c) but i don't think it is fully wired up for devicescript. @mmoskal
Anyhow, it's gonna require work and somewhat getting deep in building devicescript itself.
@pelikhan thanks for this, I'm digging into the source. I'd down to contribute to the project.
All I want right now is to be able to press any key on the device and console.log
. This is not HID, just normal internal keyboard.
I can't find this code: https://microsoft.github.io/devicescript/api/clients/keyboardclient
When I search the project for KeyboardClient
nothing shows up 🙃
Where do I start?
All I want right now is to be able to press any key on the device and console.log. This is not HID, just normal internal keyboard.
For that you would need to implement the pin scanning code, just like the rust sample you mentioned.
@pelikhan I got this working so far for this device I got the following working:
I'd like to put all this in a module that people can reuse. I think I'm interested in making something more custom.
However modules like @devicescript/drivers
aren't in the npm (or github) registry.
How can I make my code into a package?
I tried using peerDependencies
and workspaces but no luck.
"peerDependencies": {
"@devicescript/core": "2.16.2",
"@devicescript/spi": "2.16.2",
"@devicescript/drivers": "2.16.2",
"@devicescript/graphics": "2.16.2",
"@devicescript/server": "2.16.2"
}
The only last idea i have is to do something more like AMD and pass every device script dependency in as a function argument 🙃
Here is a sample of npm packages --> https://github.com/microsoft/devicescript/blob/main/packages/cowsay/package.json
You don't have to declare any of those @devicescript depedencies as they are "created" by the devicescript init
command.
Note that we'll be happy to take your drivers contributions back into @devicescript/drivers as well!
Thanks done and done
https://www.npmjs.com/package/cardputer https://github.com/reggi/cardputer
For future travelers if you want to use the cardputer keyboard with device script here's my code:
https://github.com/reggi/cardputer/blob/main/core/keyboard.ts#L83
https://docs.m5stack.com/en/core/Cardputer
74HC138 CMOS?
Seems to be a rust implementation here: https://github.com/syurazo/cardputer/blob/master/src/keyboard.rs
Pins as seen here: https://github.com/m5stack/M5Cardputer/blob/889cbd7b9d8c395205e22e924a383bd07089b14c/src/utility/Keyboard.h#L28C1-L29C62
I've tried everything in the docs. I'm new to keyboards, serial, and i2c I have no clue to get button presses to register a console log.
Is this something currently supportable by the project? I'm just worried that somewhere down the line devicescript will just not work for some piece of hardware on the cardputer. Can someone working on the team confirm that keyboard, speakers, bluetooth, sd card, and mic can all work? I got the LED on the board to work and the LCD so far.
I'm a bit confused I know this device can be used to type within the device, and be used when plugged in or via bluetooth can act as an external keyboard over USB (is this what a HID Keyboard is). Is it possible to do both via devicescript?