Skip to content

library: Wire/SPI: change default pins type #1438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions cores/arduino/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ _Static_assert(NUM_ANALOG_INPUTS <= MAX_ANALOG_INPUTS,
#define PIN_SPI_SCK 13
#endif

static const uint8_t SS = PIN_SPI_SS;
static const uint8_t SS1 = PIN_SPI_SS1;
static const uint8_t SS2 = PIN_SPI_SS2;
static const uint8_t SS3 = PIN_SPI_SS3;
static const uint8_t MOSI = PIN_SPI_MOSI;
static const uint8_t MISO = PIN_SPI_MISO;
static const uint8_t SCK = PIN_SPI_SCK;
static const uint32_t SS = PIN_SPI_SS;
static const uint32_t SS1 = PIN_SPI_SS1;
static const uint32_t SS2 = PIN_SPI_SS2;
static const uint32_t SS3 = PIN_SPI_SS3;
static const uint32_t MOSI = PIN_SPI_MOSI;
static const uint32_t MISO = PIN_SPI_MISO;
static const uint32_t SCK = PIN_SPI_SCK;

/* I2C Definitions */
#ifndef PIN_WIRE_SDA
Expand All @@ -80,8 +80,8 @@ static const uint8_t SCK = PIN_SPI_SCK;
#define PIN_WIRE_SCL 15
#endif

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;
static const uint32_t SDA = PIN_WIRE_SDA;
static const uint32_t SCL = PIN_WIRE_SCL;

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion libraries/SPI/src/SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ SPIClass::SPIClass() : _CSPinConfig(NO_CONFIG)
* another CS pin and don't pass a CS pin as parameter to any functions
* of the class.
*/
SPIClass::SPIClass(uint8_t mosi, uint8_t miso, uint8_t sclk, uint8_t ssel) : _CSPinConfig(NO_CONFIG)
SPIClass::SPIClass(uint32_t mosi, uint32_t miso, uint32_t sclk, uint32_t ssel) : _CSPinConfig(NO_CONFIG)
{
_spi.pin_miso = digitalPinToPinName(miso);
_spi.pin_mosi = digitalPinToPinName(mosi);
Expand Down
2 changes: 1 addition & 1 deletion libraries/SPI/src/SPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class SPISettings {
class SPIClass {
public:
SPIClass();
SPIClass(uint8_t mosi, uint8_t miso, uint8_t sclk, uint8_t ssel = (uint8_t)NC);
SPIClass(uint32_t mosi, uint32_t miso, uint32_t sclk, uint32_t ssel = PNUM_NOT_DEFINED);

// setMISO/MOSI/SCLK/SSEL have to be called before begin()
void setMISO(uint32_t miso)
Expand Down
4 changes: 2 additions & 2 deletions libraries/Wire/src/Wire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ TwoWire::TwoWire()
_i2c.scl = digitalPinToPinName(SCL);
}

TwoWire::TwoWire(uint8_t sda, uint8_t scl)
TwoWire::TwoWire(uint32_t sda, uint32_t scl)
{
_i2c.sda = digitalPinToPinName(sda);
_i2c.scl = digitalPinToPinName(scl);
}

// Public Methods //////////////////////////////////////////////////////////////

void TwoWire::begin(uint8_t sda, uint8_t scl)
void TwoWire::begin(uint32_t sda, uint32_t scl)
{
_i2c.sda = digitalPinToPinName(sda);
_i2c.scl = digitalPinToPinName(scl);
Expand Down
4 changes: 2 additions & 2 deletions libraries/Wire/src/Wire.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class TwoWire : public Stream {

public:
TwoWire();
TwoWire(uint8_t sda, uint8_t scl);
TwoWire(uint32_t sda, uint32_t scl);
// setSCL/SDA have to be called before begin()
void setSCL(uint32_t scl)
{
Expand All @@ -83,7 +83,7 @@ class TwoWire : public Stream {
_i2c.sda = sda;
};
void begin(bool generalCall = false);
void begin(uint8_t, uint8_t);
void begin(uint32_t, uint32_t);
void begin(uint8_t, bool generalCall = false);
void begin(int, bool generalCall = false);
void end();
Expand Down