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 #588

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

UsartSpi Support #588

wants to merge 29 commits into from

Conversation

armandas
Copy link
Contributor

@armandas armandas commented Oct 5, 2024

This is the continuation of the @CoolSlimbo's good work in #562. Closes #561.

I've made the following changes:

  • Resolved the CS issue by adding a new constructor to Spi: new_from_usart
  • Updated usart_spi-feedback example
  • Fixed clippy warnings in the macro as well as some typos in the comments
  • Address some of the remaining comments

I have run the usart_spi-feedback example on an Arduino Mega 2560 and confirmed that USART 1, 2 and 3 work.

CoolSlimbo and others added 26 commits June 23, 2024 14:51
Needs to be tested. Will test via Arudino UNO when I move them ig
… doesn't have the right pins. Will fix that soon. If someone else can test would be great.
(Tested)[Rahix#562 (comment)].

Introduces points for other examples commented in.
Separate constructor is used to remove the need for passing a CS pin.
@armandas
Copy link
Contributor Author

armandas commented Oct 5, 2024

Hmm, atmega1284p build fails. Seems like avr-device issue?

avr-device-0.5.4/src/devices/atmega2560/usart0/ubrr0.rs

    #[doc = "Writes raw bits to the register."]
    #[inline(always)]
    pub fn bits(&mut self, bits: u16) -> &mut Self {
        unsafe { self.0.bits(bits) };
        self
    }

avr-device-0.5.4/src/devices/atmega1284p/usart0/ubrr0.rs:

    #[doc = "Writes raw bits to the register."]
    #[inline(always)]
    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
        self.0.bits(bits);
        self
    }

@armandas
Copy link
Contributor Author

Turns out it was not so hard to fix the above issue.

@armandas
Copy link
Contributor Author

@Rahix I think this PR should be good to review. I tried to address the comments in #562, but let me know if there are any changes needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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