mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-30 19:52:13 +01:00
[sam] 2 bugfix to SPI library.
- begin() after end() now works. - unconnected SPI pin is selected as CS when old (non extended) API is used.
This commit is contained in:
parent
8b0b0a7d68
commit
d101bf51a2
@ -20,6 +20,8 @@ ARDUINO 1.5.3 BETA
|
|||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
* sam: Added CAN library (still in early stage of development) (Palliser)
|
* sam: Added CAN library (still in early stage of development) (Palliser)
|
||||||
|
* sam: Bugfix SPI library: begin() after end() now works (stimmer)
|
||||||
|
* sam: Bugfix SPI library: incorrent pin configuration in non-extended mode.
|
||||||
|
|
||||||
[firmwares]
|
[firmwares]
|
||||||
* Arduino Due: fixed USB2Serial garbage at startup (https://github.com/arduino/Arduino/pull/1267)
|
* Arduino Due: fixed USB2Serial garbage at startup (https://github.com/arduino/Arduino/pull/1267)
|
||||||
|
@ -13,13 +13,14 @@
|
|||||||
SPIClass::SPIClass(Spi *_spi, uint32_t _id, void(*_initCb)(void)) :
|
SPIClass::SPIClass(Spi *_spi, uint32_t _id, void(*_initCb)(void)) :
|
||||||
spi(_spi), id(_id), initCb(_initCb)
|
spi(_spi), id(_id), initCb(_initCb)
|
||||||
{
|
{
|
||||||
initCb();
|
// Empty
|
||||||
|
|
||||||
SPI_Configure(spi, id, SPI_MR_MSTR | SPI_MR_PS | SPI_MR_MODFDIS);
|
|
||||||
SPI_Enable(spi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SPIClass::begin() {
|
void SPIClass::begin() {
|
||||||
|
initCb();
|
||||||
|
SPI_Configure(spi, id, SPI_MR_MSTR | SPI_MR_PS | SPI_MR_MODFDIS);
|
||||||
|
SPI_Enable(spi);
|
||||||
|
|
||||||
// NPCS control is left to the user
|
// NPCS control is left to the user
|
||||||
|
|
||||||
// Default speed set to 4Mhz
|
// Default speed set to 4Mhz
|
||||||
|
@ -84,7 +84,7 @@ extern "C"{
|
|||||||
#define BOARD_SPI_SS1 (4u)
|
#define BOARD_SPI_SS1 (4u)
|
||||||
#define BOARD_SPI_SS2 (52u)
|
#define BOARD_SPI_SS2 (52u)
|
||||||
#define BOARD_SPI_SS3 PIN_SPI_SS3
|
#define BOARD_SPI_SS3 PIN_SPI_SS3
|
||||||
#define BOARD_SPI_DEFAULT_SS BOARD_SPI_SS2
|
#define BOARD_SPI_DEFAULT_SS BOARD_SPI_SS3
|
||||||
|
|
||||||
#define BOARD_PIN_TO_SPI_PIN(x) \
|
#define BOARD_PIN_TO_SPI_PIN(x) \
|
||||||
(x==BOARD_SPI_SS0 ? PIN_SPI_SS0 : \
|
(x==BOARD_SPI_SS0 ? PIN_SPI_SS0 : \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user