diff options
author | Peter Michael Green <plugwash@debian.org> | 2021-01-28 19:07:37 +0000 |
---|---|---|
committer | Peter Michael Green <plugwash@debian.org> | 2021-01-28 19:07:37 +0000 |
commit | b13be442cbed5e73aac1158e488a87aefb38d03f (patch) | |
tree | d57d605144790b1e1a93231b9826d403da31726c /x_pigpio.c | |
parent | edb6ffdb45648a882874a0dbad38f591b1c1f9ea (diff) | |
parent | cc17196c7586c3625ac8adf8f34838d320ffeda6 (diff) |
Merge tag 'v78' of https://github.com/joan2937/pigpio into debian
Diffstat (limited to 'x_pigpio.c')
-rw-r--r-- | x_pigpio.c | 47 |
1 files changed, 47 insertions, 0 deletions
@@ -63,10 +63,12 @@ void t1() CHECK(1, 1, v, 0, 0, "set mode, get mode"); gpioSetPullUpDown(GPIO, PI_PUD_UP); + gpioDelay(1); /* 1 micro delay to let GPIO reach level reliably */ v = gpioRead(GPIO); CHECK(1, 2, v, 1, 0, "set pull up down, read"); gpioSetPullUpDown(GPIO, PI_PUD_DOWN); + gpioDelay(1); /* 1 micro delay to let GPIO reach level reliably */ v = gpioRead(GPIO); CHECK(1, 3, v, 0, 0, "set pull up down, read"); @@ -457,6 +459,51 @@ To the lascivious pleasing of a lute.\n\ c = gpioWaveGetMaxCbs(); CHECK(5, 21, c, 25016, 0, "wave get max cbs"); + + /* waveCreatePad tests */ + gpioWaveTxStop(); + gpioWaveClear(); + gpioSetAlertFunc(GPIO, t5cbf); + + e = gpioWaveAddGeneric(2, (gpioPulse_t[]) + { {1<<GPIO, 0, 10000}, + {0, 1<<GPIO, 30000} + }); + wid = gpioWaveCreatePad(50, 50, 0); + CHECK(5, 22, wid, 0, 0, "wave create pad, count==1, wid=="); + + e = gpioWaveAddGeneric(4, (gpioPulse_t[]) + { {1<<GPIO, 0, 10000}, + {0, 1<<GPIO, 30000}, + {1<<GPIO, 0, 60000}, + {0, 1<<GPIO, 100000} + }); + wid = gpioWaveCreatePad(50, 50, 0); + CHECK(5, 23, wid, 1, 0, "wave create pad, count==2, wid=="); + + c = gpioWaveDelete(0); + CHECK(5, 24, c, 0, 0, "delete wid==0 success"); + + e = gpioWaveAddGeneric(6, (gpioPulse_t[]) + { {1<<GPIO, 0, 10000}, + {0, 1<<GPIO, 30000}, + {1<<GPIO, 0, 60000}, + {0, 1<<GPIO, 100000}, + {1<<GPIO, 0, 60000}, + {0, 1<<GPIO, 100000} + }); + c = gpioWaveCreate(); + CHECK(5, 25, c, -67, 0, "No more CBs using wave create"); + wid = gpioWaveCreatePad(50, 50, 0); + CHECK(5, 26, wid, 0, 0, "wave create pad, count==3, wid=="); + + t5_count = 0; + e = gpioWaveChain((char[]) {1,0}, 2); + CHECK(5, 27, e, 0, 0, "wave chain [1,0]"); + while (gpioWaveTxBusy()) time_sleep(0.1); + CHECK(5, 28, t5_count, 5, 1, "callback count=="); + + gpioSetAlertFunc(GPIO, NULL); } int t6_count; |