mirror of https://github.com/joan2937/pigpio
Merge branch 'TheRaspyDev-master'
This commit is contained in:
commit
ec62750c36
|
@ -442,7 +442,7 @@ static errInfo_t errInfo[]=
|
|||
{PI_BAD_PATHNAME , "can't open pathname"},
|
||||
{PI_NO_HANDLE , "no handle available"},
|
||||
{PI_BAD_HANDLE , "unknown handle"},
|
||||
{PI_BAD_IF_FLAGS , "ifFlags > 3"},
|
||||
{PI_BAD_IF_FLAGS , "ifFlags > 4"},
|
||||
{PI_BAD_CHANNEL , "DMA channel not 0-14"},
|
||||
{PI_BAD_SOCKET_PORT , "socket port not 1024-30000"},
|
||||
{PI_BAD_FIFO_COMMAND , "unknown fifo command"},
|
||||
|
|
2
pigpio.3
2
pigpio.3
|
@ -9907,7 +9907,7 @@ A 16-bit word value.
|
|||
.br
|
||||
#define PI_BAD_HANDLE -25 // unknown handle
|
||||
.br
|
||||
#define PI_BAD_IF_FLAGS -26 // ifFlags > 3
|
||||
#define PI_BAD_IF_FLAGS -26 // ifFlags > 4
|
||||
.br
|
||||
#define PI_BAD_CHANNEL -27 // DMA channel not 0-14
|
||||
.br
|
||||
|
|
22
pigpio.c
22
pigpio.c
|
@ -6292,7 +6292,10 @@ static void * pthAlertThread(void *x)
|
|||
{
|
||||
stickInited = 1;
|
||||
numSamples = 0;
|
||||
pthAlertRunning = PI_THREAD_RUNNING;
|
||||
if (!(gpioCfg.ifFlags & PI_DISABLE_ALERT))
|
||||
{
|
||||
pthAlertRunning = PI_THREAD_RUNNING;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8140,10 +8143,13 @@ int initInitialise(void)
|
|||
if (pthread_attr_setstacksize(&pthAttr, STACK_SIZE))
|
||||
SOFT_ERROR(PI_INIT_FAILED, "pthread_attr_setstacksize failed (%m)");
|
||||
|
||||
if (pthread_create(&pthAlert, &pthAttr, pthAlertThread, &i))
|
||||
SOFT_ERROR(PI_INIT_FAILED, "pthread_create alert failed (%m)");
|
||||
if (!(gpioCfg.ifFlags & PI_DISABLE_ALERT))
|
||||
{
|
||||
if (pthread_create(&pthAlert, &pthAttr, pthAlertThread, &i))
|
||||
SOFT_ERROR(PI_INIT_FAILED, "pthread_create alert failed (%m)");
|
||||
|
||||
pthAlertRunning = PI_THREAD_STARTED;
|
||||
pthAlertRunning = PI_THREAD_STARTED;
|
||||
}
|
||||
|
||||
if (!(gpioCfg.ifFlags & PI_DISABLE_FIFO_IF))
|
||||
{
|
||||
|
@ -8471,7 +8477,11 @@ int gpioInitialise(void)
|
|||
|
||||
runState = PI_RUNNING;
|
||||
|
||||
while (pthAlertRunning != PI_THREAD_RUNNING) myGpioDelay(1000);
|
||||
if (!(gpioCfg.ifFlags & PI_DISABLE_ALERT))
|
||||
{
|
||||
while (pthAlertRunning != PI_THREAD_RUNNING) myGpioDelay(1000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return status;
|
||||
|
@ -13377,7 +13387,7 @@ int gpioCfgInterfaces(unsigned ifFlags)
|
|||
|
||||
CHECK_NOT_INITED;
|
||||
|
||||
if (ifFlags > 7)
|
||||
if (ifFlags > 15)
|
||||
SOFT_ERROR(PI_BAD_IF_FLAGS, "bad ifFlags (%X)", ifFlags);
|
||||
|
||||
gpioCfg.ifFlags = ifFlags;
|
||||
|
|
3
pigpio.h
3
pigpio.h
|
@ -846,6 +846,7 @@ typedef void *(gpioThreadFunc_t) (void *);
|
|||
#define PI_DISABLE_FIFO_IF 1
|
||||
#define PI_DISABLE_SOCK_IF 2
|
||||
#define PI_LOCALHOST_SOCK_IF 4
|
||||
#define PI_DISABLE_ALERT 8
|
||||
|
||||
/* memAllocMode */
|
||||
|
||||
|
@ -6196,7 +6197,7 @@ after this command is issued.
|
|||
#define PI_BAD_PATHNAME -23 // can't open pathname
|
||||
#define PI_NO_HANDLE -24 // no handle available
|
||||
#define PI_BAD_HANDLE -25 // unknown handle
|
||||
#define PI_BAD_IF_FLAGS -26 // ifFlags > 3
|
||||
#define PI_BAD_IF_FLAGS -26 // ifFlags > 4
|
||||
#define PI_BAD_CHANNEL -27 // DMA channel not 0-14
|
||||
#define PI_BAD_PRIM_CHANNEL -27 // DMA primary channel not 0-14
|
||||
#define PI_BAD_SOCKET_PORT -28 // socket port not 1024-32000
|
||||
|
|
|
@ -714,7 +714,7 @@ _errors=[
|
|||
[_PI_BAD_PATHNAME , "can't open pathname"],
|
||||
[PI_NO_HANDLE , "no handle available"],
|
||||
[PI_BAD_HANDLE , "unknown handle"],
|
||||
[_PI_BAD_IF_FLAGS , "ifFlags > 3"],
|
||||
[_PI_BAD_IF_FLAGS , "ifFlags > 4"],
|
||||
[_PI_BAD_CHANNEL , "DMA channel not 0-14"],
|
||||
[_PI_BAD_SOCKET_PORT , "socket port not 1024-30000"],
|
||||
[_PI_BAD_FIFO_COMMAND , "unknown fifo command"],
|
||||
|
|
|
@ -103,6 +103,7 @@ void usage()
|
|||
" -k, disable socket interface, default enabled\n" \
|
||||
" -l, localhost socket only default local+remote\n" \
|
||||
" -n IP addr, allow address, name or dotted, default allow all\n" \
|
||||
" -m, disable alerts default enabled\n" \
|
||||
" -p value, socket port, 1024-32000, default 8888\n" \
|
||||
" -s value, sample rate, 1, 2, 4, 5, 8, or 10, default 5\n" \
|
||||
" -t value, clock peripheral, 0=PWM 1=PCM, default PCM\n" \
|
||||
|
@ -162,7 +163,7 @@ static void initOpts(int argc, char *argv[])
|
|||
uint32_t addr;
|
||||
int64_t mask;
|
||||
|
||||
while ((opt = getopt(argc, argv, "a:b:c:d:e:fgkln:p:s:t:x:vV")) != -1)
|
||||
while ((opt = getopt(argc, argv, "a:b:c:d:e:fgkln:mp:s:t:x:vV")) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
|
@ -217,6 +218,10 @@ static void initOpts(int argc, char *argv[])
|
|||
ifFlags |= PI_LOCALHOST_SOCK_IF;
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
ifFlags |= PI_DISABLE_ALERT;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
addr = checkAddr(optarg);
|
||||
if (addr && (numSockNetAddr<MAX_CONNECT_ADDRESSES))
|
||||
|
|
Loading…
Reference in New Issue