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

fix small lrf bug, fix gpios

refs 7890
parent 2df522bc
No related branches found
No related tags found
No related merge requests found
...@@ -19,8 +19,8 @@ ifndef CROSSLD ...@@ -19,8 +19,8 @@ ifndef CROSSLD
endif endif
# The flags which are passed to the compiler and the linker. # The flags which are passed to the compiler and the linker.
CCFLAGS+=-std=gnu99 -Wall -pthread -pedantic -c ${patsubst %,-I%,${subst :, ,${IPATH}}} CCFLAGS+=-std=gnu99 -Wall -pthread -lwiringPi -pedantic -c ${patsubst %,-I%,${subst :, ,${IPATH}}}
LDFLAGS+=-std=gnu99 -Wall -pthread -lpthread -pedantic LDFLAGS+=-std=gnu99 -Wall -pthread -lpthread -lwiringPi -pedantic
# The default rules, i.e. the entry point. # The default rules, i.e. the entry point.
all: ${BPATH} all: ${BPATH}
......
#ifndef __GPIO_H #ifndef __GPIO_H
#define __GPIO_H #define __GPIO_H
#include <stdio.h>
#include <wiringPi.h> #include <wiringPi.h>
#include "inc-gen/data_dictionary.h" #include "inc-gen/data_dictionary.h"
......
...@@ -18,13 +18,13 @@ void gpio_init(GPIO_PIN_T pin) { ...@@ -18,13 +18,13 @@ void gpio_init(GPIO_PIN_T pin) {
void gpio_init_in(GPIO_PIN_T pin) { void gpio_init_in(GPIO_PIN_T pin) {
gpio_init(pin); gpio_init(pin);
pinMode(pin, INPUT); pinMode(pin, INPUT);
} }
void gpio_init_out(GPIO_PIN_T pin) { void gpio_init_out(GPIO_PIN_T pin) {
gpio_init(pin); gpio_init(pin);
pinMode(pin, OUTPUT); pinMode(pin, OUTPUT);
} }
......
...@@ -7,7 +7,7 @@ void lrf_init() { ...@@ -7,7 +7,7 @@ void lrf_init() {
char port[100]; char port[100];
//FILE* fp = popen("dmesg | grep -A 3 \"Arduino Uno\" | grep -o \"ttyACM.\" | tail -n 1","r"); //FILE* fp = popen("dmesg | grep -A 3 \"Arduino Uno\" | grep -o \"ttyACM.\" | tail -n 1","r");
FILE* fp = popen("ls -d /dev/serial/by-id/* | grep \"Arduino\" | tr -d \"\n"\"", "r"); FILE* fp = popen("ls -d /dev/serial/by-id/* | grep \"Arduino\" | tr -d \"\n\"", "r");
//fgets(port+5, sizeof(port)-6, fp); //fgets(port+5, sizeof(port)-6, fp);
fgets(port, sizeof(port), fp); fgets(port, sizeof(port), fp);
printf("lrf port=%s\n", port); printf("lrf port=%s\n", port);
......
...@@ -55,6 +55,10 @@ void pwm_init(PWM_CHANNEL_T channel) { ...@@ -55,6 +55,10 @@ void pwm_init(PWM_CHANNEL_T channel) {
pwm_channel_values = calloc(sizeof(GEN_TYPE_int), PWM_MAX_NO_CHANNELS); pwm_channel_values = calloc(sizeof(GEN_TYPE_int), PWM_MAX_NO_CHANNELS);
pwm_channel_enabled = calloc(sizeof(GEN_TYPE_boolean), PWM_MAX_NO_CHANNELS); pwm_channel_enabled = calloc(sizeof(GEN_TYPE_boolean), PWM_MAX_NO_CHANNELS);
// start a pwm thread
//pthread_t pt_pwm;
//pthread_create(&pt_pwm, NULL, pwm_worker, NULL);
pwm_initialized = true; pwm_initialized = true;
} }
......
...@@ -18,7 +18,7 @@ int main(int argc, char* argv[]) { ...@@ -18,7 +18,7 @@ int main(int argc, char* argv[]) {
pthread_t pt_gamepad; pthread_t pt_gamepad;
pthread_create(&pt_gamepad, NULL, gp_worker, NULL); pthread_create(&pt_gamepad, NULL, gp_worker, NULL);
// start a rover thread // start a pwm thread
pthread_t pt_pwm; pthread_t pt_pwm;
pthread_create(&pt_pwm, NULL, pwm_worker, NULL); pthread_create(&pt_pwm, NULL, pwm_worker, NULL);
......
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