pattern stuff

This commit is contained in:
Wolfgang Hottgenroth 2019-02-02 16:54:24 +01:00
parent ddb4a82165
commit b21f9c85c9
Signed by: wn
GPG Key ID: B586EAFCDF2F65F4
6 changed files with 45 additions and 4 deletions

View File

@ -2,7 +2,7 @@ CC=msp430-gcc
CFLAGS=-O3 -g0 -Wall -mmcu=msp430g2553 -std=gnu99 -I hottislib
LDFLAGS=-mmcu=msp430g2553
blinky1.elf: main.o led.o time.o PontCoopScheduler.o
blinky1.elf: main.o led.o time.o pattern.o PontCoopScheduler.o
$(CC) -o $@ $(LDFLAGS) $^
PontCoopScheduler.o: hottislib/PontCoopScheduler.c hottislib/PontCoopScheduler.h

6
led.c
View File

@ -179,7 +179,7 @@ void selectCol(uint8_t column, tColor color) {
}
}
/*
void testledExec() {
static uint8_t rowNum = 0;
@ -203,7 +203,7 @@ void testledExec() {
}
}
}
*/
void ledExec() {
@ -223,5 +223,5 @@ void ledExec() {
}
void ledInit() {
schAdd(ledExec, NULL, 0, 10);
// schAdd(testledExec, NULL, 0, 500);
}

1
led.h
View File

@ -16,6 +16,7 @@ typedef enum { BLUE = 0, RED = 1, OFF = 2 } tColor;
void ledInit();
void ledExec();
void ledSetMatrix(uint8_t col, uint8_t row, tColor color);

4
main.c
View File

@ -8,6 +8,7 @@
#include "PontCoopScheduler.h"
#include "led.h"
#include "pattern.h"
int main() {
@ -26,10 +27,13 @@ int main() {
schInit();
ledInit();
// patternInit();
ledSetMatrix(3, 1, BLUE);
__enable_interrupt();
while (1) {
schExec();
ledExec();
}
}

28
pattern.c Normal file
View File

@ -0,0 +1,28 @@
#include "pattern.h"
#include "led.h"
#include "PontCoopScheduler.h"
#include <stdlib.h>
void patternExec() {
static uint8_t i = 0;
static uint8_t j = 0;
ledSetMatrix(i, j, BLUE);
i++;
if (i > 3) {
i = 0;
j++;
if (j > 3) {
j = 0;
}
}
ledSetMatrix(i, j, RED);
}
void patternInit() {
schAdd(patternExec, NULL, 0, 1000);
}

8
pattern.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef PATTERN_H_
#define PATTERN_H_
void patternExec();
void patternInit();
#endif /* PATTERN_H_ */