Switch to stdbool.h
- Add `#include <stdbool.h> to all files previously using the `TRUE`/`FALSE` macros - Replace all instances of `TRUE`/`FALSE` with `true`/`false`, respectively - Definitions of `TRUE`/`FALSE` macros retained in wiringPi.h for compatibility.
This commit is contained in:
@@ -7,17 +7,13 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <wiringPi.h>
|
||||
#include <piFace.h>
|
||||
|
||||
#ifndef TRUE
|
||||
# define TRUE (1==1)
|
||||
# define FALSE (1==2)
|
||||
#endif
|
||||
|
||||
#undef DEBUG
|
||||
|
||||
#define NUM_LEDS 8
|
||||
@@ -244,7 +240,7 @@ void ledOnAction (void)
|
||||
if (digitalRead (PIFACE) == LOW)
|
||||
{
|
||||
chargeCapacitor () ;
|
||||
ledBargraph (vCap, TRUE) ;
|
||||
ledBargraph (vCap, true) ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +260,7 @@ void ledOffAction (void)
|
||||
if (digitalRead (PIFACE) == LOW)
|
||||
{
|
||||
vCap = vCapLast = 0.0 ;
|
||||
ledBargraph (vCap, FALSE) ;
|
||||
ledBargraph (vCap, false) ;
|
||||
|
||||
// Wait until we release the button
|
||||
|
||||
@@ -300,7 +296,7 @@ int main (void)
|
||||
|
||||
// LED ON:
|
||||
|
||||
(void)ledBargraph (vCap, TRUE) ;
|
||||
(void)ledBargraph (vCap, true) ;
|
||||
then = millis () + ledOnTime ;
|
||||
while (millis () < then)
|
||||
{
|
||||
@@ -323,7 +319,7 @@ int main (void)
|
||||
|
||||
// LED OFF:
|
||||
|
||||
(void)ledBargraph (vCap, FALSE) ;
|
||||
(void)ledBargraph (vCap, false) ;
|
||||
then = millis () + ledOffTime ;
|
||||
while (millis () < then)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user