1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-18 07:52:14 +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:
Cristian Maglie 2013-06-21 19:58:08 +02:00
parent 8b0b0a7d68
commit d101bf51a2
3 changed files with 8 additions and 5 deletions

View File

@ -20,6 +20,8 @@ ARDUINO 1.5.3 BETA
[libraries]
* 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]
* Arduino Due: fixed USB2Serial garbage at startup (https://github.com/arduino/Arduino/pull/1267)

View File

@ -13,13 +13,14 @@
SPIClass::SPIClass(Spi *_spi, uint32_t _id, void(*_initCb)(void)) :
spi(_spi), id(_id), initCb(_initCb)
{
initCb();
SPI_Configure(spi, id, SPI_MR_MSTR | SPI_MR_PS | SPI_MR_MODFDIS);
SPI_Enable(spi);
// Empty
}
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
// Default speed set to 4Mhz

View File

@ -84,7 +84,7 @@ extern "C"{
#define BOARD_SPI_SS1 (4u)
#define BOARD_SPI_SS2 (52u)
#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) \
(x==BOARD_SPI_SS0 ? PIN_SPI_SS0 : \