From 79f7c128bb43c9d4598a9d373dc570a04733e2b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atle=20H=2E=20Havs=C3=B8?= Date: Thu, 24 Jul 2014 11:20:18 +0200 Subject: Changes needed for afro-card. --- spi/spi.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'spi') diff --git a/spi/spi.h b/spi/spi.h index 1f9e0eb..1b35b89 100644 --- a/spi/spi.h +++ b/spi/spi.h @@ -7,7 +7,10 @@ struct SPI_reg_t { volatile uint32_t CR1; volatile uint32_t CR2; volatile uint32_t SR; - volatile uint32_t DR; + union { + volatile uint32_t DR; + volatile uint8_t DR8; + }; volatile uint32_t CRCPR; volatile uint32_t RXCRCR; volatile uint32_t TXCRCR; @@ -22,13 +25,12 @@ class SPI_t { SPI_t(uint32_t reg_addr) : reg(*(SPI_reg_t*)reg_addr) {} uint8_t transfer_byte(uint8_t out = 0) { - reg.DR = out; + reg.DR8 = out; while(!(reg.SR & 0x01)) { Thread::yield(); } - - return reg.DR; + return reg.DR8; } }; -- cgit v1.2.3