This commit is contained in:
joan 2016-04-25 09:58:51 +01:00
parent bbb7affbfe
commit 51cd543d97
3 changed files with 125 additions and 26 deletions

View File

@ -157,14 +157,35 @@ All the functions which return an int return < 0 on error.
.br .br
.br .br
If the library is not initialised all but the \fBgpioCfg*\fP, \fBgpioVersion\fP, \fBgpioInitialise\fP must be called before all other library functions
and \fBgpioHardwareRevision\fP functions will return PI_NOT_INITIALISED. with the following exceptions:
.br .br
.br .br
If the library is initialised the \fBgpioCfg*\fP functions will
return PI_INITIALISED. .EX
\fBgpioCfg*\fP
.br
\fBgpioVersion\fP
.br
\fBgpioHardwareRevision\fP
.br
.EE
.br
.br
If the library is not initialised all but the \fBgpioCfg*\fP,
\fBgpioVersion\fP, and \fBgpioHardwareRevision\fP functions will
return error PI_NOT_INITIALISED.
.br
.br
If the library is initialised the \fBgpioCfg*\fP functions will return
error PI_INITIALISED.
.br .br
@ -177,18 +198,28 @@ Initialises the library.
.br .br
.br
Call before using the other library functions.
.br
.br .br
Returns the pigpio version number if OK, otherwise PI_INIT_FAILED. Returns the pigpio version number if OK, otherwise PI_INIT_FAILED.
.br .br
.br .br
The only exception is the optional \fBgpioCfg*\fP functions, see later. gpioInitialise must be called before using the other library functions
with the following exceptions:
.br
.br
.EX
\fBgpioCfg*\fP
.br
\fBgpioVersion\fP
.br
\fBgpioHardwareRevision\fP
.br
.EE
.br .br
@ -5109,6 +5140,11 @@ Configures pigpio to buffer cfgMillis milliseconds of GPIO samples.
.br .br
.br
This function is only effective if called before \fBgpioInitialise\fP.
.br
.br .br
.EX .EX
@ -5172,6 +5208,11 @@ peripheral.
.br .br
.br
This function is only effective if called before \fBgpioInitialise\fP.
.br
.br .br
.EX .EX
@ -5236,6 +5277,11 @@ Configures pigpio to use the specified DMA channel.
.br .br
.br
This function is only effective if called before \fBgpioInitialise\fP.
.br
.br .br
.EX .EX
@ -5255,6 +5301,11 @@ Configures pigpio to use the specified DMA channels.
.br .br
.br
This function is only effective if called before \fBgpioInitialise\fP.
.br
.br .br
.EX .EX
@ -5298,6 +5349,11 @@ GPIO specified by the mask.
.br .br
.br
This function is only effective if called before \fBgpioInitialise\fP.
.br
.br .br
.EX .EX
@ -5341,6 +5397,11 @@ Configures pigpio to use the specified socket port.
.br .br
.br
This function is only effective if called before \fBgpioInitialise\fP.
.br
.br .br
.EX .EX
@ -5360,6 +5421,11 @@ Configures pigpio support of the fifo and socket interfaces.
.br .br
.br
This function is only effective if called before \fBgpioInitialise\fP.
.br
.br .br
.EX .EX
@ -5396,6 +5462,11 @@ Selects the method of DMA memory allocation.
.br .br
.br
This function is only effective if called before \fBgpioInitialise\fP.
.br
.br .br
.EX .EX
@ -6306,7 +6377,7 @@ typedef void (*gpioAlertFuncEx_t)
.br .br
.br .br
One of These functions are only effective if called before \fBgpioInitialise\fP.
.br .br
@ -6323,8 +6394,6 @@ One of
.br .br
\fBgpioCfgInterfaces\fP \fBgpioCfgInterfaces\fP
.br .br
\fBgpioCfgInternals\fP
.br
\fBgpioCfgSocketPort\fP \fBgpioCfgSocketPort\fP
.br .br
\fBgpioCfgMemAlloc\fP \fBgpioCfgMemAlloc\fP

