For more information, please refer to <http://unlicense.org/>
*/
-/* pigpio version 14 */
+/* pigpio version 15 */
#include <stdio.h>
#include <string.h>
static uint64_t gpioMask;
-static gpioWave_t wf[3][PI_WAVE_MAX_PULSES];
+static rawWave_t wf[3][PI_WAVE_MAX_PULSES];
static int wfc[3]={0, 0, 0};
case PI_CMD_HWVER: res = gpioHardwareRevision(); break;
case PI_CMD_MICS:
+ DBG(0,"mics %d", p[1]);
if (p[1] <= PI_MAX_MICS_DELAY) myGpioDelay(p[1]);
else res = PI_BAD_MICS_DELAY;
break;
unsigned numWaves;
- gpioWave_t * waves;
+ rawWave_t * waves;
numWaves = wfc[wfcur];
waves = wf [wfcur];
/* ----------------------------------------------------------------------- */
-static int waveMerge(unsigned numIn1, gpioWave_t *in1)
+int rawWaveAddGeneric(unsigned numIn1, rawWave_t *in1)
{
unsigned inPos1=0, inPos2=0, outPos=0, level = NUM_WAVE_OOL;
uint32_t tNow, tNext1, tNext2, tDelay;
- gpioWave_t *in2, *out;
+ rawWave_t *in2, *out;
numIn2 = wfc[wfcur];
in2 = wf[wfcur];
unsigned numWaves, t;
- gpioWave_t *waves;
+ rawWave_t *waves;
numWaves = wfc[wfcur];
waves = wf [wfcur];
wf[2][p].flags = 0;
}
- return waveMerge(numPulses, wf[2]);
+ return rawWaveAddGeneric(numPulses, wf[2]);
}
/* ----------------------------------------------------------------------- */
wf[2][p].usDelay = bitDelay[0];
wf[2][p].flags = 0;
- return waveMerge(p, wf[2]);
+ return rawWaveAddGeneric(p, wf[2]);
}
/* ----------------------------------------------------------------------- */
p++;
- return waveMerge(p, wf[2]);
+ return rawWaveAddGeneric(p, wf[2]);
}
/* ----------------------------------------------------------------------- */
*/
/*
-This version is for pigpio version 14
+This version is for pigpio version 15
*/
#ifndef PIGPIO_H
#include <stdint.h>
#include <pthread.h>
-#define PIGPIO_VERSION 14
+#define PIGPIO_VERSION 15
/*-------------------------------------------------------------------------*/
uint32_t gpioOff;
uint32_t usDelay;
uint32_t flags;
-} gpioWave_t;
+} rawWave_t;
typedef struct
{
Not intended for general use.
*/
+/*-------------------------------------------------------------------------*/
+int rawWaveAddGeneric(unsigned numPulses, rawWave_t *pulses);
+/*-------------------------------------------------------------------------*/
+/* This function adds a number of pulses to the current waveform.
+
+ Returns the new total number of pulses in the current waveform if OK,
+ otherwise PI_TOO_MANY_PULSES.
+
+ NOTES:
+
+ The advantage of this function over gpioWaveAddGeneric is that it
+ allows the setting of the flags field.
+
+ The pulses are interleaved in time order within the existing waveform
+ (if any).
+
+ Merging allows the waveform to be built in parts, that is the settings
+ for gpio#1 can be added, and then gpio#2 etc.
+
+ If the added waveform is intended to start after or within the existing
+ waveform then the first pulse should consist of a delay.
+
+ Not intended for general use.
+*/
+
+
+
/* ----------------------------------------------------------------------- */
unsigned rawWaveCB(void);
/* ----------------------------------------------------------------------- */