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


C++ spiTransfer函数代码示例

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


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

示例1: spiTransactionBegin

unsigned char CC2500xcvr::sendBurstCommand(unsigned char command, unsigned char* data, unsigned char length)
{
    spiTransactionBegin();	// enable device

    // send command byte
    spiTransfer(command);			    // this is a burst command
    unsigned char result = 0;

    // send/recv data bytes
    for (int i=0; i<length; ++i)
	{
        result = spiTransfer(data[i]);	// send
        data[i] = result;				// receive into the same buffer
    }

    spiTransactionEnd(); 	// disable device
    return result;	// return result
}
开发者ID:reconvolution,项目名称:Zeptoduino,代码行数:18,代码来源:CC2500.cpp

示例2: mpu6000ReadRegister

bool mpu6000ReadRegister(uint8_t reg, uint8_t length, uint8_t *data)
{
    ENABLE_MPU6000;
    spiTransferByte(MPU6000_SPI_INSTANCE, reg | 0x80); // read transaction
    spiTransfer(MPU6000_SPI_INSTANCE, data, NULL, length);
    DISABLE_MPU6000;

    return true;
}
开发者ID:180jacob,项目名称:cleanflight,代码行数:9,代码来源:accgyro_spi_mpu6000.c

示例3: readEepromPage

void readEepromPage(uint16_t address, uint16_t length)
{
	// here again we have a word address
	for (uint16_t addr = address * 2, i = 0; i < length; i++)
	{
		uint8_t ee = spiTransfer(0xA0, addr++, 0xFF);
		Serial.write(ee);
	}
	Serial.write(STK_OK);
}
开发者ID:aguegu,项目名称:ArduinoISP,代码行数:10,代码来源:ArduinoISP.cpp

示例4: spiTransfer

void LedControl::setRow(int addr, int row, byte value) {
    int offset;
    if(addr<0 || addr>=maxDevices)
	return;
    if(row<0 || row>7)
	return;
    offset=addr*8;
    status[offset+row]=value;
    spiTransfer(addr, row+1,status[offset+row]);
}
开发者ID:beaver999,项目名称:mygoodjob,代码行数:10,代码来源:GearLedControl.cpp

示例5: writeEnable

void writeEnable(void)
{
	ENABLE_EEPROM;

    spiTransfer(EEPROM_SPI, WRITE_ENABLE);

    DISABLE_EEPROM;

    delayMicroseconds(2);
}
开发者ID:jihlein,项目名称:FF32mini,代码行数:10,代码来源:eeprom.c

示例6: spiTransfer

void MAX7219::clearDisplay(int addr) {
	if (addr < 0 || addr >= maxDevices) return;

	int offset;
	offset = addr * 8;
	for (uint8_t i = 0; i < 8; i++) {
		status[offset + i] = 0;
		spiTransfer(addr, i + 1, status[offset + i]);
	}
}
开发者ID:pilate,项目名称:esp32-snippets,代码行数:10,代码来源:MAX7219.cpp

示例7: mpu9250SlowReadRegister

