From 1dc39fe8df2b1a101ca2d01876ea4c0bcf0ef491 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Wed, 31 Aug 2016 16:53:26 +0200 Subject: [PATCH] issue in display, digit calculation found --- src/display.c | 9 +++++++-- src/gpio.c | 4 ++++ src/main.c | 2 +- src/time.c | 4 ++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/display.c b/src/display.c index 3fb4ae3..e29e1e6 100644 --- a/src/display.c +++ b/src/display.c @@ -28,6 +28,8 @@ typedef enum { const tPin ALL_PATTERN[] = { SEG_A, SEG_B, SEG_C, SEG_D, SEG_E, SEG_F, SEG_G, PINS_END }; const tPin H_PATTERN[] = { SEG_B, SEG_C, SEG_E, SEG_F, SEG_G, PINS_END }; const tPin I_PATTERN[] = { SEG_B, SEG_C, PINS_END }; +const tPin L_PATTERN[] = { SEG_D, SEG_E, SEG_F, PINS_END }; +const tPin O_PATTERN[] = { SEG_A, SEG_B, SEG_C, SEG_D, SEG_E, SEG_F, PINS_END }; const tPin EMPTY_PATTERN[] = { PINS_END }; const tPin NUMBER0[] = { SEG_A, SEG_B, SEG_C, SEG_D, SEG_E, SEG_F, PINS_END }; const tPin NUMBER1[] = { SEG_B, SEG_C, PINS_END }; @@ -64,11 +66,14 @@ void displayInit(void *handleArg) { } static void showNumber(uint8_t n) { - const tPin *pattern = NUMBERS[10]; + const tPin *pattern = NUMBERS[ALL_ID]; do { gpioSetPin(*pattern, LOW); pattern++; } while (*pattern != PINS_END); + if (n < 0 || n > 9) { + volatile uint8_t error = 1; + } pattern = NUMBERS[n]; do { gpioSetPin(*pattern, HIGH); @@ -82,7 +87,7 @@ void displaySetValue(uint8_t v) { digitValues[0] = I_ID; } else { digitValues[1] = v / 10; - digitValues[0] = v - digitValues[1]; + digitValues[0] = v - digitValues[1] * 10; } } diff --git a/src/gpio.c b/src/gpio.c index fa2857c..cc91b78 100644 --- a/src/gpio.c +++ b/src/gpio.c @@ -23,8 +23,12 @@ void gpioInitPins() { tPinCfg pin = pinCfg[p]; if (pin.portId == PORT1) { P1DIR |= pin.bit; + P1SEL &= ~pin.bit; + P1SEL2 &= ~pin.bit; } else if (pin.portId == PORT2) { P2DIR |= pin.bit; + P2SEL &= ~pin.bit; + P2SEL2 &= ~pin.bit; } gpioSetPin(p, pin.defaultOut); } diff --git a/src/main.c b/src/main.c index 9adc6b5..a6f4ebc 100644 --- a/src/main.c +++ b/src/main.c @@ -49,7 +49,7 @@ int main() { schAdd(displayExec, NULL, 0, 100); // schAdd(testTaskExec, &testTaskHandle1, 0, 20); // schAdd(testTaskExec, &testTaskHandle2, 2, 20); -// schAdd(measureStartConversion, NULL, 0, 1000); + schAdd(measureStartConversion, NULL, 0, 1000); __enable_interrupt(); diff --git a/src/time.c b/src/time.c index 5b1ffcf..2397661 100644 --- a/src/time.c +++ b/src/time.c @@ -18,11 +18,15 @@ volatile uint32_t timestamp; ISR(TIMER0_A0, TA0_ISR) { timestamp++; schUpdate(); + + P1OUT ^= BIT0; } void timeInit() { timestamp = 0; + P1DIR |= BIT0; + TACCR0 = 32; TACCTL0 = CCIE; TACTL = MC_1 | ID_0 | TASSEL_1 | TACLR;