Skip to content

Commit

Permalink
Changes to be committed:
Browse files Browse the repository at this point in the history
	modified:   Makefile
	modified:   Timer.c
  • Loading branch information
jlamperez committed May 16, 2016
1 parent 6095a70 commit 594d9c3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 28 deletions.
32 changes: 5 additions & 27 deletions Timer/src/Makefile
Original file line number Diff line number Diff line change
@@ -1,46 +1,24 @@
CC = gcc
CFLAGS =-Wall -lwiringPi -lrt -lpthread

OBJECTS = pwm.o pid.o adc.o registers.o main.o ads1115.o i2c.o timer.o service.o server.o rpiservo.o
OUT = SmartServo
OBJECTS = ads1115.o i2c.o Timer.o
OUT = TimerADS1115


#all: target -> This is the default target for makefiles.
all : $(OBJECTS)
$(CC) $(CFLAGS) -o $(OUT) $(OBJECTS)

adc.o: Framework/modules/adc.c
$(CC) $(CFLAGS) -c $< -o $@

pid.o: Framework/modules/pid.c
$(CC) $(CFLAGS) -c $< -o $@

pwm.o: Framework/modules/pwm.c
$(CC) $(CFLAGS) -c $< -o $@

registers.o: Framework/modules/registers.c
$(CC) $(CFLAGS) -c $< -o $@

ads1115.o: Framework/modules/ads1115.c
ads1115.o: ads1115.c
$(CC) $(CFLAGS) -c $< -o $@

i2c.o: Framework/modules/i2c.c
i2c.o: i2c.c
$(CC) $(CFLAGS) -c $< -o $@

timer.o: Framework/modules/timer.c
Timer.o: Timer.c
$(CC) $(CFLAGS) -c $< -o $@

service.o: Framework/modules/service.c
$(CC) $(CFLAGS) -c $< -o $@

server.o: Framework/modules/server.c
$(CC) $(CFLAGS) -c $< -o $@

rpiservo.o: Framework/modules/rpiservo.c
$(CC) $(CFLAGS) -c $< -o $@

main.o: main.c
$(CC) $(CFLAGS) -c $< -o $@

clean:
rm *o hello
12 changes: 11 additions & 1 deletion Timer/src/Timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
#include "ads1115.h"

#define CLOCKID CLOCK_REALTIME
#define SIG SIGRTMIN
Expand All @@ -26,8 +27,16 @@ sigset_t mask;
void ADC_handler(int sig, siginfo_t *si, void *uc) {
static int cont=0;
// POSITION (Potenciometer)
uint16_t pos = ADS1115_readADC_singleEnded(POSITION_CHANNEL);
uint16_t temp = ADS1115_readADC_singleEnded(TEMP_CHANNEL);
uint16_t battery = ADS1115_readADC_singleEnded(BATTERY_CHANNEL);
uint16_t current = ADS1115_readADC_singleEnded(CURRENT_CHANNEL);

printf("ADS1115 pos: %d, temp: %d, battery: %d, current: %d \n", pos, temp, battery, current);


printf("handler %i \n", cont);
printf("Time: %d seconds\n", (double)clock());
// printf("Time: %d seconds\n", (double)clock());
cont++;
}

Expand Down Expand Up @@ -142,6 +151,7 @@ int main(void) {
// long long freq_nanosecs= 100000000;//100ms
// long long freq_nanosecs= 1000000000;//1s

ADS1115_init(ADS1115_ADDRESS);
//Establish handler for timer signal.
TIMER_signalHandler();
//Block timer signal temporarily
Expand Down

0 comments on commit 594d9c3

Please sign in to comment.