bool mpu9250SlowReadRegister(uint8_t reg, uint8_t length, uint8_t *data)
{
	ENABLE_MPU9250;
    delayMicroseconds(1);
    spiTransferByte(MPU9250_SPI_INSTANCE, reg | 0x80); // read transaction
    spiTransfer(MPU9250_SPI_INSTANCE, data, NULL, length);
    DISABLE_MPU9250;
    delayMicroseconds(1);

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

示例8: transposeData

void LedControl::clearDisplay(int addr) {
    int offset;

    if(addr<0 || addr>=maxDevices)
	return;
    offset=addr*8;
    for(int i=0;i<8;i++) {
	status[offset+i]=0;
    }
    if (anodeMode) {
    	transposeData(addr);
    	for(int i=0;i<8;i++) {
	    spiTransfer(addr, i+1, statusTransposed[offset+i]);
    	}
    } else {
    	for(int i=0;i<8;i++) {
	    spiTransfer(addr, i+1, status[offset+i]);
    	}
    }
}
开发者ID:beaver999,项目名称:mygoodjob,代码行数:20,代码来源:GearLedControl.cpp

示例9: spiTransfer

void LedControl::clearDisplay(int addr) {
    int offset;

    if(addr<0 || addr>=maxDevices)
	return;
    offset=addr*8;
    for(int i=0;i<8;i++) {
	status[offset+i]=0;
	spiTransfer(addr, i+1,status[offset+i]);
    }
}
开发者ID:jazzywhit,项目名称:Capstone,代码行数:11,代码来源:LedControl.cpp

示例10: m25p16_pageProgramBegin

void m25p16_pageProgramBegin(uint32_t address)
{
    uint8_t command[] = { M25P16_INSTRUCTION_PAGE_PROGRAM, (address >> 16) & 0xFF, (address >> 8) & 0xFF, address & 0xFF};

    m25p16_waitForReady(DEFAULT_TIMEOUT_MILLIS);

    m25p16_writeEnable();

    ENABLE_M25P16;

    spiTransfer(M25P16_SPI_INSTANCE, NULL, command, sizeof(command));
}
开发者ID:AlienWiiBF,项目名称:betaflight,代码行数:12,代码来源:flash_m25p16.c

示例11: spiTest

static bool spiTest(void)
{
    uint8_t out[] = { 0x9F, 0, 0, 0 };
    uint8_t in[4];

    spiSelect(true);
    spiTransfer(in, out, sizeof(out));
    spiSelect(false);
    if (in[1] == 0xEF)
        return true;

    return false;
}
开发者ID:nico-dh,项目名称:cleanflight,代码行数:13,代码来源:bus_spi.c

示例12: assert

MAX7219::MAX7219(SPI* spi, int numDevices) {
	assert(spi != nullptr);
	this->spi = spi;
	if (numDevices <= 0 || numDevices > 8) {
		numDevices = 8;
	}
	maxDevices = numDevices;

	for (uint8_t i = 0; i < 64; i++) {
		status[i] = 0x00;
	}
	for (int i = 0; i < maxDevices; i++) {
		spiTransfer(i, OP_DISPLAYTEST, 0);
		//scanlimit is set to max on startup
		setScanLimit(7, i);
		//decode is done in source
		spiTransfer(i, OP_DECODEMODE, 0);
		clearDisplay(i);
		//we go into shutdown-mode on startup
		shutdown(true, i);
	}
}
开发者ID:pilate,项目名称:esp32-snippets,代码行数:22,代码来源:MAX7219.cpp

示例13: m25p16_readStatus

static uint8_t m25p16_readStatus()
{
    uint8_t command[2] = { M25P16_INSTRUCTION_READ_STATUS_REG, 0 };
    uint8_t in[2];

    ENABLE_M25P16;

    spiTransfer(M25P16_SPI_INSTANCE, in, command, sizeof(command));

    DISABLE_M25P16;

    return in[1];
}
开发者ID:AlienWiiBF,项目名称:betaflight,代码行数:13,代码来源:flash_m25p16.c

示例14: m25p16_eraseSector

/**
 * Erase a sector full of bytes to all 1's at the given byte offset in the flash chip.
 */
void m25p16_eraseSector(uint32_t address)
{
    uint8_t out[] = { M25P16_INSTRUCTION_SECTOR_ERASE, (address >> 16) & 0xFF, (address >> 8) & 0xFF, address & 0xFF};

    m25p16_waitForReady(SECTOR_ERASE_TIMEOUT_MILLIS);

    m25p16_writeEnable();

    ENABLE_M25P16;

    spiTransfer(M25P16_SPI_INSTANCE, NULL, out, sizeof(out));

    DISABLE_M25P16;
}
开发者ID:AlienWiiBF,项目名称:betaflight,代码行数:17,代码来源:flash_m25p16.c

示例15: digitalWrite

/** \brief SPI command.

    Setup DC and SS pins, then send command via SPI to SSD1306 controller.
*/
void MicroOLED::command(uint8_t c) {

	if (interface == MODE_SPI)
	{
		digitalWrite(dcPin, LOW);
		digitalWrite(csPin, LOW);
		spiTransfer(c);
		digitalWrite(csPin, HIGH);
	}
	else if (interface == MODE_I2C)
	{
		digitalWrite(dcPin, LOW);	// DC pin LOW
		i2cWrite(I2C_ADDRESS_SA0_1, I2C_COMMAND, c);
	}
}
开发者ID:jgc,项目名称:SparkFun_Micro_OLED_Particle_Library12864,代码行数:19,代码来源:SparkFunMicroOLED12864.cpp


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