-
Notifications
You must be signed in to change notification settings - Fork 244
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
I have a project with an Arduino Uno, an ethernet shield (v1), and an OV5642 SPI/I2C. There are actually 3 SPI peripherals in this setup, because the ethernet shield includes an SD card reader. The CS pins in use are
10: W5100 ethernet
4: sdcard reader
3: OV5642 (I could use something else since it is connected with jumper wires).
The current SPI implementation does not easily allow for use of SPI devices using a channel select pin other than 10.
The Spi
type provided by
avr-hal/mcu/atmega-hal/src/spi.rs
Line 25 in e897783
pub type Spi = avr_hal_generic::spi::Spi< |
PB2
(pin 10). If a user attempts to create their own type
avr_hal_generic::impl_spi! {
hal: atmega_hal::Atmega,
peripheral: atmega_hal::pac::SPI,
sclk: arduino_hal::hal::port::PB5,
mosi: arduino_hal::hal::port::PB3,
miso: arduino_hal::hal::port::PB4,
cs: arduino_hal::hal::port::PB1,
}
The following error occurs:
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> src/main.rs:273:1
|
273 | / avr_hal_generic::impl_spi! {
274 | | hal: atmega_hal::Atmega,
275 | | peripheral:
276 | | //avr_hal_generic::pac::SPI,
277 | | atmega_hal::pac::SPI,
| | -------------------- `SPI` is not defined in the current crate
... |
282 | | cs: arduino_hal::hal::port::PB1,
283 | | }
| | ^
| | |
| | impl doesn't use only types from inside the current crate
| | `Atmega` is not defined in the current crate
| | `PB5` is not defined in the current crate
| | `PB3` is not defined in the current crate
| |_`PB4` is not defined in the current crate
| `PB1` is not defined in the current crate
|
= note: define and implement a trait or new type instead
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
How can I use the SPI functionality for multiple devices?
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested