kopia lustrzana https://github.com/jgromes/RadioLib
Removed unused SPI methods
rodzic
9c9d2b7ec4
commit
0c11156e65
|
@ -151,16 +151,7 @@ int16_t Module::SPIsetRegValue(uint8_t reg, uint8_t value, uint8_t msb, uint8_t
|
|||
|
||||
void Module::SPIreadRegisterBurst(uint8_t reg, uint8_t numBytes, uint8_t* inBytes) {
|
||||
digitalWrite(_cs, LOW);
|
||||
SPI.transfer(reg | SPI_READ);
|
||||
for(uint8_t i = 0; i < numBytes; i++) {
|
||||
inBytes[i] = SPI.transfer(reg);
|
||||
}
|
||||
digitalWrite(_cs, HIGH);
|
||||
}
|
||||
|
||||
void Module::SPIreadRegisterBurstStr(uint8_t reg, uint8_t numBytes, char* inBytes) {
|
||||
digitalWrite(_cs, LOW);
|
||||
SPI.transfer(reg | SPI_READ);
|
||||
SPI.transfer(reg | SPIreadCommand);
|
||||
for(uint8_t i = 0; i < numBytes; i++) {
|
||||
inBytes[i] = SPI.transfer(reg);
|
||||
}
|
||||
|
@ -171,7 +162,7 @@ uint8_t Module::SPIreadRegister(uint8_t reg) {
|
|||
uint8_t inByte;
|
||||
digitalWrite(_cs, LOW);
|
||||
SPI.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0));
|
||||
SPI.transfer(reg | SPI_READ);
|
||||
SPI.transfer(reg | SPIreadCommand);
|
||||
SPI.endTransaction();
|
||||
inByte = SPI.transfer(0x00);
|
||||
digitalWrite(_cs, HIGH);
|
||||
|
@ -180,16 +171,7 @@ uint8_t Module::SPIreadRegister(uint8_t reg) {
|
|||
|
||||
void Module::SPIwriteRegisterBurst(uint8_t reg, uint8_t* data, uint8_t numBytes) {
|
||||
digitalWrite(_cs, LOW);
|
||||
SPI.transfer(reg | SPI_WRITE);
|
||||
for(uint8_t i = 0; i < numBytes; i++) {
|
||||
SPI.transfer(data[i]);
|
||||
}
|
||||
digitalWrite(_cs, HIGH);
|
||||
}
|
||||
|
||||
void Module::SPIwriteRegisterBurstStr(uint8_t reg, const char* data, uint8_t numBytes) {
|
||||
digitalWrite(_cs, LOW);
|
||||
SPI.transfer(reg | SPI_WRITE);
|
||||
SPI.transfer(reg | SPIwriteCommand);
|
||||
for(uint8_t i = 0; i < numBytes; i++) {
|
||||
SPI.transfer(data[i]);
|
||||
}
|
||||
|
@ -199,7 +181,7 @@ void Module::SPIwriteRegisterBurstStr(uint8_t reg, const char* data, uint8_t num
|
|||
void Module::SPIwriteRegister(uint8_t reg, uint8_t data) {
|
||||
digitalWrite(_cs, LOW);
|
||||
SPI.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0));
|
||||
SPI.transfer(reg | SPI_WRITE);
|
||||
SPI.transfer(reg | SPIwriteCommand);
|
||||
SPI.transfer(data);
|
||||
SPI.endTransaction();
|
||||
digitalWrite(_cs, HIGH);
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
|
||||
#include "TypeDef.h"
|
||||
|
||||
#define SPI_READ 0b00000000
|
||||
#define SPI_WRITE 0b10000000
|
||||
|
||||
class Module {
|
||||
public:
|
||||
Module(int cs, int int0, int int1);
|
||||
|
@ -20,6 +17,9 @@ class Module {
|
|||
uint32_t baudrate = 9600;
|
||||
const char* AtLineFeed = "\r\n";
|
||||
|
||||
uint8_t SPIreadCommand = 0b00000000;
|
||||
uint8_t SPIwriteCommand = 0b10000000;
|
||||
|
||||
void init(uint8_t interface, uint8_t gpio);
|
||||
|
||||
void ATemptyBuffer();
|
||||
|
@ -31,11 +31,9 @@ class Module {
|
|||
int16_t SPIsetRegValue(uint8_t reg, uint8_t value, uint8_t msb = 7, uint8_t lsb = 0);
|
||||
|
||||
void SPIreadRegisterBurst(uint8_t reg, uint8_t numBytes, uint8_t* inBytes);
|
||||
void SPIreadRegisterBurstStr(uint8_t reg, uint8_t numBytes, char* str);
|
||||
uint8_t SPIreadRegister(uint8_t reg);
|
||||
|
||||
void SPIwriteRegisterBurst(uint8_t reg, uint8_t* data, uint8_t numBytes);
|
||||
void SPIwriteRegisterBurstStr(uint8_t reg, const char* data, uint8_t numBytes);
|
||||
void SPIwriteRegister(uint8_t reg, uint8_t data);
|
||||
|
||||
int int0() const { return(_int0); }
|
||||
|
|
Ładowanie…
Reference in New Issue