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


C++ spiSelect函数代码示例

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


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


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