View File

@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/> For more information, please refer to <http://unlicense.org/>
*/ */
/* pigpio version 50 */ /* pigpio version 51 */
/* include ------------------------------------------------------- */ /* include ------------------------------------------------------- */
@ -7572,6 +7572,8 @@ int initInitialise(void)
else if (rev < 16) gpioMask = PI_DEFAULT_UPDATE_MASK_A_B2; else if (rev < 16) gpioMask = PI_DEFAULT_UPDATE_MASK_A_B2;
else if (rev == 17) gpioMask = PI_DEFAULT_UPDATE_MASK_COMPUTE; else if (rev == 17) gpioMask = PI_DEFAULT_UPDATE_MASK_COMPUTE;
else if (rev < 20) gpioMask = PI_DEFAULT_UPDATE_MASK_APLUS_BPLUS; else if (rev < 20) gpioMask = PI_DEFAULT_UPDATE_MASK_APLUS_BPLUS;
else if (rev == 20) gpioMask = PI_DEFAULT_UPDATE_MASK_COMPUTE;
else if (rev == 21) gpioMask = PI_DEFAULT_UPDATE_MASK_APLUS_BPLUS;
else else
{ {
model = (rev >> 4) & 0xFF; model = (rev >> 4) & 0xFF;
@ -11873,4 +11875,3 @@ int gpioCfgInternals(unsigned cfgWhat, unsigned cfgVal)
#include "custom.cext" #include "custom.cext"

View File

@ -31,7 +31,7 @@ For more information, please refer to <http://unlicense.org/>
#include <stdint.h> #include <stdint.h>
#include <pthread.h> #include <pthread.h>
#define PIGPIO_VERSION 50 #define PIGPIO_VERSION 51
/*TEXT /*TEXT
@ -93,11 +93,21 @@ For examples of usage see the C programs within the pigpio archive file.
All the functions which return an int return < 0 on error. All the functions which return an int return < 0 on error.
If the library is not initialised all but the [*gpioCfg**], [*gpioVersion*], [*gpioInitialise*] must be called before all other library functions
and [*gpioHardwareRevision*] functions will return PI_NOT_INITIALISED. with the following exceptions:
If the library is initialised the [*gpioCfg**] functions will . .
return PI_INITIALISED. [*gpioCfg**]
[*gpioVersion*]
[*gpioHardwareRevision*]
. .
If the library is not initialised all but the [*gpioCfg**],
[*gpioVersion*], and [*gpioHardwareRevision*] functions will
return error PI_NOT_INITIALISED.
If the library is initialised the [*gpioCfg**] functions will return
error PI_INITIALISED.
TEXT*/ TEXT*/
@ -294,7 +304,6 @@ gpioCfgSocketPort Configure socket port
gpioCfgMemAlloc Configure DMA memory allocation mode gpioCfgMemAlloc Configure DMA memory allocation mode
gpioCfgInternals Configure miscellaneous internals (DEPRECATED) gpioCfgInternals Configure miscellaneous internals (DEPRECATED)
gpioCfgGetInternals Get internal configuration settings gpioCfgGetInternals Get internal configuration settings
gpioCfgSetInternals Set internal configuration settings gpioCfgSetInternals Set internal configuration settings
@ -770,11 +779,16 @@ int gpioInitialise(void);
/*D /*D
Initialises the library. Initialises the library.
Call before using the other library functions.
Returns the pigpio version number if OK, otherwise PI_INIT_FAILED. Returns the pigpio version number if OK, otherwise PI_INIT_FAILED.
The only exception is the optional [*gpioCfg**] functions, see later. gpioInitialise must be called before using the other library functions
with the following exceptions:
. .
[*gpioCfg**]
[*gpioVersion*]
[*gpioHardwareRevision*]
. .
... ...
if (gpioInitialise() < 0) if (gpioInitialise() < 0)
@ -3618,6 +3632,8 @@ int gpioCfgBufferSize(unsigned cfgMillis);
/*D /*D
Configures pigpio to buffer cfgMillis milliseconds of GPIO samples. Configures pigpio to buffer cfgMillis milliseconds of GPIO samples.
This function is only effective if called before [*gpioInitialise*].
. . . .
cfgMillis: 100-10000 cfgMillis: 100-10000
. . . .
@ -3653,6 +3669,8 @@ int gpioCfgClock(
Configures pigpio to use a particular sample rate timed by a specified Configures pigpio to use a particular sample rate timed by a specified
peripheral. peripheral.
This function is only effective if called before [*gpioInitialise*].
. . . .
cfgMicros: 1, 2, 4, 5, 8, 10 cfgMicros: 1, 2, 4, 5, 8, 10
cfgPeripheral: 0 (PWM), 1 (PCM) cfgPeripheral: 0 (PWM), 1 (PCM)
@ -3686,6 +3704,8 @@ int gpioCfgDMAchannel(unsigned DMAchannel); /* DEPRECATED */
/*D /*D
Configures pigpio to use the specified DMA channel. Configures pigpio to use the specified DMA channel.
This function is only effective if called before [*gpioInitialise*].
. . . .
DMAchannel: 0-14 DMAchannel: 0-14
. . . .
@ -3700,6 +3720,8 @@ int gpioCfgDMAchannels(
/*D /*D
Configures pigpio to use the specified DMA channels. Configures pigpio to use the specified DMA channels.
This function is only effective if called before [*gpioInitialise*].
. . . .
primaryChannel: 0-14 primaryChannel: 0-14
secondaryChannel: 0-14 secondaryChannel: 0-14
@ -3727,6 +3749,8 @@ int gpioCfgPermissions(uint64_t updateMask);
Configures pigpio to only allow updates (writes or mode changes) for the Configures pigpio to only allow updates (writes or mode changes) for the
GPIO specified by the mask. GPIO specified by the mask.
This function is only effective if called before [*gpioInitialise*].
. . . .
updateMask: bit (1<<n) is set for each GPIO n which may be updated updateMask: bit (1<<n) is set for each GPIO n which may be updated
. . . .
@ -3748,6 +3772,8 @@ int gpioCfgSocketPort(unsigned port);
/*D /*D
Configures pigpio to use the specified socket port. Configures pigpio to use the specified socket port.
This function is only effective if called before [*gpioInitialise*].
. . . .
port: 1024-32000 port: 1024-32000
. . . .
@ -3761,6 +3787,8 @@ int gpioCfgInterfaces(unsigned ifFlags);
/*D /*D
Configures pigpio support of the fifo and socket interfaces. Configures pigpio support of the fifo and socket interfaces.
This function is only effective if called before [*gpioInitialise*].
. . . .
ifFlags: 0-7 ifFlags: 0-7
. . . .
@ -3782,6 +3810,8 @@ int gpioCfgMemAlloc(unsigned memAllocMode);
/*D /*D
Selects the method of DMA memory allocation. Selects the method of DMA memory allocation.
This function is only effective if called before [*gpioInitialise*].
. . . .
memAllocMode: 0-2 memAllocMode: 0-2
. . . .
@ -4280,7 +4310,7 @@ typedef void (*gpioAlertFuncEx_t)
gpioCfg*:: gpioCfg*::
One of These functions are only effective if called before [*gpioInitialise*].
[*gpioCfgBufferSize*] [*gpioCfgBufferSize*]
[*gpioCfgClock*] [*gpioCfgClock*]
@ -4288,7 +4318,6 @@ One of
[*gpioCfgDMAchannels*] [*gpioCfgDMAchannels*]
[*gpioCfgPermissions*] [*gpioCfgPermissions*]
[*gpioCfgInterfaces*] [*gpioCfgInterfaces*]
[*gpioCfgInternals*]
[*gpioCfgSocketPort*] [*gpioCfgSocketPort*]
[*gpioCfgMemAlloc*] [*gpioCfgMemAlloc*]