aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/AVR/spi_lld.c
diff options
context:
space:
mode:
authorutzig <utzig@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-09-04 18:49:07 +0000
committerutzig <utzig@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-09-04 18:49:07 +0000
commitb6814edfd2db3420e644b0475112f83d7af4da80 (patch)
treef5f88bc45a673abe82b309d9f111b169cbbc92fd /os/hal/ports/AVR/spi_lld.c
parent147426d333ad1e863793791cf8c2e0891d55a6b2 (diff)
downloadChibiOS-b6814edfd2db3420e644b0475112f83d7af4da80.tar.gz
ChibiOS-b6814edfd2db3420e644b0475112f83d7af4da80.tar.bz2
ChibiOS-b6814edfd2db3420e644b0475112f83d7af4da80.zip
[AVR] SPI driver updated for 3.0 + removed weird slave interface support
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7247 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports/AVR/spi_lld.c')
-rw-r--r--os/hal/ports/AVR/spi_lld.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/os/hal/ports/AVR/spi_lld.c b/os/hal/ports/AVR/spi_lld.c
index 3621b2136..ffc0f513e 100644
--- a/os/hal/ports/AVR/spi_lld.c
+++ b/os/hal/ports/AVR/spi_lld.c
@@ -71,7 +71,7 @@ OSAL_IRQ_HANDLER(SPI_STC_vect) {
/* spi_lld_exchange, spi_lld_send or spi_lld_ignore */
if (spip->txidx < spip->txbytes) {
- if (spip->txbuf) {
+ if (spip->txbuf) {
SPDR = spip->txbuf[spip->txidx++]; // send
} else {
SPDR = 0; spip->txidx++; // dummy send
@@ -136,19 +136,10 @@ void spi_lld_start(SPIDriver *spip) {
/* SPI enable, SPI interrupt enable */
SPCR |= ((1 << SPE) | (1 << SPIE));
- switch (spip->config->role) {
- case SPI_ROLE_SLAVE:
- SPCR &= ~(1 << MSTR); /* master mode */
- DDR_SPI1 |= (1 << SPI1_MISO); /* output */
- DDR_SPI1 &= ~((1 << SPI1_MOSI) | (1 << SPI1_SCK) | (1 << SPI1_SS)); /* input */
- break;
- case SPI_ROLE_MASTER: /* fallthrough */
- default:
- SPCR |= (1 << MSTR); /* slave mode */
- DDR_SPI1 |= ((1 << SPI1_MOSI) | (1 << SPI1_SCK)); /* output */
- DDR_SPI1 &= ~(1 << SPI1_MISO); /* input */
- spip->config->ssport->dir |= (1 << spip->config->sspad);
- }
+ SPCR |= (1 << MSTR);
+ DDR_SPI1 |= ((1 << SPI1_MOSI) | (1 << SPI1_SCK));
+ DDR_SPI1 &= ~(1 << SPI1_MISO);
+ spip->config->ssport->dir |= (1 << spip->config->sspad);
switch (spip->config->bitorder) {
case SPI_LSB_FIRST:
@@ -248,10 +239,10 @@ void spi_lld_stop(SPIDriver *spip) {
* @notapi
*/
void spi_lld_select(SPIDriver *spip) {
-
+
/**
- * NOTE: This should only be called in master mode
- */
+ * NOTE: This should only be called in master mode.
+ */
spip->config->ssport->out &= ~(1 << spip->config->sspad);
}
@@ -267,8 +258,8 @@ void spi_lld_select(SPIDriver *spip) {
void spi_lld_unselect(SPIDriver *spip) {
/**
- * NOTE: This should only be called in master mode
- */
+ * NOTE: This should only be called in master mode.
+ */
spip->config->ssport->out |= (1 << spip->config->sspad);
}