Fixed the requirement for -lm

Updated the gpio program to be device tree aware.
This commit is contained in:
Gordon Henderson
2015-09-24 22:35:31 +01:00
parent 170dce5f19
commit f6c40cb2a6
9 changed files with 98 additions and 34 deletions

View File

@@ -3,7 +3,7 @@
# wiringPi - Wiring Compatable library for the Raspberry Pi
# https://projects.drogon.net/wiring-pi
#
# Copyright (c) 2012 Gordon Henderson
# Copyright (c) 2012-2015 Gordon Henderson
#################################################################################
# This file is part of wiringPi:
# Wiring Compatable library for the Raspberry Pi
@@ -47,7 +47,8 @@ SRC = blink.c blink8.c blink12.c \
softPwm.c softTone.c \
delayTest.c serialRead.c serialTest.c okLed.c ds1302.c \
lowPower.c \
rht03.c piglow.c
max31855.c \
rht03.c
OBJ = $(SRC:.c=.o)
@@ -148,10 +149,9 @@ ds1302: ds1302.o
$Q echo [link]
$Q $(CC) -o $@ ds1302.o $(LDFLAGS) $(LDLIBS)
piglow: piglow.o
max31855: max31855.o
$Q echo [link]
$Q $(CC) -o $@ piglow.o $(LDFLAGS) $(LDLIBS)
$Q $(CC) -o $@ max31855.c.o $(LDFLAGS) $(LDLIBS)
.c.o:
$Q echo [CC] $<

View File

@@ -3,7 +3,7 @@
# wiringPi - Wiring Compatable library for the Raspberry Pi
# https://projects.drogon.net/wiring-pi
#
# Copyright (c) 2012-2013 Gordon Henderson
# Copyright (c) 2012-2015 Gordon Henderson
#################################################################################
# This file is part of wiringPi:
# Wiring Compatable library for the Raspberry Pi

49
examples/max31855.c Normal file
View File

@@ -0,0 +1,49 @@
/*
* max31855.c:
* SPI Thermocouple interface chip
*
* Copyright (c) 2015 Gordon Henderson.
***********************************************************************
* This file is part of wiringPi:
* https://projects.drogon.net/raspberry-pi/wiringpi/
*
* wiringPi is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* wiringPi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
***********************************************************************
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#include <wiringPi.h>
#include <max31855.h>
int main (int argc, char *argv [])
{
int i ;
wiringPiSetup () ;
max31855Setup (200, 0) ;
max31855Setup (400, 1) ;
for (;;)
{
printf ("%6d, %6d, %6d, %6d ::::", analogRead (200), analogRead (201), analogRead (202), analogRead (203)) ;
printf ("%6d, %6d, %6d, %6d\n", analogRead (400), analogRead (401), analogRead (402), analogRead (403)) ;
delay (500) ;
}
}