led stuff

This commit is contained in:
Wolfgang Hottgenroth 2019-10-31 21:45:22 +01:00
parent 34f6066ef1
commit 236632cf63
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F
4 changed files with 41 additions and 1 deletions

View File

@ -3,7 +3,7 @@ CC=gcc
CFLAGS=-Wall
LDFLAGS=-lwiringPi -lcurl -lconfig
counter: counter.o LS7366R.o influx.o ringbuffer.o
counter: counter.o LS7366R.o influx.o ringbuffer.o led.o
$(CC) -o $@ $(LDFLAGS) $^
.c.o:

View File

@ -9,6 +9,8 @@
#include "LS7366R.h"
#include "influx.h"
#include "ringbuffer.h"
#include "led.h"
const int CTRL_OUT = 16;
const int INTR_IN = 19;
@ -58,6 +60,7 @@ void start() {
int main (void) {
readConfig();
init();
ledInit();
ls7366rInit(SPI_CHAN);
influxInit(&cfg);
start();

26
src/led.c Normal file
View File

@ -0,0 +1,26 @@
#include <stdbool.h>
#include <wiringPi.h>
#include "led.h"
const int GREEN_OUT = 20;
const int RED_OUT = 21;
const int BLUE_OUT = 26;
void ledInit() {
pinMode(GREEN_OUT, OUTPUT);
digitalWrite(GREEN_OUT, 0);
pinMode(RED_OUT, OUTPUT);
digitalWrite(RED_OUT, 0);
pinMode(BLUE_OUT, OUTPUT);
digitalWrite(BLUE_OUT, 0);
}
void led (tColor color, bool state) {
}

11
src/led.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef _LED_H_
#define _LED_H_
#include <stdbool.h>
typedef enum { E_RED, E_BLUE, E_GREEN } tColor;
void ledInit();
void led(tColor color, bool state);
#endif // _LED_H_