-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port pygamer to v2 #455
Port pygamer to v2 #455
Conversation
4cca121
to
a4039bf
Compare
@bradleyharden Thanks for the cleanup. hrm.. it IS meaningfully different.. The previous idea of the sets were that it was naked pins just as if you restarted the board, but grouped for you by functionality and pinout but not configured or costing any more power or startup time than a fresh reset. Now some stuff can still be Frankly thought that was true of the old model. Every pin floating could also not be ideal as well.. but at least you knew all the pins were floating.. Im not sure, I guess we have to decide as a repo what we want the bsps to do. To me this basically removes the usefullness of the 'sets' model which I dont know how I feel about (truly, not sure if its good or bad) |
Let me know what you decide is best. I don't really have an opinion. I can return it to the old approach. It just means more pin aliases. Speaking of, in terms of the docs, it might make sense for me to create those aliases in a separate module. There can be a lot of them, and they can make it hard to find other items in the docs. |
One other thing to note. The |
I rebased this and tested stuff. Most stuff seems all working, but the screen is actually not working even with this ioset5. Im still not sure on pre configured pins. But maybe the question first needs to be are we keeping the sets model at all or not? It seems like its mainly me using it at this point, and Id rather be consistent than right. |
@jacobrosenthal, wasn't the undocumented IOSET for the SD card, not the display? I'm not sure what's wrong with the display. Do you have any other symptoms? Maybe you could double check the code and make sure I didn't make any transposition errors? |
fdceb21
to
8ee101b
Compare
@jacobrosenthal, I returned the |
1a9bcb3
to
92ecaac
Compare
I forgot, I wanted to implement the IOSET solution in this PR. Let me do that before we merge. |
92ecaac
to
2a3f054
Compare
Ok, I think this should be good to go, pending approval by @jacobrosenthal. |
2a3f054
to
68c443b
Compare
Whoops, hit the wrong button |
e43c3f8
to
0c39af6
Compare
Im not sure I reported here, but yes this is still broken. I actually tried the sd card example again as well and thats broken too |
Make several improvements to the `sercom::v2::spi` module: - Introduce a `Registers` type that acts as a task-focused API for the registers, as opposed to the register-focused API of the PAC. This abstraction also serves to remove interior mutability of the PAC struct and lets us implement `Sync` for `Registers` - Add a `Capability` trait and three corresponding types: `Rx`, `Tx` and `Duplex`. Add a `Capability` type parameter to the `Spi` struct and use it to differentiate the various embedded HAL trait implementations. This is a better solution than the previous approach, which was a set of marker traits implemented on `Pads` types. - Combine the `thumbv6m` and `thumbv7em` modules to reuse more code. The major differences between the two chips come in the `Pads` type, and the `Length` and `CharSize` types. Introduce a `Size` trait that essentially acts a trait alias for either `Length` or `CharSize`. Split up the modules and use conditional imports to handle everything correctly for the three different chips. Because the `spi` module is no longer split between the two chip-specific modules, also consolidate the `impl_pad` modules as well. Finally, improve the documentation for the `spi` module itself, as well as for the embedded HAL trait implementations.
Port the pygamer BSP to the `gpio::v2` and `sercom::v2::spi` APIs. While implementing this, I discovered that the pygamer uses an undocumented combination of pins for `Sercom1`. It uses PA17, PB22 & PB23. The datasheet indicates that PA17 is in `IoSet1`, while the other two pins are in `IoSet3`. It shouldn't be possible to use these together, but it appears there is an undocumented `IoSet`. Add this as `UndocIoSet1` for `Sercom1`. Also fix a warning from a trinket_m0 example.
0c39af6
to
1772a96
Compare
When last we spoke, i was seeing strange reboots on my pygamer, it turns out thats only one device... (the one that has my swd header soldered...) so just not using that one for now and ignoring that problem. The ferris_img example draw a little garbage on the display then freezes. I cant really scope the screen well because pygamer doesnt break out the tft spi pins. I bought a thing-plus bsp because it has access to the .1" pins so I could logic analyze it and this very similar (not the exact same) tft screen as pygamer Needed a patch to hf2 to add the vid/pid and ported the bsp and screen example and it works?! technically that chip is the ATSAMD51J20A instead of the ATSAMD51J19A |
Another note, I stripped the embedded graphics from the sd_card example, and the sdcard spi seems to work fine. So it really is the displays SPI thats giving trouble here I believe (which doesnt use the undoc ioset or anything) |
So does this mean that |
Note that I refactored this to be based on #467, which merged the |
It seems to indicate its bug free except when interacting with at least the tft screen on the pygamer |
Grabbed a sensepeek so I could probe the FPC on the pygamer. ferris_img here currently just stops drawing writing some noise to like the first 1/8 inch of the screen wipe after leaving the bootloader screen. saleae captures look sane so its not obviously an spi issue (i can see the init sequence https://github.com/sajattack/st7735-lcd-rs/blob/master/src/lib.rs#L88-L90), just have to spot the difference in timing or whatever. |
Superseded by #750 |
This relies on #467. Please merge it first.
Port the pygamer BSP to the
gpio::v2
andsercom::v2::spi
APIs. Whileimplementing this, I discovered that the pygamer uses an undocumented
combination of pins for
Sercom1
. It uses PA17, PB22 & PB23. Thedatasheet indicates that PA17 is in
IoSet1
, while the other two pins arein
IoSet3
. It shouldn't be possible to use these together, but itappears there is an undocumented
IoSet
. Add this asUndocIoSet1
forSercom1
.Also fix a warning from a trinket_m0 example.
@jacobrosenthal, could you please look this over? In particular, I'd like to draw attention to the various structs within
Sets
. Since thebsp_pins!
macro can provide aliases for pins in a corresponding pin mode, I decided to use those aliases to define the various structs. However, that introduces a change in behavior to the construction of theSets
type. Previously,Sets
only distributed pins to the correct structs. But now, creating theSets
struct also changes the pin mode for many pins. Is that ok?In general, the structure of this BSP might need some thought in light of the
v2
changes. For example, theJoystick
andJoystickReader
structs are now identical, because they both use the pin aliases frombsp_pins!
. TheBattery
andBatteryReader
structs are also the same.Finally, I'd also like to note that I changed the structure of the modules a bit. All of the examples now do this:
I modified the crate to no longer re-export the HAL. I also changing it re-export
*
from both thebuttons
andpins
modules. I think this is in line with the proposed changes in #357.