Browse Source

Sync with changes from wiringpi_2.50.orig.tar.gz

Sourced from http://archive.ubuntu.com/ubuntu/pool/universe/w/wiringpi/wiringpi_2.50.orig.tar.gz
pull/69/head
Steve Baker 4 years ago
parent
commit
03204c3807
6 changed files with 37 additions and 21 deletions
  1. +1
    -1
      VERSION
  2. +10
    -7
      gpio/readall.c
  3. +2
    -2
      version.h
  4. +8
    -4
      wiringPi/wiringPi.c
  5. +5
    -3
      wiringPi/wiringPi.h
  6. +11
    -4
      wiringPi/wiringPiSPI.c

+ 1
- 1
VERSION View File

@@ -1 +1 @@
2.46
2.50

+ 10
- 7
gpio/readall.c View File

@@ -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) ;


+ 2
- 2
version.h View File

@@ -1,3 +1,3 @@
#define VERSION "2.46"
#define VERSION "2.50"
#define VERSION_MAJOR 2
#define VERSION_MINOR 46
#define VERSION_MINOR 50

+ 8
- 4
wiringPi/wiringPi.c View File

@@ -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 ;


+ 5
- 3
wiringPi/wiringPi.h View File

@@ -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] ;


+ 11
- 4
wiringPi/wiringPiSPI.c View File

@@ -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 ;


Loading…
Cancel
Save