int i2c_block_process_call( int pi, unsigned handle, unsigned reg, char *buf, unsigned count) { int bytes; gpioExtent_t ext[1]; /* p1=handle p2=reg p3=count ## extension ## char buf[count] */ ext[0].size = count; ext[0].ptr = buf; bytes = pigpio_command_ext (pi, PI_CMD_I2CPK, handle, reg, count, 1, ext, 0); if (bytes > 0) { bytes = recvMax(pi, buf, 32, bytes); } _pmu(pi); return bytes; }
int spi_xfer(unsigned handle, char *txBuf, char *rxBuf, unsigned count) { int bytes; gpioExtent_t ext[1]; /* p1=handle p2=0 p3=count ## extension ## char buf[count] */ ext[0].size = count; ext[0].ptr = txBuf; bytes = pigpio_command_ext (gPigCommand, PI_CMD_SPIX, handle, 0, count, 1, ext, 0); if (bytes > 0) { bytes = recvMax(rxBuf, count, bytes); } pthread_mutex_unlock(&command_mutex); return bytes; }
int custom_2(unsigned arg1, char *argx, unsigned count, char *retBuf, uint32_t retMax) { int bytes; gpioExtent_t ext[1]; /* p1=arg1 p2=retMax p3=count ## extension ## char argx[count] */ ext[0].size = count; ext[0].ptr = argx; bytes = pigpio_command_ext (gPigCommand, PI_CMD_CF2, arg1, retMax, count, 1, ext, 0); if (bytes > 0) { bytes = recvMax(retBuf, retMax, bytes); } pthread_mutex_unlock(&command_mutex); return bytes; }
int i2c_read_i2c_block_data( unsigned handle, unsigned reg, char *buf, uint32_t count) { int bytes; gpioExtent_t ext[1]; /* p1=handle p2=reg p3=4 ## extension ## uint32_t count */ ext[0].size = sizeof(uint32_t); ext[0].ptr = &count; bytes = pigpio_command_ext (gPigCommand, PI_CMD_I2CRI, handle, reg, 4, 1, ext, 0); if (bytes > 0) { bytes = recvMax(buf, count, bytes); } pthread_mutex_unlock(&command_mutex); return bytes; }
int bb_i2c_zip( unsigned SDA, char *inBuf, unsigned inLen, char *outBuf, unsigned outLen) { int bytes; gpioExtent_t ext[1]; /* p1=SDA p2=0 p3=inLen ## extension ## char inBuf[inLen] */ ext[0].size = inLen; ext[0].ptr = inBuf; bytes = pigpio_command_ext (gPigCommand, PI_CMD_BI2CZ, SDA, 0, inLen, 1, ext, 0); if (bytes > 0) { bytes = recvMax(outBuf, outLen, bytes); } pthread_mutex_unlock(&command_mutex); return bytes; }
int i2c_block_process_call( unsigned handle, unsigned reg, char *buf, unsigned count) { int bytes; gpioExtent_t ext[1]; /* p1=handle p2=reg p3=count ## extension ## char buf[count] */ ext[0].size = count; ext[0].ptr = buf; bytes = pigpio_command_ext (gPigCommand, PI_CMD_I2CPK, handle, reg, count, 1, ext, 0); if (bytes > 0) { /* get the data */ recv(gPigCommand, buf, bytes, MSG_WAITALL); } pthread_mutex_unlock(&command_mutex); return bytes; }
int wave_add_serial( unsigned gpio, unsigned baud, unsigned offset, unsigned numChar, char *str) { gpioExtent_t ext[3]; /* p1=gpio p2=numChar ## extension ## unsigned baud unsigned offset char[] str */ ext[0].size = sizeof(unsigned); ext[0].ptr = &baud; ext[1].size = sizeof(unsigned); ext[1].ptr = &offset; ext[2].size = numChar; ext[2].ptr = str; return pigpio_command_ext(gPigCommand, PI_CMD_WVAS, gpio, numChar, 3, ext); }
int custom_2(int pi, unsigned arg1, char *argx, unsigned count, char *retBuf, uint32_t retMax) { int bytes; gpioExtent_t ext[1]; /* p1=arg1 p2=retMax p3=count ## extension ## char argx[count] */ ext[0].size = count; ext[0].ptr = argx; bytes = pigpio_command_ext (pi, PI_CMD_CF2, arg1, retMax, count, 1, ext, 0); if (bytes > 0) { bytes = recvMax(pi, retBuf, retMax, bytes); } _pmu(pi); return bytes; }
int spi_xfer(int pi, unsigned handle, char *txBuf, char *rxBuf, unsigned count) { int bytes; gpioExtent_t ext[1]; /* p1=handle p2=0 p3=count ## extension ## char buf[count] */ ext[0].size = count; ext[0].ptr = txBuf; bytes = pigpio_command_ext (pi, PI_CMD_SPIX, handle, 0, count, 1, ext, 0); if (bytes > 0) { bytes = recvMax(pi, rxBuf, count, bytes); } _pmu(pi); return bytes; }
int bb_i2c_zip( int pi, unsigned SDA, char *inBuf, unsigned inLen, char *outBuf, unsigned outLen) { int bytes; gpioExtent_t ext[1]; /* p1=SDA p2=0 p3=inLen ## extension ## char inBuf[inLen] */ ext[0].size = inLen; ext[0].ptr = inBuf; bytes = pigpio_command_ext (pi, PI_CMD_BI2CZ, SDA, 0, inLen, 1, ext, 0); if (bytes > 0) { bytes = recvMax(pi, outBuf, outLen, bytes); } _pmu(pi); return bytes; }
int wave_add_serial( unsigned user_gpio, unsigned baud, uint32_t databits, uint32_t stophalfbits, uint32_t offset, unsigned numChar, char *str) { uint8_t buf[12]; gpioExtent_t ext[2]; /* p1=user_gpio p2=baud p3=len+12 ## extension ## uint32_t databits uint32_t stophalfbits uint32_t offset char[len] str */ if (!numChar) return 0; memcpy(buf, &databits, 4); memcpy(buf+4, &stophalfbits, 4); memcpy(buf+8, &offset, 4); ext[0].size = sizeof(buf); ext[0].ptr = buf; ext[1].size = numChar; ext[1].ptr = str; return pigpio_command_ext(gPigCommand, PI_CMD_WVAS, user_gpio, baud, numChar+sizeof(buf), 2, ext, 1); }
int gpio_trigger(unsigned gpio, unsigned pulseLen, unsigned level) { gpioExtent_t ext[1]; /* p1=gpio p2=pulseLen ## extension ## unsigned level */ ext[0].size = sizeof(level); ext[0].ptr = &level; return pigpio_command_ext(gPigCommand, PI_CMD_TRIG, gpio, pulseLen, 1, ext); }
int wave_add_generic(unsigned numPulses, gpioPulse_t *pulses) { gpioExtent_t ext[1]; /* p1=numPulses p2=0 ## extension ## gpioPulse_t[] pulses */ ext[0].size = numPulses * sizeof(gpioPulse_t); ext[0].ptr = pulses; return pigpio_command_ext(gPigCommand, PI_CMD_WVAG, numPulses, 0, 1, ext); }
int run_script(unsigned script_id, unsigned numPar, uint32_t *param) { gpioExtent_t ext[1]; /* p1=script id p2=number of parameters ## extension ## uint32_t[] parameters */ ext[0].size = sizeof(uint32_t)*numPar; ext[0].ptr = param; return pigpio_command_ext (gPigCommand, PI_CMD_PROCR, script_id, numPar, 1, ext); }
int i2c_write_device(int pi, unsigned handle, char *buf, unsigned count) { gpioExtent_t ext[1]; /* p1=handle p2=0 p3=count ## extension ## char buf[count] */ ext[0].size = count; ext[0].ptr = buf; return pigpio_command_ext (pi, PI_CMD_I2CWD, handle, 0, count, 1, ext, 1); }
int set_noise_filter(unsigned user_gpio, unsigned steady, unsigned active) { gpioExtent_t ext[1]; /* p1=user_gpio p2=steady p3=4 ## extension ## unsigned active */ ext[0].size = sizeof(uint32_t); ext[0].ptr = &active; return pigpio_command_ext( gPigCommand, PI_CMD_FN, user_gpio, steady, 4, 1, ext, 1); }
int i2c_write_word_data(unsigned handle, unsigned reg, uint32_t val) { gpioExtent_t ext[1]; /* p1=handle p2=reg p3=4 ## extension ## uint32_t val */ ext[0].size = sizeof(uint32_t); ext[0].ptr = &val; return pigpio_command_ext (gPigCommand, PI_CMD_I2CWW, handle, reg, 4, 1, ext, 1); }
int i2c_open(unsigned i2c_bus, unsigned i2c_addr, uint32_t i2c_flags) { gpioExtent_t ext[1]; /* p1=i2c_bus p2=i2c_addr p3=4 ## extension ## uint32_t i2c_flags */ ext[0].size = sizeof(uint32_t); ext[0].ptr = &i2c_flags; return pigpio_command_ext (gPigCommand, PI_CMD_I2CO, i2c_bus, i2c_addr, 4, 1, ext, 1); }
int i2c_process_call(int pi, unsigned handle, unsigned reg, uint32_t val) { gpioExtent_t ext[1]; /* p1=handle p2=reg p3=4 ## extension ## uint32_t val */ ext[0].size = sizeof(uint32_t); ext[0].ptr = &val; return pigpio_command_ext (pi, PI_CMD_I2CPK, handle, reg, 4, 1, ext, 1); }
int run_script(unsigned script_id, unsigned numPar, uint32_t *param) { gpioExtent_t ext[1]; /* p1=script id p2=0 p3=numPar * 4 ## extension ## uint32_t[numPar] pars */ ext[0].size = 4 * numPar; ext[0].ptr = param; return pigpio_command_ext (gPigCommand, PI_CMD_PROCR, script_id, 0, numPar*4, 1, ext, 1); }
int bb_serial_read_open(unsigned user_gpio, unsigned baud, uint32_t bbBits) { gpioExtent_t ext[1]; /* p1=user_gpio p2=baud p3=4 ## extension ## unsigned bbBits */ ext[0].size = sizeof(uint32_t); ext[0].ptr = &bbBits; return pigpio_command_ext( gPigCommand, PI_CMD_SLRO, user_gpio, baud, 4, 1, ext, 1); }
int wave_chain(char *buf, unsigned bufSize) { gpioExtent_t ext[1]; /* p1=0 p2=0 p3=bufSize ## extension ## char buf[bufSize] */ ext[0].size = bufSize; ext[0].ptr = buf; return pigpio_command_ext (gPigCommand, PI_CMD_WVCHA, 0, 0, bufSize, 1, ext, 1); }
int gpio_trigger(unsigned user_gpio, unsigned pulseLen, uint32_t level) { gpioExtent_t ext[1]; /* p1=user_gpio p2=pulseLen p3=4 ## extension ## unsigned level */ ext[0].size = sizeof(uint32_t); ext[0].ptr = &level; return pigpio_command_ext( gPigCommand, PI_CMD_TRIG, user_gpio, pulseLen, 4, 1, ext, 1); }
int custom_1(unsigned arg1, unsigned arg2, char *argx, unsigned count) { gpioExtent_t ext[1]; /* p1=arg1 p2=arg2 p3=count ## extension ## char argx[count] */ ext[0].size = count; ext[0].ptr = argx; return pigpio_command_ext( gPigCommand, PI_CMD_CF1, arg1, arg2, count, 1, ext, 1); }
int hardware_PWM(unsigned gpio, unsigned frequency, uint32_t dutycycle) { gpioExtent_t ext[1]; /* p1=gpio p2=frequency p3=4 ## extension ## uint32_t dutycycle */ ext[0].size = sizeof(dutycycle); ext[0].ptr = &dutycycle; return pigpio_command_ext( gPigCommand, PI_CMD_HP, gpio, frequency, sizeof(dutycycle), 1, ext, 1); }
int serial_write(unsigned handle, char *buf, unsigned count) { gpioExtent_t ext[1]; /* p1=handle p2=0 p3=count ## extension ## char buf[count] */ ext[0].size = count; ext[0].ptr = buf; return pigpio_command_ext (gPigCommand, PI_CMD_SERW, handle, 0, count, 1, ext, 1); }
int spi_open(unsigned channel, unsigned speed, uint32_t flags) { gpioExtent_t ext[1]; /* p1=channel p2=speed p3=4 ## extension ## uint32_t flags */ ext[0].size = sizeof(uint32_t); ext[0].ptr = &flags; return pigpio_command_ext (gPigCommand, PI_CMD_SPIO, channel, speed, 4, 1, ext, 1); }
int bb_i2c_open(unsigned SDA, unsigned SCL, unsigned baud) { gpioExtent_t ext[1]; /* p1=SDA p2=SCL p3=4 ## extension ## uint32_t baud */ ext[0].size = sizeof(uint32_t); ext[0].ptr = &baud; return pigpio_command_ext (gPigCommand, PI_CMD_BI2CO, SDA, SCL, 4, 1, ext, 1); }
int i2c_write_i2c_block_data( unsigned handle, unsigned reg, char *buf, unsigned count) { gpioExtent_t ext[1]; /* p1=handle p2=reg p3=count ## extension ## char buf[count] */ ext[0].size = count; ext[0].ptr = buf; return pigpio_command_ext (gPigCommand, PI_CMD_I2CWI, handle, reg, count, 1, ext, 1); }
int store_script(char *script) { unsigned len; gpioExtent_t ext[1]; /* p1=script length p2=0 ## extension ## char[] script */ len = strlen(script); ext[0].size = len; ext[0].ptr = script; return pigpio_command_ext(gPigCommand, PI_CMD_PROC, len, 0, 1, ext); }