-
Notifications
You must be signed in to change notification settings - Fork 25
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
libraries: SPI: Hanlde multiple SPI instances #113
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,24 @@ class ZephyrSPI : public HardwareSPI { | |
|
||
} // namespace arduino | ||
|
||
#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), spis) && (DT_PROP_LEN(DT_PATH(zephyr_user), spis) > 1) | ||
#define ARDUINO_SPI_DEFINED_0 1 | ||
#define DECL_EXTERN_SPI_0(i) extern arduino::ZephyrSPI SPI | ||
#define DECL_EXTERN_SPI_N(i) extern arduino::ZephyrSPI SPI##i | ||
#define DECLARE_EXTERN_SPI_N(n, p, i) \ | ||
COND_CODE_1(ARDUINO_SPI_DEFINED_##i, (DECL_EXTERN_SPI_0(i);), (DECL_EXTERN_SPI_N(i);)) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please fix above checkpatch warns @soburi .
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this fixed? |
||
/* Declare SPI, SPI1, SPI2, ... */ | ||
DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), spis, DECLARE_EXTERN_SPI_N) | ||
|
||
#undef DECLARE_EXTERN_SPI_N | ||
#undef DECL_EXTERN_SPI_N | ||
#undef DECL_EXTERN_SPI_0 | ||
#undef ARDUINO_SPI_DEFINED_0 | ||
#else | ||
extern arduino::ZephyrSPI SPI; | ||
#endif | ||
|
||
/* Serial Peripheral Control Register */ | ||
extern uint8_t SPCR; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So where does the
arduino-spi
name come from? Are any boards already defining it using that label?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is usually define with
arduino_header
inzephyr/boards
definitions.This line is intended to take advantage of it if it is already defined.
And we can override with overlay in this package with defining
spis
property.