Git Product home page Git Product logo

Comments (7)

pelikhan avatar pelikhan commented on June 13, 2024 1

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.

from devicescript.

reggi avatar reggi commented on June 13, 2024 1

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

from devicescript.

pelikhan avatar pelikhan commented on June 13, 2024

Let's see:

  • you will need to add i2s support in a similar fashion to i2c to support the mic.
  • you should be able to port the Rust driver to devicescript using the gpio module and detect the keystrokes.

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.

from devicescript.

reggi avatar reggi commented on June 13, 2024

@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?

from devicescript.

reggi avatar reggi commented on June 13, 2024

@pelikhan I got this working so far for this device I got the following working:

  • Onboard LED
  • LCD 16bit colors
  • Keyboard

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 🙃

from devicescript.

pelikhan avatar pelikhan commented on June 13, 2024

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.

from devicescript.

pelikhan avatar pelikhan commented on June 13, 2024

Note that we'll be happy to take your drivers contributions back into @devicescript/drivers as well!

from devicescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.