• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ spiSelect函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: spiEepromWriteSR

//----------------------------------------------------------------------------
void 
spiEepromWriteSR(spiEepromDriver * sedp, uint8_t sr)
{
	spiStart(sedp->spip, &sedp->cfgp->spicfg);
	spiSelect(sedp->spip);
	spiPolledExchange(sedp->spip, OP_WRSR);
	spiPolledExchange(sedp->spip, sr);
	spiUnselect(sedp->spip);
}
开发者ID:naniBox,项目名称:kuroBox_TimeTest,代码行数:10,代码来源:spiEEPROM.c


示例2: SPISendData

static int SPISendData(SPIDriver *SPIPtr, uint8_t *TxBuf, size_t Size)
  {
    spiStart(SPIPtr, &HSSpiConfig); /* Setup transfer parameters.       */
    spiSelect(SPIPtr); /* Slave Select assertion.          */
    spiSend(SPIPtr, Size, TxBuf); /* Send command                     */
    spiUnselect(SPIPtr); /* Slave Select de-assertion.       */
    spiStop(SPIPtr);
    return 0;
  }
开发者ID:hrrr,项目名称:ChibiFlight,代码行数:9,代码来源:flash.c


示例3: _readBuffer

void _readBuffer(uint16_t len, uint8_t *data)
{
  uint8_t tx[] = { READ_BUF_MEM };

  spiSelect(_spip);
  spiSend(_spip, 1, tx);
  spiReceive(_spip, len, data);
  spiUnselect(_spip);
}
开发者ID:utzig,项目名称:chibios-avr-enc28j60-demo,代码行数:9,代码来源:enc28j60.c


示例4: lis302dlReadRegister

/**
 * @brief   Reads a register value.
 * @pre     The SPI interface must be initialized and the driver started.
 *
 * @param[in] spip      pointer to the SPI initerface
 * @param[in] reg       register number
 * @return              The register value.
 */
uint8_t lis302dlReadRegister(SPIDriver *spip, uint8_t reg) {

  spiSelect(spip);
  txbuf[0] = 0x80 | reg;
  txbuf[1] = 0xff;
  spiExchange(spip, 2, txbuf, rxbuf);
  spiUnselect(spip);
  return rxbuf[1];
}
开发者ID:ChibiOS,项目名称:ChibiOS-gitmain,代码行数:17,代码来源:lis302dl.c


示例5: lis302dlSPIWriteRegister

/**
 * @brief   Writes a value into a generic register using SPI.
 * @pre     The SPI interface must be initialized and the driver started.
 *
 * @param[in] spip      pointer to the SPI interface
 * @param[in] reg       starting register address
 * @param[in] n         number of adjacent registers to write
 * @param[in] b         pointer to a buffer of values.
 */
static void lis302dlSPIWriteRegister(SPIDriver *spip, uint8_t reg, size_t n,
                                     uint8_t* b) {
  uint8_t cmd;
  (n == 1) ? (cmd = reg) : (cmd = reg | LIS302DL_MS);
  spiSelect(spip);
  spiSend(spip, 1, &cmd);
  spiSend(spip, n, b);
  spiUnselect(spip);
}
开发者ID:mabl,项目名称:ChibiOS,代码行数:18,代码来源:lis302dl.c


示例6: ad5504Stop

void ad5504Stop(void) {
  /* All DAC channels are in the power down mode. */
  txBuf[0] = AD5504_CONTROL;
  txBuf[1] = AD5504_DAC_A; /* Set DAC channel A to 0. */

  spiSelect(&SPID1);
  spiSend(&SPID1, 2 * sizeof(uint16_t), (uint8_t *)txBuf);
  spiUnselect(&SPID1);
}
开发者ID:SVentas,项目名称:SmartMDC,代码行数:9,代码来源:ad5504.c


示例7: xflash_txn_begin

static void
xflash_txn_begin()
{
#if SPI_USE_MUTUAL_EXCLUSION
  spiAcquireBus(SPI_FLASH);
#endif
  spiStart(SPI_FLASH, &flash_spi_cfg);
  spiSelect(SPI_FLASH);
}
开发者ID:jaumann,项目名称:model-t,代码行数:9,代码来源:xflash.c


示例8: ad5504Init

void ad5504Init(void) {
  /* Only DAC channel A is in the power up mode. */
  txBuf[0] = AD5504_CONTROL | AD5504_CR_DAC_A_POWER_UP;
  txBuf[1] = AD5504_DAC_A; /* Set DAC channel A to 0. */

  spiSelect(&SPID1);
  spiSend(&SPID1, 2 * sizeof(uint16_t), (uint8_t *)txBuf);
  spiUnselect(&SPID1);
}
开发者ID:SVentas,项目名称:SmartMDC,代码行数:9,代码来源:ad5504.c


