mirror of https://github.com/joan2937/pigpio
Adding flag to disable alerts (polling of GPIOs)
This commit is contained in:
parent
c4c8ce50c6
commit
29bbd99b0e
3
pigpio.c
3
pigpio.c
|
@ -8115,10 +8115,13 @@ int initInitialise(void)
|
||||||
if (pthread_attr_setstacksize(&pthAttr, STACK_SIZE))
|
if (pthread_attr_setstacksize(&pthAttr, STACK_SIZE))
|
||||||
SOFT_ERROR(PI_INIT_FAILED, "pthread_attr_setstacksize failed (%m)");
|
SOFT_ERROR(PI_INIT_FAILED, "pthread_attr_setstacksize failed (%m)");
|
||||||
|
|
||||||
|
if (!(gpioCfg.ifFlags & PI_DISABLE_ALERT))
|
||||||
|
{
|
||||||
if (pthread_create(&pthAlert, &pthAttr, pthAlertThread, &i))
|
if (pthread_create(&pthAlert, &pthAttr, pthAlertThread, &i))
|
||||||
SOFT_ERROR(PI_INIT_FAILED, "pthread_create alert failed (%m)");
|
SOFT_ERROR(PI_INIT_FAILED, "pthread_create alert failed (%m)");
|
||||||
|
|
||||||
pthAlertRunning = 1;
|
pthAlertRunning = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(gpioCfg.ifFlags & PI_DISABLE_FIFO_IF))
|
if (!(gpioCfg.ifFlags & PI_DISABLE_FIFO_IF))
|
||||||
{
|
{
|
||||||
|
|
1
pigpio.h
1
pigpio.h
|
@ -846,6 +846,7 @@ typedef void *(gpioThreadFunc_t) (void *);
|
||||||
#define PI_DISABLE_FIFO_IF 1
|
#define PI_DISABLE_FIFO_IF 1
|
||||||
#define PI_DISABLE_SOCK_IF 2
|
#define PI_DISABLE_SOCK_IF 2
|
||||||
#define PI_LOCALHOST_SOCK_IF 4
|
#define PI_LOCALHOST_SOCK_IF 4
|
||||||
|
#define PI_DISABLE_ALERT 8
|
||||||
|
|
||||||
/* memAllocMode */
|
/* memAllocMode */
|
||||||
|
|
||||||
|
|
|
@ -217,6 +217,10 @@ static void initOpts(int argc, char *argv[])
|
||||||
ifFlags |= PI_LOCALHOST_SOCK_IF;
|
ifFlags |= PI_LOCALHOST_SOCK_IF;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'm':
|
||||||
|
ifFlags |= PI_DISABLE_ALERT;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
addr = checkAddr(optarg);
|
addr = checkAddr(optarg);
|
||||||
if (addr && (numSockNetAddr<MAX_CONNECT_ADDRESSES))
|
if (addr && (numSockNetAddr<MAX_CONNECT_ADDRESSES))
|
||||||
|
|
Loading…
Reference in New Issue