introduce display muxer
This commit is contained in:
@ -71,9 +71,6 @@ static void showNumber(uint8_t n) {
|
|||||||
gpioSetPin(*pattern, LOW);
|
gpioSetPin(*pattern, LOW);
|
||||||
pattern++;
|
pattern++;
|
||||||
} while (*pattern != PINS_END);
|
} while (*pattern != PINS_END);
|
||||||
if (n < 0 || n > 9) {
|
|
||||||
volatile uint8_t error = 1;
|
|
||||||
}
|
|
||||||
pattern = NUMBERS[n];
|
pattern = NUMBERS[n];
|
||||||
do {
|
do {
|
||||||
gpioSetPin(*pattern, HIGH);
|
gpioSetPin(*pattern, HIGH);
|
||||||
|
49
src/displayMuxer.c
Normal file
49
src/displayMuxer.c
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* displayMuxer.c
|
||||||
|
*
|
||||||
|
* Created on: 05.09.2016
|
||||||
|
* Author: wn
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "displayMuxer.h"
|
||||||
|
#include "display.h"
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint8_t value;
|
||||||
|
bool valid;
|
||||||
|
} tDisplayValue;
|
||||||
|
|
||||||
|
tDisplayValue displayValues[MUX_ENDS];
|
||||||
|
|
||||||
|
|
||||||
|
void displayMuxerInit(void *handleArg) {
|
||||||
|
for (tMuxerSlot i = FIRST_MUX; i < MUX_ENDS; i++) {
|
||||||
|
displayValues[i].value = 0;
|
||||||
|
displayValues[i].valid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void displayMuxerExec(void *handleArg) {
|
||||||
|
static tMuxerSlot slot = FIRST_MUX;
|
||||||
|
|
||||||
|
if (displayValues[slot].valid) {
|
||||||
|
displaySetValue(displayValues[slot].value);
|
||||||
|
}
|
||||||
|
|
||||||
|
slot++;
|
||||||
|
if (slot == MUX_ENDS) {
|
||||||
|
slot = FIRST_MUX;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void displayMuxerSetValue(uint8_t value, bool valid, tMuxerSlot slot) {
|
||||||
|
displayValues[slot].value = value;
|
||||||
|
displayValues[slot].valid = valid;
|
||||||
|
}
|
||||||
|
|
26
src/displayMuxer.h
Normal file
26
src/displayMuxer.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* displayMuxer.h
|
||||||
|
*
|
||||||
|
* Created on: 05.09.2016
|
||||||
|
* Author: wn
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef DISPLAYMUXER_H_
|
||||||
|
#define DISPLAYMUXER_H_
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
FIRST_MUX = 0,
|
||||||
|
TIMER_MUX = FIRST_MUX,
|
||||||
|
TEMPERATURE_MUX,
|
||||||
|
MUX_ENDS
|
||||||
|
} tMuxerSlot;
|
||||||
|
|
||||||
|
void displayMuxerInit(void *handleArg);
|
||||||
|
void displayMuxerExec(void *handleArg);
|
||||||
|
void displayMuxerSetValue(uint8_t value, bool valid, tMuxerSlot slot);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* DISPLAYMUXER_H_ */
|
@ -13,6 +13,7 @@
|
|||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
#include "displayMuxer.h"
|
||||||
#include "PontCoopScheduler.h"
|
#include "PontCoopScheduler.h"
|
||||||
// #include "testTask.h"
|
// #include "testTask.h"
|
||||||
#include "measure.h"
|
#include "measure.h"
|
||||||
@ -44,12 +45,14 @@ int main() {
|
|||||||
// testTaskInit(&testTaskHandle2, TESTPIN2);
|
// testTaskInit(&testTaskHandle2, TESTPIN2);
|
||||||
|
|
||||||
measureInit(NULL);
|
measureInit(NULL);
|
||||||
|
displayMuxerInit(NULL);
|
||||||
|
|
||||||
|
|
||||||
schAdd(displayExec, NULL, 0, 100);
|
schAdd(displayExec, NULL, 0, 100);
|
||||||
// schAdd(testTaskExec, &testTaskHandle1, 0, 20);
|
// schAdd(testTaskExec, &testTaskHandle1, 0, 20);
|
||||||
// schAdd(testTaskExec, &testTaskHandle2, 2, 20);
|
// schAdd(testTaskExec, &testTaskHandle2, 2, 20);
|
||||||
schAdd(measureStartConversion, NULL, 0, 1000);
|
schAdd(measureStartConversion, NULL, 0, 1000);
|
||||||
|
schAdd(displayMuxerExec, NULL, 0, 500);
|
||||||
|
|
||||||
__enable_interrupt();
|
__enable_interrupt();
|
||||||
|
|
||||||
|
@ -8,9 +8,11 @@
|
|||||||
#include <msp430g2553.h>
|
#include <msp430g2553.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "measure.h"
|
#include "measure.h"
|
||||||
#include "PontCoopScheduler.h"
|
#include "PontCoopScheduler.h"
|
||||||
|
#include "displayMuxer.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
|
|
||||||
@ -52,7 +54,8 @@ void measureCollectAndProcessConversion(void *handleArg) {
|
|||||||
|
|
||||||
uint8_t temperature = (uint8_t)t;
|
uint8_t temperature = (uint8_t)t;
|
||||||
|
|
||||||
displaySetValue(temperature);
|
// displaySetValue(temperature);
|
||||||
|
displayMuxerSetValue(temperature, true, TEMPERATURE_MUX);
|
||||||
//gpioSetPin(TESTPIN2, LOW);
|
//gpioSetPin(TESTPIN2, LOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user