Skip to content
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

UsartSpi Support #562

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

UsartSpi Support #562

wants to merge 13 commits into from

Conversation

CoolSlimbo
Copy link

PR regarding issue #561.

This is just so I have the PR made for now, work still needs to be made on it.

So far, USART0 is implemented for most of the atmega mc's. However, they are not tested, as I am lacking something to test it with.

Needs to be tested. Will test via Arudino UNO when I move them ig
@@ -31,6 +31,66 @@ avr_hal_generic::impl_spi! {
cs: port::PB0,
}

#[cfg(any(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Devices where UART port can be a SPI port

@stappersg
Copy link
Contributor

Idea, maybe a wild idea: The new code in one #[cfg(any( ))] block?

Anyway: Success with testing.

@CoolSlimbo
Copy link
Author

Wait. It actually worked on hardware? Part of me is surprised lol

I'll probably move it into its own module, but can't use one config, because they align to different ports between devices.

@CoolSlimbo CoolSlimbo changed the title UsartSpi Support **UNTESTED** UsartSpi Support Jun 23, 2024
@CoolSlimbo
Copy link
Author

Currently added in (I think) at minimum all the USART0 implimentations. But there's still a large portion to go, and finding the XCK pin requires getting the datasheet for each.

@Rahix Rahix linked an issue Jun 23, 2024 that may be closed by this pull request
@Rahix Rahix added hal-api API design for the different components of avr-hal hal-generic Related to MCU generic parts of avr-hal labels Jun 23, 2024
@CoolSlimbo
Copy link
Author

Implements USART, correctly, on all devices. Should past CI successfully.

An example could be in order, however, I am lacking any SPI slaves, so I cannot test this myself.

@Rahix
Copy link
Owner

Rahix commented Jun 27, 2024

An example could be in order, however, I am lacking any SPI slaves, so I cannot test this myself.

SPI can be tested very easily by looping back MOSI to MISO (so TX to RX in this case). We also have this in our real SPI example, maybe it makes sense to add an example that does the same for UsartSpi?

… doesn't have the right pins. Will fix that soon. If someone else can test would be great.
@Rahix
Copy link
Owner

Rahix commented Jul 7, 2024

Hey, there seem to be some compiler errors, as seen in CI. Can you take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hal-api API design for the different components of avr-hal hal-generic Related to MCU generic parts of avr-hal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Utilising the atmega2560's "USART in SPI Mode"
3 participants