logging facility (log.c librarie), template, minor bug fixes, param init

This commit is contained in:
2021-07-31 17:13:15 +01:00
parent a5da739f65
commit 0ccd9e7d46
17 changed files with 650 additions and 181 deletions

View File

@@ -5,6 +5,8 @@
/***************************************************************************************************
* Includes
**************************************************************************************************/
#include "rpi_selector.h"
#include <stdio.h>
#include <stdlib.h>
#include <wiringPi.h>
@@ -19,6 +21,7 @@
unsigned const selectorPinNumber = 4;
/* TODO use GPIO function from ../gpio/gipo.h (same pin number) */
int selectorPins[4] = {5, 6, 26, 27};
char modeStr[] = "0 | 0 | 0 | 0 \n";
/***************************************************************************************************
* Persistent Variables
@@ -49,12 +52,11 @@ int selector_get_position() {
return -1;
}
void selector_print() {
char modeStr[] = "0 | 0 | 0 | 0 \n";
char *selector_tostr() {
for (size_t i = 0; i < selectorPinNumber; ++i) {
modeStr[i * 4] = digitalRead(selectorPins[i]) ? '1' : '0';
}
fprintf(stderr, modeStr);
return modeStr;
}
/***************************************************************************************************

View File

@@ -33,8 +33,8 @@ void selector_setup();
int selector_get_position();
/**
* \brief debug: print the selector position
* \brief Get string with selector debug info
**/
void selector_print();
char *selector_tostr();
#endif /* __RPI_SELECTOR_H__ */