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


C++ spiTransferByte函数代码示例

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


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

示例1: mpu6000WriteRegister

bool mpu6000WriteRegister(uint8_t reg, uint8_t data)
{
    ENABLE_MPU6000;
    spiTransferByte(MPU6000_SPI_INSTANCE, reg);
    spiTransferByte(MPU6000_SPI_INSTANCE, data);
    DISABLE_MPU6000;

    return true;
}
开发者ID:rayone,项目名称:betaflight-1,代码行数:9,代码来源:accgyro_spi_mpu6000.c

示例2: mmcCommandNoWait

void mmcCommandNoWait(u08 cmd, u32 arg) {
	// send command
	spiTransferByte(cmd | 0x40);
	spiTransferByte(arg>>24);
	spiTransferByte(arg>>16);
	spiTransferByte(arg>>8);
	spiTransferByte(arg);
	spiTransferByte(0x95);	// crc valid only for MMC_GO_IDLE_STATE
	// end command
}
开发者ID:nookalalakshmi,项目名称:Obstacle-Avoider--Line-Tracker-and-Gripper,代码行数:10,代码来源:mmc.c

示例3: set_avr_bank

void set_avr_bank(uint8_t val) {
	SPI_SS_HIGH();
	FPGA_SS_LOW();
	spiTransferByte(0x00); // SET ADDRESS
	spiTransferByte(val * 0x20); // select chip
	spiTransferByte(0x00); // select chip
	spiTransferByte(0x00); // select chip
	FPGA_SS_HIGH();
	SPI_SS_LOW();
}
开发者ID:69yuan,项目名称:sd2snes,代码行数:10,代码来源:fpga.c

示例4: cc2420WriteFifo

void cc2420WriteFifo(u08* data, u16 nBytes)
{
		// assert chip select
	cbi(PORTB, CC2420_PIN_CS);
		// send command
	spiTransferByte(CC2420_TXFIFO);
	while(nBytes--)
		spiTransferByte(*data++);
		// release chip select
	sbi(PORTB, CC2420_PIN_CS);
}
开发者ID:PradheepShrinivasan,项目名称:SmartHome,代码行数:11,代码来源:cc2420.c

示例5: cc2420DumpFifo

void cc2420DumpFifo(u16 nBytes)
{
	// assert chip select
	cbi(PORTB, CC2420_PIN_CS);
	// send command
	spiTransferByte(CC2420_RXFIFO | 0x40);
	while(nBytes--)
		spiTransferByte(0x00);
	// release chip select
	sbi(PORTB, CC2420_PIN_CS);
}
开发者ID:PradheepShrinivasan,项目名称:SmartHome,代码行数:11,代码来源:cc2420.c

示例6: spieepromReadStatus

u08 spieepromReadStatus(void)
{
	u08 status;
//	cbi(PORTB,0);
	// send command
	spiTransferByte(SPIEEPROM_CMD_RDSR);
	// get status register value
	status = spiTransferByte(0xFF);
//	sbi(PORTB,0);
	return status;
}
开发者ID:wtos03,项目名称:Geartronics-Git-Sever,代码行数:11,代码来源:spieeprom.c

示例7: mpu9250WriteRegister

bool mpu9250WriteRegister(uint8_t reg, uint8_t data)
{
	ENABLE_MPU9250;
    delayMicroseconds(1);
    spiTransferByte(MPU9250_SPI_INSTANCE, reg);
    spiTransferByte(MPU9250_SPI_INSTANCE, data);
    DISABLE_MPU9250;
    delayMicroseconds(1);

    return true;
}
开发者ID:gamani,项目名称:betaflight-bak,代码行数:11,代码来源:accgyro_spi_mpu9250.c

示例8: ads7870WriteReg

void ads7870WriteReg(u08 reg, u08 value)
{
	// assert chip select
	cbi(ADS7870_CS_PORT, ADS7870_CS_PIN);
	// issue reg write command
	spiTransferByte(ADS7870_REG_WRITE | reg);
	// write data
	spiTransferByte(value);
	// release chip select
	sbi(ADS7870_CS_PORT, ADS7870_CS_PIN);
}
开发者ID:wtos03,项目名称:Geartronics-Git-Sever,代码行数:11,代码来源:ads7870.c

示例9: cc2420WriteRam

void cc2420WriteRam(u16 addr, u08* data, u16 nBytes)
{
		// assert chip select
	cbi(PORTB, CC2420_PIN_CS);
	// send command
	spiTransferByte(0x80|addr);
	spiTransferByte((addr>>1) & 0xC0);
	while(nBytes--)
		spiTransferByte(*data++);
		// release chip select
	sbi(PORTB, CC2420_PIN_CS);
}
开发者ID:PradheepShrinivasan,项目名称:SmartHome,代码行数:12,代码来源:cc2420.c

