mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-17 06:52:18 +01:00
SPI library compatibility fix
This commit is contained in:
parent
3b0d08af6b
commit
301585f1fc
@ -19,6 +19,14 @@ SPIClass::SPIClass(Spi *_spi, uint32_t _id, void(*_initCb)(void)) :
|
||||
SPI_Enable(spi);
|
||||
}
|
||||
|
||||
void SPIClass::begin() {
|
||||
// NPCS control is left to the user
|
||||
|
||||
// Default speed set to 500Khz
|
||||
setClockDivider(BOARD_SPI_DEFAULT_SS, 168);
|
||||
setDataMode(BOARD_SPI_DEFAULT_SS, SPI_MODE0);
|
||||
}
|
||||
|
||||
void SPIClass::begin(uint8_t _pin) {
|
||||
uint32_t spiPin = BOARD_PIN_TO_SPI_PIN(_pin);
|
||||
PIO_Configure(
|
||||
|
@ -28,7 +28,7 @@ class SPIClass {
|
||||
public:
|
||||
SPIClass(Spi *_spi, uint32_t _id, void(*_initCb)(void));
|
||||
|
||||
//byte transfer(uint8_t _data, SPITransferMode _mode = SPI_LAST) { transfer(BOARD_PIN_SS_DEFAULT, _data, _mode); }
|
||||
byte transfer(uint8_t _data, SPITransferMode _mode = SPI_LAST) { return transfer(BOARD_SPI_DEFAULT_SS, _data, _mode); }
|
||||
byte transfer(byte _channel, uint8_t _data, SPITransferMode _mode = SPI_LAST);
|
||||
|
||||
// SPI Configuration methods
|
||||
@ -37,7 +37,7 @@ class SPIClass {
|
||||
void detachInterrupt(void);
|
||||
|
||||
void begin(uint8_t _channel);
|
||||
//void begin(void) { begin(BOARD_PIN_SS_DEFAULT); };
|
||||
void begin(void);
|
||||
void end(void);
|
||||
|
||||
// These methods sets a parameter on a single pin
|
||||
@ -47,8 +47,8 @@ class SPIClass {
|
||||
|
||||
// These methods sets the same parameters but on default pin PIN_SPI_SS_DEFAULT
|
||||
//void setBitOrder(uint8_t _order) { setBitOrder(PIN_SPI_SS_DEFAULT, _order); };
|
||||
//void setDataMode(uint8_t _mode) { setDataMode(BOARD_PIN_SS_DEFAULT, _mode); };
|
||||
//void setClockDivider(uint8_t _div) { setClockDivider(BOARD_PIN_SS_DEFAULT, _div); };
|
||||
void setDataMode(uint8_t _mode) { setDataMode(BOARD_SPI_DEFAULT_SS, _mode); };
|
||||
void setClockDivider(uint8_t _div) { setClockDivider(BOARD_SPI_DEFAULT_SS, _div); };
|
||||
|
||||
private:
|
||||
Spi *spi;
|
||||
|
@ -102,7 +102,7 @@
|
||||
* SO | PA25
|
||||
* SI | PA26
|
||||
* SCK | PA27
|
||||
* #CS SS3 | PB23
|
||||
* #CS NPCS3 | PB23
|
||||
*
|
||||
*
|
||||
* USB pin | PORT
|
||||
|
@ -96,7 +96,7 @@ extern "C"{
|
||||
#define BOARD_SPI_SS1 (4u)
|
||||
#define BOARD_SPI_SS2 (52u)
|
||||
#define BOARD_SPI_SS3 PIN_SPI_SS3
|
||||
#define BOARD_PIN_SS_DEFAULT BOARD_SPI_SS2
|
||||
#define BOARD_SPI_DEFAULT_SS BOARD_SPI_SS2
|
||||
|
||||
#define BOARD_PIN_TO_SPI_PIN(x) \
|
||||
(x==BOARD_SPI_SS0 ? PIN_SPI_SS0 : \
|
||||
|
Loading…
x
Reference in New Issue
Block a user