aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-10-25 17:02:24 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-10-25 17:02:24 +0000
commit63b9ef1051977ed1272df94915a2fd3fa4318aa0 (patch)
treeed4c996b7a2a68ef78337c7c82f5b0bea12a77a9 /demos
parent19ca2c75154af733d7351bcc4583c414da3b5218 (diff)
downloadChibiOS-63b9ef1051977ed1272df94915a2fd3fa4318aa0.tar.gz
ChibiOS-63b9ef1051977ed1272df94915a2fd3fa4318aa0.tar.bz2
ChibiOS-63b9ef1051977ed1272df94915a2fd3fa4318aa0.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2290 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos')
-rw-r--r--demos/ARMCM0-LPC1114-GCC/main.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/demos/ARMCM0-LPC1114-GCC/main.c b/demos/ARMCM0-LPC1114-GCC/main.c
index 70e8312ab..046ac6fe6 100644
--- a/demos/ARMCM0-LPC1114-GCC/main.c
+++ b/demos/ARMCM0-LPC1114-GCC/main.c
@@ -21,6 +21,18 @@
#include "hal.h"
#include "test.h"
+/*
+ * Conversion table from hex digit to 7 segments encoding, bit 5 controls the
+ * dot.
+ * 8 = LU, 4 = RL, 2 = D, 1 = RU, 8 = U, 4 = M, 2 = LL, 1 = L.
+ */
+static uint8_t digits[32] = {
+ 0x24, 0xAF, 0xE0, 0xA2, 0x2B, 0x32, 0x30, 0xA7,
+ 0x20, 0x22, 0x21, 0x38, 0x74, 0xA8, 0x70, 0x71,
+ 0x04, 0x8F, 0xC0, 0x82, 0x0B, 0x12, 0x10, 0x87,
+ 0x00, 0x02, 0x01, 0x18, 0x54, 0x88, 0x50, 0x51
+};
+
static void endsend(SPIDriver *spip) {
spiUnselect(spip);
@@ -40,17 +52,19 @@ static SPIConfig spicfg = {
*/
static WORKING_AREA(waThread1, 128);
static msg_t Thread1(void *arg) {
- uint8_t digit = 0;
+ uint8_t i = 0;
(void)arg;
while (TRUE) {
spiSelect(&SPID1);
- spiStartSend(&SPID1, 1, &digit);
- digit++;
+ spiStartSend(&SPID1, 1, &digits[i]);
palClearPad(GPIO0, GPIO0_LED2);
chThdSleepMilliseconds(500);
+ spiSelect(&SPID1);
+ spiStartSend(&SPID1, 1, &digits[i | 0x10]);
palSetPad(GPIO0, GPIO0_LED2);
chThdSleepMilliseconds(500);
+ i = (i + 1) & 15;
}
return 0;
}