示例10: crc7update

/**
 * sendCommand - send a command to the SD card
 * @command  : command to be sent
 * @parameter: parameter to be sent
 * @deselect : Flags if the card should be deselected afterwards
 *
 * This function calculates the correct CRC7 for the command and
 * parameter and transmits all of it to the SD card. If requested
 * the card will be deselected afterwards.
 */
int mmc::sendCommand(const byte  command,
const uint32_t parameter,
const byte  deselect) {
  union {
    unsigned long l;
    unsigned char c[4];
  } 
  long2char;

  byte  i,crc,errorcount;
  uint16_t counter;

  long2char.l = parameter;
  crc = crc7update(0  , 0x40+command);
  crc = crc7update(crc, long2char.c[3]);
  crc = crc7update(crc, long2char.c[2]);
  crc = crc7update(crc, long2char.c[1]);
  crc = crc7update(crc, long2char.c[0]);
  crc = (crc << 1) | 1;

  errorcount = 0;
  while (errorcount < CONFIG_SD_AUTO_RETRIES) {
    // Select card
    SPI_SS_LOW();

    // Transfer command
    spiTransferByte(0x40+command);
    spiTransferLong(parameter);
    spiTransferByte(crc);

    // Wait for a valid response
    counter = 0;
    do {
      i = spiTransferByte(0xff);
      counter++;
    } 
    while (i & 0x80 && counter < 0x1000);

    // Check for CRC error
    // can't reliably retry unless deselect is allowed
    if (deselect && (i & STATUS_CRC_ERROR)) {
      //      uart_putc('x');
      deselectCard();
      errorcount++;
      continue;
    }

    if (deselect) deselectCard();
    break;
  }

  return i;
}
开发者ID:GunioRobot,项目名称:Eclipse-for-AVR,代码行数:63,代码来源:mmc.cpp

示例11: cc2420WriteReg

void cc2420WriteReg(u08 addr, u16 data)
{
		// assert chip select
	cbi(PORTB, CC2420_PIN_CS);
		// send command
	spiTransferByte(addr);
		// write data
	spiTransferByte(data>>8);
	spiTransferByte(data);
		// release chip select
	sbi(PORTB, CC2420_PIN_CS);
}
开发者ID:PradheepShrinivasan,项目名称:SmartHome,代码行数:12,代码来源:cc2420.c

示例12: spiflashGetID

unsigned short spiflashGetID(void)
{
	unsigned short id;

	SPIFLASH_ASSERT_CS;
	spiTransferByte(SPIFLASH_CMD_RDID);
	id  = spiTransferByte(0x00)<<8;
	id |= spiTransferByte(0x00);
	SPIFLASH_RELEASE_CS;

	return id;
}
开发者ID:suryapattnaik,项目名称:fabathome-lpc2148,代码行数:12,代码来源:spiflash.c

示例13: ads7870ReadReg

u08 ads7870ReadReg(u08 reg)
{
	u08 data;
	// assert chip select
	cbi(ADS7870_CS_PORT, ADS7870_CS_PIN);
	// issue reg read command
	spiTransferByte(ADS7870_REG_READ | reg);
	// read data
	data = spiTransferByte(0x00);
	// release chip select
	sbi(ADS7870_CS_PORT, ADS7870_CS_PIN);
	// return data
	return data;
}
开发者ID:wtos03,项目名称:Geartronics-Git-Sever,代码行数:14,代码来源:ads7870.c

示例14: spieepromWriteByte

void spieepromWriteByte(u32 memAddr, u08 data)
{
	// wait for any previous write to complete
	while(spieepromReadStatus() & SPIEEPROM_STATUS_WIP);

//	cbi(PORTB,0);
	// send command
	spiTransferByte(SPIEEPROM_CMD_WRITE);
	// send address
	spiTransferByte(memAddr>>8);
	spiTransferByte(memAddr&0x00FF);
	// send data to be written
	spiTransferByte(data);
//	sbi(PORTB,0);
}
开发者ID:wtos03,项目名称:Geartronics-Git-Sever,代码行数:15,代码来源:spieeprom.c

示例15: spieepromReadByte

u08 spieepromReadByte(u32 memAddr)
{
	u08 data;
//	cbi(PORTB,0);
	// send command
	spiTransferByte(SPIEEPROM_CMD_READ);
	// send address
	spiTransferByte(memAddr>>8);
	spiTransferByte(memAddr&0x00FF);
	// read contents of memory address
	data = spiTransferByte(0xFF);
	// return data
	return data;
//	sbi(PORTB,0);
}
开发者ID:wtos03,项目名称:Geartronics-Git-Sever,代码行数:15,代码来源:spieeprom.c


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