aboutsummaryrefslogtreecommitdiffstats
path: root/demos/ARMCM0-LPC1114-GCC
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-10-24 17:50:55 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-10-24 17:50:55 +0000
commitd39721a6c2f050afe76421cf7409fc3e1803d154 (patch)
tree604de1a12a70102f8f9aef177dc7e261c12299ce /demos/ARMCM0-LPC1114-GCC
parent02caf0b18749c1780c787fad81ad08f8c4ec5a79 (diff)
downloadChibiOS-d39721a6c2f050afe76421cf7409fc3e1803d154.tar.gz
ChibiOS-d39721a6c2f050afe76421cf7409fc3e1803d154.tar.bz2
ChibiOS-d39721a6c2f050afe76421cf7409fc3e1803d154.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2284 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos/ARMCM0-LPC1114-GCC')
-rw-r--r--demos/ARMCM0-LPC1114-GCC/main.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/demos/ARMCM0-LPC1114-GCC/main.c b/demos/ARMCM0-LPC1114-GCC/main.c
index 45496acfc..5f47acf1c 100644
--- a/demos/ARMCM0-LPC1114-GCC/main.c
+++ b/demos/ARMCM0-LPC1114-GCC/main.c
@@ -21,14 +21,28 @@
#include "hal.h"
#include "test.h"
+
+/* Maximum speed SPI configuration (1MHz, CPHA=0, CPOL=0).*/
+static SPIConfig spicfg = {
+ NULL,
+ GPIO1,
+ GPIO1_SPI0SEL,
+ CR0_DSS8BIT | CR0_FRFSPI | CR0_CLOCKRATE(0),
+ 0,
+ 48
+};
+
/*
* Red LED blinker thread, times are in milliseconds.
*/
static WORKING_AREA(waThread1, 128);
static msg_t Thread1(void *arg) {
+ uint8_t digit = 0;
(void)arg;
while (TRUE) {
+ spiStartSend(&SPID1, 1, &digit);
+ digit++;
palClearPad(GPIO0, GPIO0_LED2);
chThdSleepMilliseconds(500);
palSetPad(GPIO0, GPIO0_LED2);
@@ -78,9 +92,10 @@ int main(int argc, char **argv) {
(void)argv;
/*
- * Activates the serial driver 1 using the driver default configuration.
+ * Activates the SD1 and SPI1 drivers.
*/
- sdStart(&SD1, NULL);
+ sdStart(&SD1, NULL); /* Default: 38400,8,N,1. */
+ spiStart(&SPID1, &spicfg);
/*
* Creates the blinker threads.