Skip to content
Snippets Groups Projects
Commit b517780a authored by fortissBot's avatar fortissBot
Browse files

fixed lrf bug, added gpio function

refs 7890
parent ef0c43cc
No related branches found
No related tags found
No related merge requests found
#include "inc/GPIO.h"
// init, term
GEN_TYPE_boolean gpio_initialized = false;
GEN_TYPE_boolean gpio_terminated = false;
void gpio_init(GPIO_PIN_T pin) {
// important, since all pins are accessing the same method
if(gpio_initialized) return;
gpio_initialized = true;
// TODO initialize...
}
void gpio_term(GPIO_PIN_T pin) {
void gp_term() {
// important, since all pins are accessing the same method
if(gpio_terminated) return;
gpio_terminated = false;
}
// noval
......@@ -15,7 +25,7 @@ GEN_TYPE_boolean gpio_is_noval(GPIO_PIN_T pin) {
}
void gpio_set_noval(GPIO_PIN_T pin) {
// do nothing
}
// readers
......
......@@ -30,12 +30,15 @@ GEN_TYPE_int lrf_read() {
// looks like a blocking call and actually is but is always very fast
// since it only has to read the queue
while (1) {
n_read = uart_receive(bytes, 5, 0);
n_read = uart_receive(&bytes, 5, 0);
for (i = 0; i < n_read; i++) {
if (bytes[i] != 0xd && bytes[i] != 0xa) {
value[n++] = bytes[i];
} else if (atoi(value) != 0) {
for (i = n; i < 3; i++) {
value[i] = 0;
}
return atoi(value);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment