Updating for various stuff and bugs. CM3+ and PiA3+
This commit is contained in:
parent
8d188fa0e0
commit
36fb7f187f
|
@ -1,5 +1,5 @@
|
|||
Package: wiringpi
|
||||
Version: 2.46
|
||||
Version: 2.50
|
||||
Section: libraries
|
||||
Priority: optional
|
||||
Architecture: armhf
|
||||
|
|
|
@ -36,7 +36,6 @@ DYNAMIC=libwiringPiDev.so.$(VERSION)
|
|||
|
||||
#DEBUG = -g -O0
|
||||
DEBUG = -O2
|
||||
CC = gcc
|
||||
INCLUDE = -I.
|
||||
DEFS = -D_GNU_SOURCE
|
||||
CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
|
||||
|
|
|
@ -28,7 +28,6 @@ endif
|
|||
|
||||
#DEBUG = -g -O0
|
||||
DEBUG = -O3
|
||||
CC = gcc
|
||||
INCLUDE = -I/usr/local/include
|
||||
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ endif
|
|||
|
||||
#DEBUG = -g -O0
|
||||
DEBUG = -O2
|
||||
CC = gcc
|
||||
INCLUDE = -I$(DESTDIR)$(PREFIX)/include
|
||||
CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe
|
||||
|
||||
|
|
|
@ -303,10 +303,12 @@ static void plus2header (int model)
|
|||
printf (" +-----+-----+---------+------+---+-Pi ZeroW-+---+------+---------+-----+-----+\n") ;
|
||||
else if (model == PI_MODEL_2)
|
||||
printf (" +-----+-----+---------+------+---+---Pi 2---+---+------+---------+-----+-----+\n") ;
|
||||
else if (model == PI_MODEL_3)
|
||||
printf (" +-----+-----+---------+------+---+---Pi 3---+---+------+---------+-----+-----+\n") ;
|
||||
else if (model == PI_MODEL_3P)
|
||||
printf (" +-----+-----+---------+------+---+---Pi 3+--+---+------+---------+-----+-----+\n") ;
|
||||
else if (model == PI_MODEL_3B)
|
||||
printf (" +-----+-----+---------+------+---+---Pi 3B--+---+------+---------+-----+-----+\n") ;
|
||||
else if (model == PI_MODEL_3BP)
|
||||
printf (" +-----+-----+---------+------+---+---Pi 3B+-+---+------+---------+-----+-----+\n") ;
|
||||
else if (model == PI_MODEL_3AP)
|
||||
printf (" +-----+-----+---------+------+---+---Pi 3A+-+---+------+---------+-----+-----+\n") ;
|
||||
else
|
||||
printf (" +-----+-----+---------+------+---+---Pi ?---+---+------+---------+-----+-----+\n") ;
|
||||
}
|
||||
|
@ -351,11 +353,12 @@ void doReadall (void)
|
|||
/**/ if ((model == PI_MODEL_A) || (model == PI_MODEL_B))
|
||||
abReadall (model, rev) ;
|
||||
else if ((model == PI_MODEL_BP) || (model == PI_MODEL_AP) ||
|
||||
(model == PI_MODEL_2) ||
|
||||
(model == PI_MODEL_3) || (model == PI_MODEL_3P) ||
|
||||
(model == PI_MODEL_2) ||
|
||||
(model == PI_MODEL_3AP) ||
|
||||
(model == PI_MODEL_3B) || (model == PI_MODEL_3BP) ||
|
||||
(model == PI_MODEL_ZERO) || (model == PI_MODEL_ZERO_W))
|
||||
piPlusReadall (model) ;
|
||||
else if ((model == PI_MODEL_CM) || (model == PI_MODEL_CM3))
|
||||
else if ((model == PI_MODEL_CM) || (model == PI_MODEL_CM3) || ((model == PI_MODEL_CM3P)))
|
||||
allReadall () ;
|
||||
else
|
||||
printf ("Oops - unable to determine board type... model: %d\n", model) ;
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#define VERSION "2.46"
|
||||
#define VERSION "2.50"
|
||||
#define VERSION_MAJOR 2
|
||||
#define VERSION_MINOR 46
|
||||
#define VERSION_MINOR 50
|
||||
|
|
|
@ -36,7 +36,6 @@ DYNAMIC=libwiringPi.so.$(VERSION)
|
|||
|
||||
#DEBUG = -g -O0
|
||||
DEBUG = -O2
|
||||
CC = gcc
|
||||
INCLUDE = -I.
|
||||
DEFS = -D_GNU_SOURCE
|
||||
CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline $(INCLUDE) -pipe -fPIC
|
||||
|
|
|
@ -218,7 +218,7 @@ volatile unsigned int *_wiringPiTimerIrqRaw ;
|
|||
|
||||
static volatile unsigned int piGpioBase = 0 ;
|
||||
|
||||
const char *piModelNames [16] =
|
||||
const char *piModelNames [20] =
|
||||
{
|
||||
"Model A", // 0
|
||||
"Model B", // 1
|
||||
|
@ -233,9 +233,13 @@ const char *piModelNames [16] =
|
|||
"CM3", // 10
|
||||
"Unknown11", // 11
|
||||
"Pi Zero-W", // 12
|
||||
"Pi 3+", // 13
|
||||
"Unknown14", // 14
|
||||
"Pi 3B+", // 13
|
||||
"Pi 3A+", // 14
|
||||
"Unknown15", // 15
|
||||
"CM3+", // 16
|
||||
"Unknown17", // 17
|
||||
"Unknown18", // 18
|
||||
"Unknown19", // 19
|
||||
} ;
|
||||
|
||||
const char *piRevisionNames [16] =
|
||||
|
@ -2239,7 +2243,7 @@ int wiringPiSetup (void)
|
|||
|
||||
piBoardId (&model, &rev, &mem, &maker, &overVolted) ;
|
||||
|
||||
if ((model == PI_MODEL_CM) || (model == PI_MODEL_CM3))
|
||||
if ((model == PI_MODEL_CM) || (model == PI_MODEL_CM3) || (model == PI_MODEL_CM3P))
|
||||
wiringPiMode = WPI_MODE_GPIO ;
|
||||
else
|
||||
wiringPiMode = WPI_MODE_PINS ;
|
||||
|
|
|
@ -95,11 +95,13 @@
|
|||
#define PI_ALPHA 5
|
||||
#define PI_MODEL_CM 6
|
||||
#define PI_MODEL_07 7
|
||||
#define PI_MODEL_3 8
|
||||
#define PI_MODEL_3B 8
|
||||
#define PI_MODEL_ZERO 9
|
||||
#define PI_MODEL_CM3 10
|
||||
#define PI_MODEL_ZERO_W 12
|
||||
#define PI_MODEL_3P 13
|
||||
#define PI_MODEL_3BP 13
|
||||
#define PI_MODEL_3AP 14
|
||||
#define PI_MODEL_CM3P 16
|
||||
|
||||
#define PI_VERSION_1 0
|
||||
#define PI_VERSION_1_1 1
|
||||
|
@ -111,7 +113,7 @@
|
|||
#define PI_MAKER_EMBEST 2
|
||||
#define PI_MAKER_UNKNOWN 3
|
||||
|
||||
extern const char *piModelNames [16] ;
|
||||
extern const char *piModelNames [20] ;
|
||||
extern const char *piRevisionNames [16] ;
|
||||
extern const char *piMakerNames [16] ;
|
||||
extern const int piMemorySize [ 8] ;
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
@ -39,8 +41,8 @@
|
|||
// The SPI bus parameters
|
||||
// Variables as they need to be passed as pointers later on
|
||||
|
||||
static const char *spiDev0 = "/dev/spidev0.0" ;
|
||||
static const char *spiDev1 = "/dev/spidev0.1" ;
|
||||
//static const char *spiDev0 = "/dev/spidev0.0" ;
|
||||
//static const char *spiDev1 = "/dev/spidev0.1" ;
|
||||
static const uint8_t spiBPW = 8 ;
|
||||
static const uint16_t spiDelay = 0 ;
|
||||
|
||||
|
@ -100,11 +102,16 @@ int wiringPiSPIDataRW (int channel, unsigned char *data, int len)
|
|||
int wiringPiSPISetupMode (int channel, int speed, int mode)
|
||||
{
|
||||
int fd ;
|
||||
char spiDev [32] ;
|
||||
|
||||
mode &= 3 ; // Mode is 0, 1, 2 or 3
|
||||
channel &= 1 ; // Channel is 0 or 1
|
||||
|
||||
if ((fd = open (channel == 0 ? spiDev0 : spiDev1, O_RDWR)) < 0)
|
||||
// Channel can be anything - lets hope for the best
|
||||
// channel &= 1 ; // Channel is 0 or 1
|
||||
|
||||
snprintf (spiDev, 31, "/dev/spidev0.%d", channel) ;
|
||||
|
||||
if ((fd = open (spiDev, O_RDWR)) < 0)
|
||||
return wiringPiFailure (WPI_ALMOST, "Unable to open SPI device: %s\n", strerror (errno)) ;
|
||||
|
||||
spiSpeeds [channel] = speed ;
|
||||
|
|
|
@ -31,7 +31,6 @@ endif
|
|||
|
||||
#DEBUG = -g -O0
|
||||
DEBUG = -O2
|
||||
CC = gcc
|
||||
INCLUDE = -I$(DESTDIR)$(PREFIX)/include
|
||||
CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe
|
||||
|
||||
|
|
Loading…
Reference in New Issue