aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/Board/XMEGA
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2013-06-12 19:51:57 +0200
committerDean Camera <dean@fourwalledcubicle.com>2013-06-12 19:51:57 +0200
commitf7b9ebea02cf2a48fd4b287f6a445090ea433d52 (patch)
treebd63623df602229bba4d8f86902c823af97faf16 /LUFA/Drivers/Board/XMEGA
parent6d58628e85f473001cbacc012d7f25b477c3e797 (diff)
downloadlufa-f7b9ebea02cf2a48fd4b287f6a445090ea433d52.tar.gz
lufa-f7b9ebea02cf2a48fd4b287f6a445090ea433d52.tar.bz2
lufa-f7b9ebea02cf2a48fd4b287f6a445090ea433d52.zip
Update board Dataflash_Init() functions to automatically configure the appropriate communication interface.
Diffstat (limited to 'LUFA/Drivers/Board/XMEGA')
-rw-r--r--LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h8
-rw-r--r--LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h9
2 files changed, 14 insertions, 3 deletions
diff --git a/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h b/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h
index 143fbbffc..7ba478ca4 100644
--- a/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h
+++ b/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h
@@ -89,7 +89,7 @@
/* Inline Functions: */
/** Initializes the dataflash driver so that commands and data may be sent to an attached dataflash IC.
- * The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used.
+ * The appropriate SPI interface will be automatically configured.
*/
static inline void Dataflash_Init(void)
{
@@ -97,6 +97,12 @@
PORTCFG.MPCMASK = DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT.PIN0CTRL = PORT_INVEN_bm;
+
+ SerialSPI_Init(&USARTD0, (USART_SPI_SCK_LEAD_RISING | USART_SPI_SAMPLE_LEADING | USART_SPI_ORDER_MSB_FIRST), (F_CPU / 2));
+
+ PORTD.DIRSET = PIN3_bm | PIN1_bm;
+ PORTD.DIRCLR = PIN2_bm;
+ PORTC.PIN2CTRL = PORT_OPC_PULLUP_gc;
}
/** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash.
diff --git a/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h b/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h
index 28c79f197..3430e0cbf 100644
--- a/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h
+++ b/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h
@@ -89,7 +89,7 @@
/* Inline Functions: */
/** Initializes the dataflash driver so that commands and data may be sent to an attached dataflash IC.
- * The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used.
+ * The appropriate SPI interface will be automatically configured.
*/
static inline void Dataflash_Init(void)
{
@@ -98,7 +98,12 @@
PORTCFG.MPCMASK = DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT.PIN0CTRL = PORT_INVEN_bm;
- PORTC.REMAP |= PORT_USART0_bm;
+ SerialSPI_Init(&USARTC0, (USART_SPI_SCK_LEAD_RISING | USART_SPI_SAMPLE_LEADING | USART_SPI_ORDER_MSB_FIRST), (F_CPU / 2));
+
+ PORTC.REMAP |= PORT_USART0_bm;
+ PORTC.DIRSET = PIN7_bm | PIN5_bm;
+ PORTC.DIRCLR = PIN6_bm;
+ PORTC.PIN6CTRL = PORT_OPC_PULLUP_gc;
}
/** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash.