Skip to content

Commit a2d9587

Browse files
committed
up to 24 mhz SPI on SAMD51. added another ESP32 def
1 parent 9daef7b commit a2d9587

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

libraries/SPI/SPI.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@
3737
#define SPI_MODE2 0x03
3838
#define SPI_MODE3 0x01
3939

40-
#if defined(ARDUINO_ARCH_SAMD)
40+
#if defined(__SAMD51__)
4141
// The datasheet specifies a typical SPI SCK period (tSCK) of 42 ns,
4242
// see "Table 36-48. SPI Timing Characteristics and Requirements",
4343
// which translates into a maximum SPI clock of 23.8 MHz.
4444
// Conservatively, the divider is set for a 12 MHz maximum SPI clock.
45+
#define SPI_MIN_CLOCK_DIVIDER (uint8_t)(1 + ((F_CPU - 1) / 24000000))
46+
#else
4547
#define SPI_MIN_CLOCK_DIVIDER (uint8_t)(1 + ((F_CPU - 1) / 12000000))
4648
#endif
4749

variants/pyportal_m4/variant.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ static const uint8_t ATN = PIN_ATN;
131131
#define SPIWIFI_SS 8
132132
#define SPIWIFI_ACK 5
133133
#define SPIWIFI_RESET 7
134+
#define SerialESP32 Serial1
134135

135136
/*
136137
* Serial interfaces

0 commit comments

Comments
 (0)