Giter Club home page Giter Club logo

Comments (11)

zklapow avatar zklapow commented on June 2, 2024 1

FWIW I spent some time getting the USB stuff to work with RTFM (which could help with eliminating the globals) but found it hard to get both the inner references (i.e. device needs a ref to the serial object) and then return those same objects from init (because the objects constructed in init did not have static lifetimes). I am sure there is some magic here that would allow RTFM to work that I am just missing though I am not sure whether RTFM counts as solving the globals issue.

from atsamd.

sajattack avatar sajattack commented on June 2, 2024 1

This is one of those thing's that's left over from when @wez was running the project and frankly I'm scared to touch it lol.

from atsamd.

twitchyliquid64 avatar twitchyliquid64 commented on June 2, 2024

I'm interested in working on this, but as a newbie to rust its best if I'm told what to do. How can I help?

from atsamd.

wez avatar wez commented on June 2, 2024

I've been a bit too busy to pick this up in a while. Things have matured a bit more in the upstream usb-device crate so what I think needs to be done in this one now is:

With that done, we'll have a relatively low level support for USB on this class of devices and can consider actually enabling that code when publishing to crates.io, but there is still more to be done to make practical USB device implementations:

  • USB HID support (near and dear to my heart for keyboards)
  • USB storage device support to expose eg: on-board SPI based flash storage, or perhaps UF2 bootloader

I see these as requiring some work in the upstream usb device crate with appropriate atsamd-specific support happening in this crate.

There's also a distinction between low-level support (eg: it basically works) and ergonomic high-level support (eg: there's a nice way to respond to USB HID events and embed support in a consuming application crate).

Beyond the bus implementation in this crate, most of the work to be done is generic USB stuff that should happen in the usb-device project.

from atsamd.

twitchyliquid64 avatar twitchyliquid64 commented on June 2, 2024

I'll take a look at updating the samd21 crate, but I don't have hardware so it will need someone else to test.

I'll also try and get it working for samd51, which I do have hardware for.

from atsamd.

twitchyliquid64 avatar twitchyliquid64 commented on June 2, 2024

Looking at the samd21 code, it looks very similar to what is required for samd51. I expect there's a good amount we can put in the common crate.

from atsamd.

twitchyliquid64 avatar twitchyliquid64 commented on June 2, 2024

This is slowly coming along here. Some notes/changes for comment:

  • Instead of only exposing an implementation of the usb_device::bus::UsbBus device, I'm going to expose a lower-level (no state, no memory management) API UsbController, which the UsbBus implementation will be built off.
  • I'm refactoring the ep! macro to collect all the registers for a given endpoint into a single structure, EndpointRegs, which will provide a nicer internal API over mutating the state of the endpoint registers.
  • Aside from HAL layers, move away from using the term Bank to describe one endpoint in an endpoint pair, as I couldnt find any reference to it outside of datasheets.
  • I'm using a single lifetime across all objects from UsbController downwards, and instantiating them all at the same time. This allows us to avoid Ref* and Mutex boxing.

from atsamd.

twitchyliquid64 avatar twitchyliquid64 commented on June 2, 2024

Heya @wez, how did you get the dbgprint! macro to dance your tune?

I made the mistake of writing the samd51 driver all at once, so it attaches but doesnt enumerate. I'm thinking it would be nice to have a printf out a SERCOM UART, but if thats something youve already done I'll gladly copypasta :)

from atsamd.

BenBergman avatar BenBergman commented on June 2, 2024

@twitchyliquid64 Did you make any progress on the samd21 port? I've got some devices I'd be willing to test with.

from atsamd.

twitchyliquid64 avatar twitchyliquid64 commented on June 2, 2024

@BenBergman no - haven't ported samd21 USB support over to the 0.3 version of usb-device. The original code (which ran from an earlier version) should still be usable.

In terms of working on the USB peripheral, I've been side-tracked by other projects as of late, but hope to get back to this + fixing the other bug soon.

from atsamd.

BenBergman avatar BenBergman commented on June 2, 2024

I tried compiling the Metro-M0 usb-serial example but it is failing to compile for me, so I'm guessing some other change broke something. I poked at it a bit but low level USB is a bit beyond me and the limited time I have to focus on it.

Let me know when you get back to it and I can test on a few Adafruit M0 boards I have lying around.

from atsamd.

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.