mirror of
https://github.com/clockworkpi/WiringPi.git
synced 2025-12-12 16:08:49 +01:00
Minor changes to the PiGlow code - got the orange & yellow the right way
round at last.. Updated for the 0x0012 board revision on the new A+
This commit is contained in:
parent
df45388f64
commit
0a9fdeb29d
@ -65,18 +65,18 @@ $(DYNAMIC): $(OBJ)
|
|||||||
@echo [Compile] $<
|
@echo [Compile] $<
|
||||||
@$(CC) -c $(CFLAGS) $< -o $@
|
@$(CC) -c $(CFLAGS) $< -o $@
|
||||||
|
|
||||||
.PHONEY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
@echo "[Clean]"
|
@echo "[Clean]"
|
||||||
@rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPiDev.*
|
@rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPiDev.*
|
||||||
|
|
||||||
.PHONEY: tags
|
.PHONY: tags
|
||||||
tags: $(SRC)
|
tags: $(SRC)
|
||||||
@echo [ctags]
|
@echo [ctags]
|
||||||
@ctags $(SRC)
|
@ctags $(SRC)
|
||||||
|
|
||||||
|
|
||||||
.PHONEY: install-headers
|
.PHONY: install-headers
|
||||||
install-headers:
|
install-headers:
|
||||||
@echo "[Install Headers]"
|
@echo "[Install Headers]"
|
||||||
@install -m 0755 -d $(DESTDIR)$(PREFIX)/include
|
@install -m 0755 -d $(DESTDIR)$(PREFIX)/include
|
||||||
@ -89,7 +89,7 @@ install-headers:
|
|||||||
@install -m 0644 lcd.h $(DESTDIR)$(PREFIX)/include
|
@install -m 0644 lcd.h $(DESTDIR)$(PREFIX)/include
|
||||||
@install -m 0644 piGlow.h $(DESTDIR)$(PREFIX)/include
|
@install -m 0644 piGlow.h $(DESTDIR)$(PREFIX)/include
|
||||||
|
|
||||||
.PHONEY: install
|
.PHONY: install
|
||||||
install: $(DYNAMIC) install-headers
|
install: $(DYNAMIC) install-headers
|
||||||
@echo "[Install Dynamic Lib]"
|
@echo "[Install Dynamic Lib]"
|
||||||
@install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
|
@install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
|
||||||
@ -97,13 +97,13 @@ install: $(DYNAMIC) install-headers
|
|||||||
@ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION) $(DESTDIR)/lib/libwiringPiDev.so
|
@ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION) $(DESTDIR)/lib/libwiringPiDev.so
|
||||||
@ldconfig
|
@ldconfig
|
||||||
|
|
||||||
.PHONEY: install-static
|
.PHONY: install-static
|
||||||
install-static: $(STATIC) install-headers
|
install-static: $(STATIC) install-headers
|
||||||
@echo "[Install Static Lib]"
|
@echo "[Install Static Lib]"
|
||||||
@install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
|
@install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
|
||||||
@install -m 0755 libwiringPiDev.a $(DESTDIR)$(PREFIX)/lib
|
@install -m 0755 libwiringPiDev.a $(DESTDIR)$(PREFIX)/lib
|
||||||
|
|
||||||
.PHONEY: uninstall
|
.PHONY: uninstall
|
||||||
uninstall:
|
uninstall:
|
||||||
@echo "[UnInstall]"
|
@echo "[UnInstall]"
|
||||||
@rm -f $(DESTDIR)$(PREFIX)/include/ds1302.h
|
@rm -f $(DESTDIR)$(PREFIX)/include/ds1302.h
|
||||||
@ -118,7 +118,7 @@ uninstall:
|
|||||||
@ldconfig
|
@ldconfig
|
||||||
|
|
||||||
|
|
||||||
.PHONEY: depend
|
.PHONY: depend
|
||||||
depend:
|
depend:
|
||||||
makedepend -Y $(SRC)
|
makedepend -Y $(SRC)
|
||||||
|
|
||||||
|
|||||||
@ -24,8 +24,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#define PIGLOW_RED 0
|
#define PIGLOW_RED 0
|
||||||
#define PIGLOW_YELLOW 1
|
#define PIGLOW_ORANGE 1
|
||||||
#define PIGLOW_ORANGE 2
|
#define PIGLOW_YELLOW 2
|
||||||
#define PIGLOW_GREEN 3
|
#define PIGLOW_GREEN 3
|
||||||
#define PIGLOW_BLUE 4
|
#define PIGLOW_BLUE 4
|
||||||
#define PIGLOW_WHITE 5
|
#define PIGLOW_WHITE 5
|
||||||
|
|||||||
@ -43,6 +43,7 @@ SRC = blink.c blink8.c blink12.c \
|
|||||||
nes.c \
|
nes.c \
|
||||||
softPwm.c softTone.c \
|
softPwm.c softTone.c \
|
||||||
delayTest.c serialRead.c serialTest.c okLed.c ds1302.c \
|
delayTest.c serialRead.c serialTest.c okLed.c ds1302.c \
|
||||||
|
lowPower.c \
|
||||||
rht03.c piglow.c
|
rht03.c piglow.c
|
||||||
|
|
||||||
OBJ = $(SRC:.c=.o)
|
OBJ = $(SRC:.c=.o)
|
||||||
|
|||||||
68
examples/lowPower.c
Normal file
68
examples/lowPower.c
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* lowPower.c:
|
||||||
|
* Check the Pi's LOW-Power signal.
|
||||||
|
*
|
||||||
|
* This is a demonstration program that could be turned into some sort
|
||||||
|
* of logger via e.g. syslog - however it's also probably something
|
||||||
|
* that might be better handled by a future kernel - who knows.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2014 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 <time.h>
|
||||||
|
#include <wiringPi.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define LOW_POWER 35
|
||||||
|
|
||||||
|
/*
|
||||||
|
* lowPower:
|
||||||
|
* This is an ISR that waits for the low-power signal going low and
|
||||||
|
* prints the result.
|
||||||
|
*********************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
void lowPower (void)
|
||||||
|
{
|
||||||
|
time_t t ;
|
||||||
|
|
||||||
|
time (&t) ;
|
||||||
|
printf ("%s: LOW POWER DETECTED\n", ctime (&t)) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*********************************************************************************
|
||||||
|
* main
|
||||||
|
*********************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
int main (void)
|
||||||
|
{
|
||||||
|
wiringPiSetupGpio () ; // GPIO mode as it's an internal pin
|
||||||
|
|
||||||
|
wiringPiISR (LOW_POWER, INT_EDGE_FALLING, &lowPower) ;
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
delay (1000) ;
|
||||||
|
|
||||||
|
return 0 ;
|
||||||
|
}
|
||||||
118
examples/spiSpeed.c
Normal file
118
examples/spiSpeed.c
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
/*
|
||||||
|
* spiSpeed.c:
|
||||||
|
* Code to measure the SPI speed/latency.
|
||||||
|
* Copyright (c) 2014 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 <unistd.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
//#include <fcntl.h>
|
||||||
|
//#include <sys/ioctl.h>
|
||||||
|
//#include <linux/spi/spidev.h>
|
||||||
|
|
||||||
|
#include <wiringPi.h>
|
||||||
|
#include <wiringPiSPI.h>
|
||||||
|
|
||||||
|
#define TRUE (1==1)
|
||||||
|
#define FALSE (!TRUE)
|
||||||
|
|
||||||
|
#define SPI_CHAN 0
|
||||||
|
#define NUM_TIMES 100
|
||||||
|
#define MAX_SIZE (1024*1024)
|
||||||
|
|
||||||
|
static int myFd ;
|
||||||
|
|
||||||
|
|
||||||
|
void spiSetup (int speed)
|
||||||
|
{
|
||||||
|
if ((myFd = wiringPiSPISetup (SPI_CHAN, speed)) < 0)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "Can't open the SPI bus: %s\n", strerror (errno)) ;
|
||||||
|
exit (EXIT_FAILURE) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main (void)
|
||||||
|
{
|
||||||
|
int speed, times, size ;
|
||||||
|
unsigned int start, end ;
|
||||||
|
int spiFail ;
|
||||||
|
unsigned char *myData ;
|
||||||
|
double timePerTransaction, perfectTimePerTransaction, dataSpeed ;
|
||||||
|
|
||||||
|
if ((myData = malloc (MAX_SIZE)) == NULL)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "Unable to allocate buffer: %s\n", strerror (errno)) ;
|
||||||
|
exit (EXIT_FAILURE) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
wiringPiSetup () ;
|
||||||
|
|
||||||
|
for (speed = 1 ; speed <= 32 ; speed *= 2)
|
||||||
|
{
|
||||||
|
printf ("+-------+--------+----------+----------+-----------+------------+\n") ;
|
||||||
|
printf ("| MHz | Size | mS/Trans | TpS | Mb/Sec | Latency mS |\n") ;
|
||||||
|
printf ("+-------+--------+----------+----------+-----------+------------+\n") ;
|
||||||
|
|
||||||
|
spiFail = FALSE ;
|
||||||
|
spiSetup (speed * 1000000) ;
|
||||||
|
for (size = 1 ; size <= MAX_SIZE ; size *= 2)
|
||||||
|
{
|
||||||
|
printf ("| %5d | %6d ", speed, size) ;
|
||||||
|
|
||||||
|
start = millis () ;
|
||||||
|
for (times = 0 ; times < NUM_TIMES ; ++times)
|
||||||
|
if (wiringPiSPIDataRW (SPI_CHAN, myData, size) == -1)
|
||||||
|
{
|
||||||
|
printf ("SPI failure: %s\n", strerror (errno)) ;
|
||||||
|
spiFail = TRUE ;
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
end = millis () ;
|
||||||
|
|
||||||
|
if (spiFail)
|
||||||
|
break ;
|
||||||
|
|
||||||
|
timePerTransaction = ((double)(end - start) / (double)NUM_TIMES) / 1000.0 ;
|
||||||
|
dataSpeed = (double)(size * 8) / (1024.0 * 1024.0) / timePerTransaction ;
|
||||||
|
perfectTimePerTransaction = ((double)(size * 8)) / ((double)(speed * 1000000)) ;
|
||||||
|
|
||||||
|
printf ("| %8.3f ", timePerTransaction * 1000.0) ;
|
||||||
|
printf ("| %8.1f ", 1.0 / timePerTransaction) ;
|
||||||
|
printf ("| %9.5f ", dataSpeed) ;
|
||||||
|
printf ("| %8.5f ", (timePerTransaction - perfectTimePerTransaction) * 1000.0) ;
|
||||||
|
printf ("|\n") ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
close (myFd) ;
|
||||||
|
printf ("+-------+--------+----------+----------+-----------+------------+\n") ;
|
||||||
|
printf ("\n") ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0 ;
|
||||||
|
}
|
||||||
47
gpio/gpio.c
47
gpio/gpio.c
@ -2,7 +2,7 @@
|
|||||||
* gpio.c:
|
* gpio.c:
|
||||||
* Swiss-Army-Knife, Set-UID command-line interface to the Raspberry
|
* Swiss-Army-Knife, Set-UID command-line interface to the Raspberry
|
||||||
* Pi's GPIO.
|
* Pi's GPIO.
|
||||||
* Copyright (c) 2012-2013 Gordon Henderson
|
* Copyright (c) 2012-2014 Gordon Henderson
|
||||||
***********************************************************************
|
***********************************************************************
|
||||||
* This file is part of wiringPi:
|
* This file is part of wiringPi:
|
||||||
* https://projects.drogon.net/raspberry-pi/wiringpi/
|
* https://projects.drogon.net/raspberry-pi/wiringpi/
|
||||||
@ -53,7 +53,7 @@ extern void doPins (void) ;
|
|||||||
# define FALSE (1==2)
|
# define FALSE (1==2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define VERSION "2.20"
|
#define VERSION "2.21"
|
||||||
#define PI_USB_POWER_CONTROL 38
|
#define PI_USB_POWER_CONTROL 38
|
||||||
#define I2CDETECT "/usr/sbin/i2cdetect"
|
#define I2CDETECT "/usr/sbin/i2cdetect"
|
||||||
|
|
||||||
@ -612,23 +612,44 @@ static void doResetExternal (void)
|
|||||||
|
|
||||||
static void doReset (char *progName)
|
static void doReset (char *progName)
|
||||||
{
|
{
|
||||||
int pin ;
|
int model, rev, mem, maker, overVolted ;
|
||||||
|
int pin, endPin ;
|
||||||
|
|
||||||
if (wiringPiNodes != NULL) // External reset
|
printf ("GPIO Reset is dangerous!\n") ;
|
||||||
|
printf (" - Do Not rely on this to do anything sensible!\n") ;
|
||||||
|
|
||||||
|
if (wiringPiNodes != NULL) // External
|
||||||
|
{
|
||||||
doResetExternal () ;
|
doResetExternal () ;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
piBoardId (&model, &rev, &mem, &maker, &overVolted) ;
|
||||||
|
|
||||||
|
/**/ if ((model == PI_MODEL_A) || (model == PI_MODEL_B))
|
||||||
|
endPin = 16 ;
|
||||||
|
else if (model == PI_MODEL_BP)
|
||||||
|
endPin = 39 ;
|
||||||
|
else if (model == PI_MODEL_CM)
|
||||||
|
{
|
||||||
|
printf (" - Don't know how to reset a comput module:\n") ;
|
||||||
|
printf (" Write a shell-script to reset the pins to the state you need.\n") ;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
doUnexportall (progName) ;
|
printf ("Oops - unable to determine board type... model: %d\n", model) ;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
for (pin = 0 ; pin < 64 ; ++pin)
|
for (pin = 0 ; pin <= endPin ; ++pin)
|
||||||
{
|
{
|
||||||
if (wpiPinToGpio (pin) == -1)
|
if (wpiPinToGpio (pin) == -1)
|
||||||
continue ;
|
continue ;
|
||||||
|
|
||||||
digitalWrite (pin, LOW) ;
|
digitalWrite (pin, LOW) ;
|
||||||
pinMode (pin, INPUT) ;
|
pinMode (pin, INPUT) ;
|
||||||
pullUpDnControl (pin, PUD_OFF) ;
|
pullUpDnControl (pin, PUD_OFF) ;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -278,23 +278,31 @@ void abReadall (int model, int rev)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bPlusReadall:
|
* piPlusReadall:
|
||||||
* Read all the pins on the model B+
|
* Read all the pins on the model A+ or the B+
|
||||||
*********************************************************************************
|
*********************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void bPlusReadall (void)
|
void piPlusReadall (int model)
|
||||||
{
|
{
|
||||||
int pin ;
|
int pin ;
|
||||||
|
|
||||||
printf (" +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+\n") ;
|
if (model == PI_MODEL_AP)
|
||||||
|
printf (" +-----+-----+---------+------+---+--A Plus--+---+------+---------+-----+-----+\n") ;
|
||||||
|
else
|
||||||
|
printf (" +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+\n") ;
|
||||||
|
|
||||||
printf (" | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |\n") ;
|
printf (" | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |\n") ;
|
||||||
printf (" +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+\n") ;
|
printf (" +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+\n") ;
|
||||||
for (pin = 1 ; pin <= 40 ; pin += 2)
|
for (pin = 1 ; pin <= 40 ; pin += 2)
|
||||||
readallPhys (pin) ;
|
readallPhys (pin) ;
|
||||||
printf (" +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+\n") ;
|
printf (" +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+\n") ;
|
||||||
printf (" | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |\n") ;
|
printf (" | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |\n") ;
|
||||||
printf (" +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+\n") ;
|
|
||||||
|
if (model == PI_MODEL_AP)
|
||||||
|
printf (" +-----+-----+---------+------+---+--A Plus--+---+------+---------+-----+-----+\n") ;
|
||||||
|
else
|
||||||
|
printf (" +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+\n") ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -312,8 +320,8 @@ void doReadall (void)
|
|||||||
|
|
||||||
/**/ if ((model == PI_MODEL_A) || (model == PI_MODEL_B))
|
/**/ if ((model == PI_MODEL_A) || (model == PI_MODEL_B))
|
||||||
abReadall (model, rev) ;
|
abReadall (model, rev) ;
|
||||||
else if (model == PI_MODEL_BP)
|
else if ((model == PI_MODEL_BP) || (model == PI_MODEL_AP))
|
||||||
bPlusReadall () ;
|
piPlusReadall (model) ;
|
||||||
else if (model == PI_MODEL_CM)
|
else if (model == PI_MODEL_CM)
|
||||||
cmReadall () ;
|
cmReadall () ;
|
||||||
else
|
else
|
||||||
|
|||||||
@ -13,6 +13,6 @@ pdf: pins.dvi
|
|||||||
@dvipdf pins.dvi
|
@dvipdf pins.dvi
|
||||||
|
|
||||||
|
|
||||||
.PHONEY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
@rm -f *.dvi *.aux *.log *.ps *.toc *.bak *~
|
@rm -f *.dvi *.aux *.log *.ps *.toc *.bak *~
|
||||||
|
|||||||
@ -77,18 +77,18 @@ $(DYNAMIC): $(OBJ)
|
|||||||
@echo [Compile] $<
|
@echo [Compile] $<
|
||||||
@$(CC) -c $(CFLAGS) $< -o $@
|
@$(CC) -c $(CFLAGS) $< -o $@
|
||||||
|
|
||||||
.PHONEY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
@echo "[Clean]"
|
@echo "[Clean]"
|
||||||
@rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.*
|
@rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.*
|
||||||
|
|
||||||
.PHONEY: tags
|
.PHONY: tags
|
||||||
tags: $(SRC)
|
tags: $(SRC)
|
||||||
@echo [ctags]
|
@echo [ctags]
|
||||||
@ctags $(SRC)
|
@ctags $(SRC)
|
||||||
|
|
||||||
|
|
||||||
.PHONEY: install-headers
|
.PHONY: install-headers
|
||||||
install-headers:
|
install-headers:
|
||||||
@echo "[Install Headers]"
|
@echo "[Install Headers]"
|
||||||
@install -m 0755 -d $(DESTDIR)$(PREFIX)/include
|
@install -m 0755 -d $(DESTDIR)$(PREFIX)/include
|
||||||
@ -116,7 +116,7 @@ install-headers:
|
|||||||
@install -m 0644 pcf8591.h $(DESTDIR)$(PREFIX)/include
|
@install -m 0644 pcf8591.h $(DESTDIR)$(PREFIX)/include
|
||||||
@install -m 0644 sn3218.h $(DESTDIR)$(PREFIX)/include
|
@install -m 0644 sn3218.h $(DESTDIR)$(PREFIX)/include
|
||||||
|
|
||||||
.PHONEY: install
|
.PHONY: install
|
||||||
install: $(DYNAMIC) install-headers
|
install: $(DYNAMIC) install-headers
|
||||||
@echo "[Install Dynamic Lib]"
|
@echo "[Install Dynamic Lib]"
|
||||||
@install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
|
@install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
|
||||||
@ -124,13 +124,13 @@ install: $(DYNAMIC) install-headers
|
|||||||
@ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
|
@ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
|
||||||
@ldconfig
|
@ldconfig
|
||||||
|
|
||||||
.PHONEY: install-static
|
.PHONY: install-static
|
||||||
install-static: $(STATIC) install-headers
|
install-static: $(STATIC) install-headers
|
||||||
@echo "[Install Static Lib]"
|
@echo "[Install Static Lib]"
|
||||||
@install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
|
@install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
|
||||||
@install -m 0755 libwiringPi.a $(DESTDIR)$(PREFIX)/lib
|
@install -m 0755 libwiringPi.a $(DESTDIR)$(PREFIX)/lib
|
||||||
|
|
||||||
.PHONEY: uninstall
|
.PHONY: uninstall
|
||||||
uninstall:
|
uninstall:
|
||||||
@echo "[UnInstall]"
|
@echo "[UnInstall]"
|
||||||
@rm -f $(DESTDIR)$(PREFIX)/include/wiringPi.h
|
@rm -f $(DESTDIR)$(PREFIX)/include/wiringPi.h
|
||||||
@ -160,7 +160,7 @@ uninstall:
|
|||||||
@ldconfig
|
@ldconfig
|
||||||
|
|
||||||
|
|
||||||
.PHONEY: depend
|
.PHONY: depend
|
||||||
depend:
|
depend:
|
||||||
makedepend -Y $(SRC) $(SRC_I2C)
|
makedepend -Y $(SRC) $(SRC_I2C)
|
||||||
|
|
||||||
|
|||||||
@ -203,13 +203,14 @@ static volatile uint32_t *timerIrqRaw ;
|
|||||||
// and PI_VERSION_X defines in wiringPi.h
|
// and PI_VERSION_X defines in wiringPi.h
|
||||||
// Only intended for the gpio command - use at your own risk!
|
// Only intended for the gpio command - use at your own risk!
|
||||||
|
|
||||||
const char *piModelNames [5] =
|
const char *piModelNames [6] =
|
||||||
{
|
{
|
||||||
"Unknown",
|
"Unknown",
|
||||||
"Model A",
|
"Model A",
|
||||||
"Model B",
|
"Model B",
|
||||||
"Model B+",
|
"Model B+",
|
||||||
"Compute Module",
|
"Compute Module",
|
||||||
|
"Model A+",
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
const char *piRevisionNames [5] =
|
const char *piRevisionNames [5] =
|
||||||
@ -620,6 +621,7 @@ int wiringPiFailure (int fatal, const char *message, ...)
|
|||||||
* 000f - Model B, Rev 2, 512MB, Qisda
|
* 000f - Model B, Rev 2, 512MB, Qisda
|
||||||
* 0010 - Model B+, Rev 1.2, 512MB, Sony
|
* 0010 - Model B+, Rev 1.2, 512MB, Sony
|
||||||
* 0011 - Pi CM, Rev 1.2, 512MB, Sony
|
* 0011 - Pi CM, Rev 1.2, 512MB, Sony
|
||||||
|
* 0012 - Model A+ Rev 1.2, 256MB, Sony
|
||||||
*
|
*
|
||||||
* A small thorn is the olde style overvolting - that will add in
|
* A small thorn is the olde style overvolting - that will add in
|
||||||
* 1000000
|
* 1000000
|
||||||
@ -687,10 +689,12 @@ int piBoardRev (void)
|
|||||||
|
|
||||||
// If you have overvolted the Pi, then it appears that the revision
|
// If you have overvolted the Pi, then it appears that the revision
|
||||||
// has 100000 added to it!
|
// has 100000 added to it!
|
||||||
|
// The actual condition for it being set is:
|
||||||
|
// (force_turbo || current_limit_override || temp_limit>85) && over_voltage>0
|
||||||
|
|
||||||
if (wiringPiDebug)
|
if (wiringPiDebug)
|
||||||
if (strlen (c) != 4)
|
if (strlen (c) != 4)
|
||||||
printf ("piboardRev: This Pi has/is overvolted!\n") ;
|
printf ("piboardRev: This Pi has/is (force_turbo || current_limit_override || temp_limit>85) && over_voltage>0\n") ;
|
||||||
|
|
||||||
// Isolate last 4 characters:
|
// Isolate last 4 characters:
|
||||||
|
|
||||||
@ -782,6 +786,7 @@ void piBoardId (int *model, int *rev, int *mem, int *maker, int *overVolted)
|
|||||||
else if (strcmp (c, "000f") == 0) { *model = PI_MODEL_B ; *rev = PI_VERSION_2 ; *mem = 512 ; *maker = PI_MAKER_EGOMAN ; }
|
else if (strcmp (c, "000f") == 0) { *model = PI_MODEL_B ; *rev = PI_VERSION_2 ; *mem = 512 ; *maker = PI_MAKER_EGOMAN ; }
|
||||||
else if (strcmp (c, "0010") == 0) { *model = PI_MODEL_BP ; *rev = PI_VERSION_1_2 ; *mem = 512 ; *maker = PI_MAKER_SONY ; }
|
else if (strcmp (c, "0010") == 0) { *model = PI_MODEL_BP ; *rev = PI_VERSION_1_2 ; *mem = 512 ; *maker = PI_MAKER_SONY ; }
|
||||||
else if (strcmp (c, "0011") == 0) { *model = PI_MODEL_CM ; *rev = PI_VERSION_1_2 ; *mem = 512 ; *maker = PI_MAKER_SONY ; }
|
else if (strcmp (c, "0011") == 0) { *model = PI_MODEL_CM ; *rev = PI_VERSION_1_2 ; *mem = 512 ; *maker = PI_MAKER_SONY ; }
|
||||||
|
else if (strcmp (c, "0012") == 0) { *model = PI_MODEL_AP ; *rev = PI_VERSION_1_2 ; *mem = 256 ; *maker = PI_MAKER_SONY ; }
|
||||||
else { *model = 0 ; *rev = 0 ; *mem = 0 ; *maker = 0 ; }
|
else { *model = 0 ; *rev = 0 ; *mem = 0 ; *maker = 0 ; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1474,8 +1479,10 @@ int waitForInterrupt (int pin, int mS)
|
|||||||
|
|
||||||
// Do a dummy read to clear the interrupt
|
// Do a dummy read to clear the interrupt
|
||||||
// A one character read appars to be enough.
|
// A one character read appars to be enough.
|
||||||
|
// Followed by a seek to reset it.
|
||||||
|
|
||||||
(void)read (fd, &c, 1) ;
|
(void)read (fd, &c, 1) ;
|
||||||
|
lseek (fd, 0, SEEK_SET) ;
|
||||||
|
|
||||||
return x ;
|
return x ;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,6 +75,7 @@
|
|||||||
#define PI_MODEL_B 2
|
#define PI_MODEL_B 2
|
||||||
#define PI_MODEL_BP 3
|
#define PI_MODEL_BP 3
|
||||||
#define PI_MODEL_CM 4
|
#define PI_MODEL_CM 4
|
||||||
|
#define PI_MODEL_AP 5
|
||||||
|
|
||||||
#define PI_VERSION_UNKNOWN 0
|
#define PI_VERSION_UNKNOWN 0
|
||||||
#define PI_VERSION_1 1
|
#define PI_VERSION_1 1
|
||||||
@ -87,7 +88,7 @@
|
|||||||
#define PI_MAKER_SONY 2
|
#define PI_MAKER_SONY 2
|
||||||
#define PI_MAKER_QISDA 3
|
#define PI_MAKER_QISDA 3
|
||||||
|
|
||||||
extern const char *piModelNames [5] ;
|
extern const char *piModelNames [6] ;
|
||||||
extern const char *piRevisionNames [5] ;
|
extern const char *piRevisionNames [5] ;
|
||||||
extern const char *piMakerNames [4] ;
|
extern const char *piMakerNames [4] ;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user