您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ spiSelect函数代码示例

51自学网 2021-06-03 08:09:22
  C++
这篇教程C++ spiSelect函数代码示例写得很实用,希望能帮到您。

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

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


示例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,


示例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,


示例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,


示例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,


示例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,


示例7: xflash_txn_begin

static voidxflash_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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例21: M25P16ReadPage

static void M25P16ReadPage(uint32_t Address, uint8_t * Buffer)  {    uint8_t Command[] = { M25P16_READ_BYTES, (Address >> 16) & 0xFF, (Address >> 8) & 0xFF, Address & 0xFF};    spiStart(&FLASH_SPI, &HSSpiConfig); /* Setup transfer parameters.       */    spiSelect(&FLASH_SPI); /* Slave Select assertion.          */    spiSend(&FLASH_SPI, 4, Command); /* Send command                     */    spiReceive(&FLASH_SPI, PAGE_SIZE, Buffer);    spiUnselect(&FLASH_SPI); /* Slave Select de-assertion.       */    spiStop(&FLASH_SPI);  }
开发者ID:hrrr,项目名称:ChibiFlight,代码行数:11,


示例22: spiAcquireBus

uint16_t A4960::writeReg(const uint8_t addr, const uint16_t data) {    const uint16_t txData = (uint16_t(addr & 0x7) << 13) | 0x1000 | (data & 0xfff);    uint16_t rxData;    spiAcquireBus(spip);    spiSelect(spip);    spiExchange(spip, 1, &txData, &rxData);    spiUnselect(spip);    spiReleaseBus(spip);    return rxData;}
开发者ID:GHF,项目名称:gyroking,代码行数:11,


示例23: fm25l16_exchange

uint8_t fm25l16_exchange(int len){	spiAcquireBus(&SPID1);              /* Acquire ownership of the bus.    */	spiStart(&SPID1, &hs_spicfg);       /* Setup transfer parameters.       */	spiSelect(&SPID1);                  /* Slave Select assertion.          */	spiExchange(&SPID1, len,			txbuf, rxbuf);          /* Atomic transfer operations.      */	spiUnselect(&SPID1);                /* Slave Select de-assertion.       */    spiReleaseBus(&SPID1);              /* Ownership release.               */	return len;}
开发者ID:scarecrowli,项目名称:ChibiOS,代码行数:11,


示例24: sendByte3310

/** * @brief Sends a byte through the SPI interface and return the byte    * received from the SPI bus.     * @param byte : byte to send.     * @retval : The value of the received byte.     */ void sendByte3310( uint8_t byte ){    spiAcquireBus( &SPI_3310 );     // Acquire ownership of the bus.    spiStart( &SPI_3310, &spicfg ); // Setup transfer parameters.    spiSelect( &SPI_3310 );         // Slave Select assertion.    spiStartSend( &SPI_3310, 1, &byte );    //spiExchange( &SPI_3310, 512,    //             txbuf, rxbuf );  // Atomic transfer operations.    spiUnselect( &SPI_3310 );       // Slave Select de-assertion.    spiReleaseBus( &SPI_3310 );     // Ownership release.}
开发者ID:z80,项目名称:clock,代码行数:16,


示例25: cjWriteRegister

static void cjWriteRegister(unsigned char regAddr, unsigned char regValue) {	tx_buff[0] = regAddr;	tx_buff[1] = regValue;#ifdef CJ125_DEBUG_SPI	scheduleMsg(logger, "cjWriteRegister: addr=%d value=%d", regAddr, regValue);#endif /* CJ125_DEBUG_SPI */	// todo: extract 'sendSync' method?	spiSelect(driver);	spiSend(driver, 2, tx_buff);	spiUnselect(driver);}
开发者ID:rusefi,项目名称:rusefi,代码行数:11,


示例26: sendArray3310

void sendArray3310( uint8_t * data, int cnt ){    spiAcquireBus( &SPID1 );     // Acquire ownership of the bus.    spiStart( &SPID1, &spicfg ); // Setup transfer parameters.    spiSelect( &SPID1 );         // Slave Select assertion.    //spiExchange( &SPID1, 512,    //            txbuf, rxbuf );  // Atomic transfer operations.    spiStartSend( &SPI_3310, cnt, data );    spiUnselect( &SPID1 );       // Slave Select de-assertion.    spiReleaseBus( &SPID1 );     // Ownership release.}
开发者ID:z80,项目名称:clock,代码行数:11,


示例27: sp100_read_byte

static uint8_t sp100_read_byte(int n, uint8_t cmd) {    uint8_t rxb[1], txb[1];    txb[0] = cmd;    sp100_spi_start(n);    spiSelect(sp100_spid);    spiSend(sp100_spid, 1, txb);    spiUnselect(sp100_spid);    chThdSleepMicroseconds(60);    spiSelect(sp100_spid);    spiReceive(sp100_spid, 1, rxb);    spiUnselect(sp100_spid);    chThdSleepMicroseconds(60);    sp100_spi_stop();    return rxb[0];}
开发者ID:cuspaceflight,项目名称:m3-avionics,代码行数:20,


示例28: spi_transfer

void spi_transfer(uint8_t *buf, uint16_t len, uint8_t toggle_cs){	spiSelect (SS_PB2);	spiMultiByteTransfer(buf, len);	if (toggle_cs)		spiDeselect (SS_PB2);	return;}
开发者ID:bruce33,项目名称:avrfreertos,代码行数:12,


示例29: fm25l16_write_read

uint8_t fm25l16_write_read(uint8_t cmd){	spiAcquireBus(&SPID1);              /* Acquire ownership of the bus.    */	spiStart(&SPID1, &hs_spicfg);       /* Setup transfer parameters.       */	spiSelect(&SPID1);                  /* Slave Select assertion.          */	tx_ch = cmd;	spiExchange(&SPID1, 1,			&tx_ch, &rx_ch);          /* Atomic transfer operations.      */	spiUnselect(&SPID1);                /* Slave Select de-assertion.       */    spiReleaseBus(&SPID1);              /* Ownership release.               */	return rx_ch;}
开发者ID:scarecrowli,项目名称:ChibiOS,代码行数:12,



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


C++ spiSend函数代码示例
C++ spiReleaseBus函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。