From d39721a6c2f050afe76421cf7409fc3e1803d154 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 24 Oct 2010 17:50:55 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2284 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARMCM0-LPC1114-GCC/main.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'demos/ARMCM0-LPC1114-GCC') 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. -- cgit v1.2.3