当前位置: 首页>>代码示例>>C++>>正文


C++ pigpio_command_ext函数代码示例

本文整理汇总了C++中pigpio_command_ext函数的典型用法代码示例。如果您正苦于以下问题:C++ pigpio_command_ext函数的具体用法?C++ pigpio_command_ext怎么用?C++ pigpio_command_ext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pigpio_command_ext函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: i2c_block_process_call

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;
}
开发者ID:Nicodus63,项目名称:Raspberry,代码行数:29,代码来源:pigpiod_if2.c

示例2: spi_xfer

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;
}
开发者ID:Bahamuttg,项目名称:pigpio,代码行数:28,代码来源:pigpiod_if.c

示例3: custom_2

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;
}
开发者ID:Bahamuttg,项目名称:pigpio,代码行数:29,代码来源:pigpiod_if.c

示例4: i2c_read_i2c_block_data

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;
}
开发者ID:Bahamuttg,项目名称:pigpio,代码行数:29,代码来源:pigpiod_if.c

示例5: bb_i2c_zip

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;
}
开发者ID:Bahamuttg,项目名称:pigpio,代码行数:33,代码来源:pigpiod_if.c

示例6: i2c_block_process_call

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;
}
开发者ID:EstebanCoto,项目名称:evok,代码行数:30,代码来源:pigpiod_if.c

示例7: wave_add_serial

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);
}
开发者ID:Lukas-St,项目名称:Mobile-Rover,代码行数:25,代码来源:pigpiod_if.c

示例8: custom_2

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;
}
开发者ID:Nicodus63,项目名称:Raspberry,代码行数:29,代码来源:pigpiod_if2.c

示例9: spi_xfer

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;
}
开发者ID:Nicodus63,项目名称:Raspberry,代码行数:28,代码来源:pigpiod_if2.c

示例10: bb_i2c_zip

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;
}
开发者ID:Nicodus63,项目名称:Raspberry,代码行数:34,代码来源:pigpiod_if2.c

示例11: wave_add_serial

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);
}
开发者ID:Bahamuttg,项目名称:pigpio,代码行数:33,代码来源:pigpiod_if.c

示例12: gpio_trigger

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);
}
开发者ID:Lukas-St,项目名称:Mobile-Rover,代码行数:16,代码来源:pigpiod_if.c

示例13: wave_add_generic

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);
}
开发者ID:Lukas-St,项目名称:Mobile-Rover,代码行数:16,代码来源:pigpiod_if.c

示例14: run_script

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);
}
开发者ID:Lukas-St,项目名称:Mobile-Rover,代码行数:17,代码来源:pigpiod_if.c

示例15: i2c_write_device

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);
}
开发者ID:Nicodus63,项目名称:Raspberry,代码行数:18,代码来源:pigpiod_if2.c


注:本文中的pigpio_command_ext函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。