示例9: send_command_R1

/**
 * @brief   Sends a command an returns a single byte response.
 *
 * @param[in] mmcp      pointer to the @p MMCDriver object
 * @param[in] cmd       the command id
 * @param[in] arg       the command argument
 * @return              The response as an @p uint8_t value.
 * @retval 0xFF         timed out.
 *
 * @notapi
 */
static uint8_t send_command_R1(MMCDriver *mmcp, uint8_t cmd, uint32_t arg) {
  uint8_t r1;

  spiSelect(mmcp->config->spip);
  send_hdr(mmcp, cmd, arg);
  r1 = recvr1(mmcp);
  spiUnselect(mmcp->config->spip);
  return r1;
}
开发者ID:Dionysios,项目名称:STM_Library_2,代码行数:20,代码来源:mmc_spi.c


示例10: l3gd20SPIReadRegister

/**
 * @brief   Reads a generic register value using SPI.
 * @pre     The SPI interface must be initialized and the driver started.
 *
 * @param[in] spip      pointer to the SPI interface
 * @param[in] reg       starting register address
 * @param[in] n         number of consecutive registers to read
 * @param[in] b         pointer to an output buffer.
 */
static void l3gd20SPIReadRegister(SPIDriver *spip, uint8_t reg,  size_t n,
                                     uint8_t* b) {
  uint8_t cmd;
  (n == 1) ? (cmd = reg | L3GD20_RW) : (cmd = reg | L3GD20_RW | L3GD20_MS);
  spiSelect(spip);
  spiSend(spip, 1, &cmd);
  spiReceive(spip, n, b);
  spiUnselect(spip);
}
开发者ID:rusefi,项目名称:ChibiOS,代码行数:18,代码来源:l3gd20.c


示例11: adxl3x5_read_accel

/*
 * Read the current acceleration values from the ADXL on SPI driver `SPID`.
 * The values are stored in `accels` as three int16s.
 */
static void adxl3x5_read_accel(SPIDriver* SPID, int16_t* accels)
{
    uint8_t adr = 0x32 | (1<<6) | (1<<7);

    spiSelect(SPID);
    spiSend(SPID, 1, (void*)&adr);
    spiReceive(SPID, 6, (void*)accels);
    spiUnselect(SPID);
}
开发者ID:cuspaceflight,项目名称:m2-electronics,代码行数:13,代码来源:adxl3x5.c


示例12: _writeBuffer

void _writeBuffer(uint16_t len, uint8_t *data)
{
  uint8_t tx[] = { WRITE_BUF_MEM };

  spiSelect(_spip);
  spiSend(_spip, 1, tx);
  spiSend(_spip, len, data);
  spiUnselect(_spip);
}
开发者ID:utzig,项目名称:chibios-avr-enc28j60-demo,代码行数:9,代码来源:enc28j60.c


示例13: main

/*
 * Application entry point.
 */
int main(void) {
  uint8_t i;

  /*
   * System initializations.
   * - HAL initialization, this also initializes the configured device drivers
   *   and performs the board-specific initializations.
   * - Kernel initialization, the main() function becomes a thread and the
   *   RTOS is active.
   */
  halInit();
  chSysInit();

  /*
   * Activates the SD1 and SPI1 drivers.
   */
  sdStart(&SD1, NULL);                  /* Default: 38400,8,N,1.            */
  spiStart(&SPID1, &spicfg);

  /*
   * Creates the blinker threads.
   */
  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
  chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO, Thread2, NULL);

  /*
   * Normal main() thread activity, in this demo it updates the 7-segments
   * display on the LPCXpresso main board using the SPI driver.
   */
  i = 0;
  while (TRUE) {
    if (!palReadPad(GPIO0, GPIO0_SW3))
      TestThread(&SD1);
    spiSelect(&SPID1);
    spiSend(&SPID1, 1, &digits[i]);                 /* Non polled method.   */
    spiUnselect(&SPID1);
    chThdSleepMilliseconds(500);
    spiSelect(&SPID1);
    spiPolledExchange(&SPID1, digits[i | 0x10]);    /* Polled method.       */
    spiUnselect(&SPID1);
    chThdSleepMilliseconds(500);
    i = (i + 1) & 15;
  }
}
开发者ID:CNCBASHER,项目名称:ChibiOS,代码行数:47,代码来源:main.c


示例14: adxl362_write_register

