Comments (6)
whilst also preventing usage of the USART for USART purposes.
This part is actually very simple. The UsartSpi
driver constructor consumes the USART
peripheral, just like the current UART driver consumes it. Due to Rust's ownership rules, this means only one of the two can ever exist:
let dp = atmega_hal::Peripherals::take().unwrap();
let pins = atmega_hal::pins!(dp);
let mut serial = Usart::new(
dp.USART0, // <- USART0 is moved into `serial` here
pins.pe0,
pins.pe1.into_output(),
Baudrate::<crate::CoreClock>::new(57600),
);
let mut spi = UsartSpi::new(dp.USART0, ...); // <- compiler error because USART0 was moved previously and is no longer available
from avr-hal.
I'd create a completely new module for USART as SPI. usart_spi
I guess.
from avr-hal.
Yes, this isn't supported yet.
If anyone is interested in working on a "USART as SPI" driver and needs guidance on how to do this, feel free to ping me!
from avr-hal.
I'll gladly give this a shot in implementation, if you could aid a hand in the direction it needs to go in!
Currently, my confusion is just on how one would implement it, whilst also preventing usage of the USART for USART purposes.
from avr-hal.
if you could aid a hand in the direction it needs to go in!
Generally, you'll need to add a usart_spi
module in avr-hal-generic
, similar in structure to the existing spi
or usart
modules. This defines the generic UsartSpi
driver and a macro for the MCU-specific HALs. This macro is then instanciated in atmega-hal
to implement USART as SPI for the available USART peripherals.
from avr-hal.
Roger on that. I do see that now, I was over-engineering that way to much...
I'll get to work on implementing the driver, however, would this preferred to be in the USART
or SPI
module?
from avr-hal.
Related Issues (20)
- Can't write to serial HOT 7
- Linker error when using a floating point operation HOT 3
- Panic while trying to write to serial using `ufmt::uwriteln` HOT 4
- Add configurable board options to ravedude HOT 3
- Get pin number HOT 6
- Program freezes if compiled in debug mode.
- ravedude should check rust target against selected MCU HOT 3
- Document clock type design in more detail HOT 1
- cargo build - error[E0658] - proc_macro::Literal::byte_character(byte) HOT 9
- can't find crate for `core` HOT 12
- cargo build - error[E0658] - proc_macro::Literal::byte_character(byte) HOT 4
- Very weird error when compiling a very basic program: __addsf3 multiple defenitions HOT 8
- Ravedude freezes on programmer uploading HOT 5
- Arduino Nano: avrdude error: programmer is not responding HOT 11
- Watchdog intterupt mode HOT 1
- [Solved] Cannot find `pwm` in `embedded_hal` HOT 2
- peripherals type alias HOT 2
- Enhance `avr_hal_generic::renamed_pins! {}` to also generate type aliases for each pin
- tier 3 target and broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avr-hal.