本文整理汇总了C++中spiTransfer函数的典型用法代码示例。如果您正苦于以下问题:C++ spiTransfer函数的具体用法?C++ spiTransfer怎么用?C++ spiTransfer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了spiTransfer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: digitalWrite
void CC2500xcvr::reset()
// REFERENCES: 19.1.2 "Manual Reset" in [1]
{
// enable device
digitalWrite(m_pinCS_n, LOW);
delayMicroseconds(1);
// disable device and wait at least 40 microseconds
digitalWrite(m_pinCS_n, HIGH);
delayMicroseconds(41);
spiTransactionBegin(); // enable device
spiTransfer(0x30); // send reset command (SRES)
spiTransactionEnd(); // disable device
}
开发者ID:reconvolution,项目名称:Zeptoduino,代码行数:15,代码来源:CC2500.cpp
示例17: writeFlash
void writeFlash(uint16_t address, uint16_t length)
{
if (length > _param.flash_pagesize || length > BUFF_LENGTH)
{
_error = true;
Serial.write(STK_FAILED);
return;
}
fill(length);
if (!receiveEop())
return;
for (uint8_t *p = _buff, word_length = length >> 1, i = 0; i < word_length;
i++)
{
spiTransfer(0x40, i, *p++);
spiTransfer(0x48, i, *p++);
}
spiTransfer(0x4C, getPage(address), 0);
Serial.write(STK_OK);
}
开发者ID:aguegu,项目名称:ArduinoISP,代码行数:24,代码来源:ArduinoISP.cpp
示例18: spiTransfer
/*
* Class: io_silverspoon_bulldog_linux_jni_NativeSpi
* Method: spiTransfer
* Signature: (IJJIIII)I
*/
JNIEXPORT jint JNICALL Java_io_silverspoon_bulldog_linux_jni_NativeSpi_spiTransfer
(JNIEnv * env , jclass clazz, jint fileDescriptor, jobject txBuffer, jobject rxBuffer, jint transferLength, jint delay, jint speed, jint bitsPerWord) {
unsigned int* pTx = NULL;
unsigned int* pRx = NULL;
if(txBuffer != NULL) {
pTx = (unsigned int*) (*env)->GetDirectBufferAddress(env, txBuffer);
}
if(rxBuffer != NULL) {
pRx = (unsigned int*) (*env)->GetDirectBufferAddress(env, rxBuffer);
}
return spiTransfer((int)fileDescriptor, (unsigned int*)pTx, (unsigned int*)pTx, (int)transferLength, (int)delay, (int)speed, (int)bitsPerWord);
}
开发者ID:mijaros,项目名称:bulldog,代码行数:20,代码来源:io_silverspoon_bulldog_linux_jni_NativeSpi.c
示例19: beginProgramming
void beginProgramming()
{
SPI.begin();
digitalWrite(RESET, HIGH);
pinMode(RESET, OUTPUT);
digitalWrite(SCK, LOW);
digitalWrite(RESET, LOW);
digitalWrite(RESET, HIGH);
digitalWrite(RESET, LOW);
delay(20);
spiTransfer(0xAC, 0x53, 0x00, 0x00);
_programming = true;
}
开发者ID:aguegu,项目名称:ArduinoISP,代码行数:17,代码来源:ArduinoISP.cpp
示例20: IF_CHECK_START_CMD
int SpiDrv::waitResponse(uint8_t cmd, uint8_t* numParamRead, uint8_t** params, uint8_t maxNumParams)
{
char _data = 0;
int i =0, ii = 0;
char *index[WL_SSID_MAX_LENGTH];
for (i = 0 ; i < WL_NETWORKS_LIST_MAXNUM ; i++)
index[i] = (char *)params + WL_SSID_MAX_LENGTH*i;
IF_CHECK_START_CMD(_data)
{
CHECK_DATA(cmd | REPLY_FLAG, _data){};
uint8_t numParam = readChar();
if (numParam > maxNumParams)
{
numParam = maxNumParams;
}
*numParamRead = numParam;
if (numParam != 0)
{
for (i=0; i<numParam; ++i)
{
uint8_t paramLen = readParamLen8();
for (ii=0; ii<paramLen; ++ii)
{
//ssid[ii] = spiTransfer(DUMMY_DATA);
// Get Params data
index[i][ii] = (uint8_t)spiTransfer(DUMMY_DATA);
}
index[i][ii]=0;
}
} else
{
WARN("Error numParams == 0");
readAndCheckChar(END_CMD, &_data);
return 0;
}
readAndCheckChar(END_CMD, &_data);
}
return 1;
}
开发者ID:drbokko,项目名称:86Duino,代码行数:45,代码来源:spi_drv.cpp
注:本文中的spiTransfer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论