void adxl362_write_register (uint16_t address, uint8_t data) {
    uint8_t command = 0x0A;

    spiStart(&SPID1, &adxl362_cfg);      /* Setup transfer parameters. */
    spiSelect(&SPID1);                   /* Slave Select assertion.    */
    spiSend(&SPID1, 1, &command);        /* Write Command              */
    spiSend(&SPID1, 1, &address);        /* Address                    */
    spiSend(&SPID1, 1, &data);           /* Data                       */
    spiUnselect(&SPID1);                 /* Slave Select de-assertion. */
}
开发者ID:ka-ross,项目名称:nucleo_f303re,代码行数:10,代码来源:adxl362.c


示例15: sendToPot

static void sendToPot(Mcp42010Driver *driver, int channel, int value) {
	lockSpi(SPI_NONE);
	spiStart(driver->spi, &driver->spiConfig);
	spiSelect(driver->spi);
	int word = (17 + channel) * 256 + value;
	spiSend(driver->spi, 1, &word);
	spiUnselect(driver->spi);
	spiStop(driver->spi);
	unlockSpi();
}
开发者ID:Vijay1190,项目名称:rusefi,代码行数:10,代码来源:poten.cpp


示例16: adxl3x5_write_u8

/*
 * Write a register at address `adr` with value `val` on the ADXL3x5 on SPI
 * driver `SPID`.
 */
static void adxl3x5_write_u8(SPIDriver* SPID, uint8_t adr, uint8_t val)
{
    uint8_t tx[2];
    tx[0] = adr & ~(1<<7 | 1<<6);
    tx[1] = val;

    spiSelect(SPID);
    spiSend(SPID, 2, (void*)tx);
    spiUnselect(SPID);
}
开发者ID:cuspaceflight,项目名称:m2-electronics,代码行数:14,代码来源:adxl3x5.c


示例17: spiEepromReadSR

//----------------------------------------------------------------------------
uint8_t 
spiEepromReadSR(spiEepromDriver * sedp)
{
	spiStart(sedp->spip, &sedp->cfgp->spicfg);
	spiSelect(sedp->spip);
	spiPolledExchange(sedp->spip, OP_RDSR);
	uint8_t sr = spiPolledExchange(sedp->spip, 0x00);
	spiUnselect(sedp->spip);
	return sr;
}
开发者ID:naniBox,项目名称:kuroBox_TimeTest,代码行数:11,代码来源:spiEEPROM.c


示例18: send_command_R3

/**
 * @brief   Sends a command which returns a five bytes response (R3).
 *
 * @param[in] mmcp      pointer to the @p MMCDriver object
 * @param[in] cmd       the command id
 * @param[in] arg       the command argument
 * @param[out] response pointer to four bytes wide uint8_t buffer
 * @return              The first byte of the response (R1) as an @p
 *                      uint8_t value.
 * @retval 0xFF         timed out.
 *
 * @notapi
 */
static uint8_t send_command_R3(MMCDriver *mmcp, uint8_t cmd, uint32_t arg,
                               uint8_t *response) {
  uint8_t r1;
  
  spiSelect(mmcp->spip);
  send_hdr(mmcp, cmd, arg);
  r1 = recvr3(mmcp, response);
  spiUnselect(mmcp->spip);
  return r1;
}
开发者ID:glockwork,项目名称:dfu,代码行数:23,代码来源:mmc_spi.c


示例19: internal_adis16405_read_u16

static uint16_t internal_adis16405_read_u16(uint8_t addr_in) {
    uint16_t addr_out = (uint16_t)(addr_in & 0x7F) << 8;
    uint16_t data_rx;

    spiSelect(&ADIS16405_SPID);
    spiSend(&ADIS16405_SPID, 1, (void*)&addr_out);
    spiReceive(&ADIS16405_SPID, 1, (void*)&data_rx);
    spiUnselect(&ADIS16405_SPID);
    return data_rx;
}
开发者ID:cuspaceflight,项目名称:spalax,代码行数:10,代码来源:adis16405.c


示例20: gyro_write_register

void gyro_write_register (uint8_t address, uint8_t data) {
  address = address & (~0x80);         /* Clear the write bit (bit 7)      */
  spiAcquireBus(&SPID1);               /* Acquire ownership of the bus.    */
  spiStart(&SPID1, &gyro_cfg);         /* Setup transfer parameters.       */
  spiSelect(&SPID1);                   /* Slave Select assertion.          */
  spiSend(&SPID1, 1, &address);        /* Send the address byte            */
  spiSend(&SPID1, 1, &data); 
  spiUnselect(&SPID1);                 /* Slave Select de-assertion.       */
  spiReleaseBus(&SPID1);               /* Ownership release.               */
}
开发者ID:ka-ross,项目名称:Digital-Systems-Labs,代码行数:10,代码来源:main.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ spiSend函数代码示例发布时间:2022-05-30
下一篇:
C++ spiReleaseBus函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap