New pulse per second example synced to wall time.
authorjoan2937 <joan@abyz.me.uk>
Sun, 16 Aug 2020 20:27:04 +0000 (21:27 +0100)
committerjoan2937 <joan@abyz.me.uk>
Sun, 16 Aug 2020 20:27:04 +0000 (21:27 +0100)
DOC/dbase/pigpio.sqlite
DOC/src/defs/examples.def
pigpio.c

index c20cbe090d34969f2b040eb9589c6e89e524fba0..f24fd30acb732b2cd3b9676e570ebb7a00e94642 100644 (file)
Binary files a/DOC/dbase/pigpio.sqlite and b/DOC/dbase/pigpio.sqlite differ
index 5a54f9221f78cbe97fc42134019c1f33ab04dcb8..637a82b4e49f7e6c3daca5b5dc39e5baab8920d2 100644 (file)
@@ -52,7 +52,7 @@ Examples of C pigpio programs.
 
 If your program is called foobar.c then build with
 
-gcc -Wall -pthread -o foobar foobar.c -lpigpio -lrt
+gcc -Wall -o foobar foobar.c -lpigpio
 
 ?3|freq_count_1|2014-08-20|Frequency Counter 1
 A program showing how to use the <a href="cif.html#gpioSetAlertFunc">gpioSetAlertFunc</a> function to set a callback for GPIO state changes.  A frequency count is generated for each monitored GPIO (frequencies up to 500kHz with a sample rate of 1&mu;s).
@@ -75,6 +75,9 @@ A program to display readings from the (I2C) PCF8591.
 ?3|pot_cap_charge_c|2014-03-14|Pot + Capacitor Recharge Timing
 Function to time capacitor charging (through a resistance).  The time can be used to estimate the resistance.
 
+?3|pps_c|2020-07-28|Pulse Per Second generator
+A program to generate a pulse on a GPIO every x seconds (1<=x<=60).  The pulse is synced with the wall time second boundary.
+
 ?3|rotary_encoder_c|2015-10-03|Rotary Encoder
 Function to decode a mechanical rotary encoder.
 
index 491c40d31a3b4f8a6fa2214b1505b9cbdb3ff75b..8fd91cfb881305e6028cbab9841e0d1a155fff6b 100644 (file)
--- a/pigpio.c
+++ b/pigpio.c
@@ -13221,6 +13221,8 @@ int fileApprove(char *filename)
    buffer[0] = 0;
    match[0] = 0;
 
+   if (myPathBad(filename)) return PI_FILE_NONE;
+
    f = fopen("/opt/pigpio/access", "r");
 
    if (!f) return PI_FILE_NONE;