-
Notifications
You must be signed in to change notification settings - Fork 2.1k
samr21: implemention of transceiver via spi #1997
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
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
ifneq (,$(filter defaulttransceiver,$(USEMODULE))) | ||
USEMODULE += at86rf231 | ||
ifeq (,$(filter netdev_base,$(USEMODULE))) | ||
USEMODULE += transceiver | ||
endif | ||
endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
FEATURES_PROVIDED += periph_gpio cpp periph_uart periph_timer periph_i2c | ||
FEATURES_PROVIDED += transceiver periph_gpio periph_spi cpp periph_timer periph_uart periph_i2c cpp |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,8 +69,8 @@ extern "C" { | |
#define UART_0_ISR isr_sercom0 | ||
/* UART 0 pin configuration */ | ||
#define UART_0_PORT (PORT->Group[0]) | ||
#define UART_0_TX_PIN PIN_PA04 | ||
#define UART_0_RX_PIN PIN_PA05 | ||
#define UART_0_TX_PIN (4) | ||
#define UART_0_RX_PIN (5) | ||
#define UART_0_PINS (PORT_PA04 | PORT_PA05) | ||
#define UART_0_REF_F (8000000UL) | ||
|
||
|
@@ -84,6 +84,48 @@ extern "C" { | |
#define UART_1_PINS | ||
/** @} */ | ||
|
||
|
||
/** | ||
* @name SPI configuration | ||
* @{ | ||
*/ | ||
#define SPI_NUMOF (2) | ||
#define SPI_0_EN 1 | ||
#define SPI_1_EN 1 | ||
|
||
/* SPI0 */ | ||
#define SPI_0_DEV SERCOM4->SPI | ||
#define SPI_IRQ_0 SERCOM4_IRQn | ||
#define SPI_0_DOPO (1) | ||
#define SPI_0_DIPO (0) | ||
#define SPI_0_F_REF (8000000UL) | ||
|
||
#define SPI_0_SCLK_DEV PORT->Group[2] | ||
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. pls put parentheses around the right part (and for all following occurrences) |
||
#define SPI_0_SCLK_PIN (18) | ||
|
||
#define SPI_0_MISO_DEV PORT->Group[2] | ||
#define SPI_0_MISO_PIN (19) | ||
|
||
#define SPI_0_MOSI_DEV PORT->Group[1] | ||
#define SPI_0_MOSI_PIN (30) | ||
|
||
/* SPI1 */ | ||
#define SPI_1_DEV SERCOM5->SPI | ||
#define SPI_IRQ_1 SERCOM5_IRQn | ||
#define SPI_1_DOPO (1) | ||
#define SPI_1_DIPO (2) | ||
#define SPI_1_F_REF (8000000UL) | ||
|
||
#define SPI_1_SCLK_DEV PORT->Group[1] | ||
#define SPI_1_SCLK_PIN (23) | ||
|
||
#define SPI_1_MISO_DEV PORT->Group[1] | ||
#define SPI_1_MISO_PIN (02) | ||
|
||
#define SPI_1_MOSI_DEV PORT->Group[1] | ||
#define SPI_1_MOSI_PIN (22) | ||
/** @} */ | ||
|
||
/** | ||
* @name I2C configuration | ||
* @{ | ||
|
@@ -110,36 +152,96 @@ extern "C" { | |
* @name Random Number Generator configuration | ||
* @{ | ||
*/ | ||
#define RANDOM_NUMOF (0U) | ||
#define RANDOM_NUMOF (0U) | ||
/** @} */ | ||
|
||
/** | ||
* @name GPIO configuration | ||
* @{ | ||
*/ | ||
#define GPIO_NUMOF (4U) | ||
#define GPIO_0_EN 1 | ||
#define GPIO_1_EN 1 | ||
#define GPIO_2_EN 1 | ||
#define GPIO_3_EN 1 | ||
#define GPIO_NUMOF (9U) | ||
#define GPIO_0_EN 1 | ||
#define GPIO_1_EN 1 | ||
#define GPIO_2_EN 1 | ||
#define GPIO_3_EN 1 | ||
/*4-7 -> internal */ | ||
#define GPIO_4_EN 1 | ||
#define GPIO_5_EN 1 | ||
#define GPIO_6_EN 1 | ||
#define GPIO_7_EN 1 | ||
#define GPIO_8_EN 1 | ||
#define GPIO_9_EN 0 | ||
#define GPIO_10_EN 0 | ||
#define GPIO_11_EN 0 | ||
|
||
#define GPIO_12_EN 0 | ||
#define GPIO_13_EN 0 | ||
#define GPIO_14_EN 0 | ||
#define GPIO_15_EN 0 | ||
|
||
#define GPIO_NO_EXTINT (18) | ||
|
||
/* GPIO channel 0 config */ | ||
#define GPIO_0_DEV PORT->Group[0] | ||
#define GPIO_0_PIN PIN_PA13 | ||
#define GPIO_0_EXTINT 13 | ||
#define GPIO_0_DEV PORT->Group[0] | ||
#define GPIO_0_PIN (13) | ||
#define GPIO_0_EXTINT (13) | ||
/* GPIO channel 1 config */ | ||
/* SW0 Button, configure w/ GPIO_PULLUP and GPIO_FALLING */ | ||
#define GPIO_1_DEV PORT->Group[0] | ||
#define GPIO_1_PIN PIN_PA28 | ||
#define GPIO_1_EXTINT 8 | ||
#define GPIO_1_DEV PORT->Group[0] | ||
#define GPIO_1_PIN (28) | ||
#define GPIO_1_EXTINT (8) | ||
/* GPIO channel 2 config */ | ||
#define GPIO_2_DEV PORT->Group[0] | ||
#define GPIO_2_PIN PIN_PA15 | ||
#define GPIO_2_EXTINT 15 | ||
#define GPIO_2_DEV PORT->Group[0] | ||
#define GPIO_2_PIN (15) | ||
#define GPIO_2_EXTINT (15) | ||
/* GPIO channel 3 config */ | ||
#define GPIO_3_DEV PORT->Group[0] | ||
#define GPIO_3_PIN PIN_PA19 | ||
#define GPIO_3_EXTINT 3 | ||
#define GPIO_3_DEV PORT->Group[0] | ||
#define GPIO_3_PIN (19) | ||
#define GPIO_3_EXTINT (3) | ||
/* GPIO 4-7 Internal radio pins*/ | ||
/* GPIO channel 4 config radio CS*/ | ||
#define GPIO_4_DEV PORT->Group[1] | ||
#define GPIO_4_PIN (31) | ||
#define GPIO_4_EXTINT GPIO_NO_EXTINT | ||
/* GPIO channel 5 config radio IRQ0*/ | ||
#define GPIO_5_DEV PORT->Group[1] | ||
#define GPIO_5_PIN (0) | ||
#define GPIO_5_EXTINT (0) | ||
/* GPIO channel 6 config radio reset*/ | ||
#define GPIO_6_DEV PORT->Group[1] | ||
#define GPIO_6_PIN (15) | ||
#define GPIO_6_EXTINT GPIO_NO_EXTINT | ||
/* GPIO channel 7 config radio sleep*/ | ||
#define GPIO_7_DEV PORT->Group[0] | ||
#define GPIO_7_PIN (20) | ||
#define GPIO_7_EXTINT GPIO_NO_EXTINT | ||
/* GPIO channel 8 config */ | ||
#define GPIO_8_DEV PORT->Group[0] | ||
#define GPIO_8_PIN (27) | ||
#define GPIO_8_EXTINT GPIO_NO_EXTINT | ||
/* GPIO channel 9 config */ | ||
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. If it should be possible to use the GPIOs > 3 just as GPIOs and independent from SPI, it could be clearer to define them like the others and don't refert to the SPI values. |
||
#define GPIO_9_DEV | ||
#define GPIO_9_PIN | ||
#define GPIO_9_EXTINT | ||
/* GPIO channel 10 config */ | ||
#define GPIO_10_DEV | ||
#define GPIO_10_PIN | ||
#define GPIO_10_EXTINT | ||
/* GPIO channel 11 config */ | ||
#define GPIO_11_DEV | ||
#define GPIO_11_PIN | ||
#define GPIO_11_EXTINT | ||
/* GPIO channel 12 config */ | ||
#define GPIO_12_PIN | ||
#define GPIO_12_EXTINT | ||
/* GPIO channel 13 config */ | ||
#define GPIO_13_PIN | ||
#define GPIO_13_EXTINT | ||
/* GPIO channel 14 config */ | ||
#define GPIO_14_PIN | ||
#define GPIO_14_EXTINT | ||
/* GPIO channel 15 config */ | ||
#define GPIO_15_PIN | ||
#define GPIO_15_EXTINT | ||
/** @} */ | ||
|
||
#ifdef __cplusplus | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,7 @@ extern "C" { | |
#endif | ||
/** @} */ | ||
|
||
#define TRANSCEIVER_BUFFER_SIZE (3) | ||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
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.
put the SPI defines in a block using
* @{
and/** @} */