Skip to content
This repository was archived by the owner on Dec 29, 2023. It is now read-only.

Commit e660bf5

Browse files
Leonid KabanovLeonid Kabanov
Leonid Kabanov
authored and
Leonid Kabanov
committed
Working on SPI
1 parent 474e005 commit e660bf5

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

SPI.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,17 @@ void SPI::transfer(uint8_t* data, size_t dataLen) {
132132
}
133133
} // transmit
134134

135+
void SPI::transfer2(uint8_t* txData, uint8_t* rxData, size_t dataLen) {
136+
spi_transaction_t trans_desc;
137+
//trans_desc.address = 0;
138+
//trans_desc.command = 0;
139+
trans_desc.flags = 0;
140+
trans_desc.length = dataLen * 8;
141+
trans_desc.rxlength = 0;
142+
trans_desc.tx_buffer = txData;
143+
trans_desc.rx_buffer = rxData;
144+
} // transmit
145+
135146

136147
/**
137148
* @brief Send and receive a single byte.

SPI.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class SPI {
2323
int csPin = DEFAULT_CS_PIN);
2424
void setHost(spi_host_device_t host);
2525
void transfer(uint8_t* data, size_t dataLen);
26+
void transfer2(uint8_t* txData, uint8_t* rxData, size_t dataLen);
2627
uint8_t transferByte(uint8_t value);
2728

2829
/**

0 commit comments

Comments
 (0)