Skip to content

Commit ae8e169

Browse files
committed
Merge pull request #1685 from petermm/default-spi2
ESP32: Default SPI peripheral to non-deprecated value These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
2 parents 8806d07 + 13b1eb4 commit ae8e169

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5353

5454
- Removed `externalterm_to_term_copy` added in [0.6.5] and introduced flags to `externalterm_to_term` to perform copy.
5555
- Release images for ESP32 chips are built with ESP-IDF v5.4
56+
- ESP32: SPI peripheral defaults to `"spi2"` instead of deprecated `hspi`
5657

5758
### Fixed
5859

libs/eavmlib/src/spi.erl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343
-export([open/1, close/1, read_at/4, write_at/5, write/3, write_read/3]).
4444

45+
%% TODO remove deprecated hspi and vspi
4546
-type peripheral() :: hspi | vspi | string() | binary().
4647
-type bus_config() :: [
4748
{poci, non_neg_integer()}
@@ -102,7 +103,7 @@
102103
%% <tr> <td>`miso'</td> <td>`non_neg_integer()'</td> <td>-</td> <td>MISO pin number</td></tr>
103104
%% <tr> <td>`mosi'</td> <td>`non_neg_integer()'</td> <td>-</td> <td>MOSI pin number</td></tr>
104105
%% <tr> <td>`sclk'</td> <td>`non_neg_integer()'</td> <td>-</td> <td>SCLK pin number</td></tr>
105-
%% <tr> <td>`peripheral'</td> <td>`hspi | vspi'</td> <td>`hspi'</td> <td>SPI Peripheral (ESP32 only)</td></tr>
106+
%% <tr> <td>`peripheral'</td> <td>`"spi2" | "spi3"'</td> <td>`"spi2"'</td> <td>SPI Peripheral (ESP32 only)</td></tr>
106107
%% </table>
107108
%%
108109
%% Each device configuration is a properties list containing the following entries:
@@ -309,7 +310,7 @@ validate_bus_config(MaybeOldBusConfig) when
309310
->
310311
BusConfig = migrate_deprecated(MaybeOldBusConfig),
311312
ValidatedConfig0 = #{
312-
peripheral => validate_peripheral(get_value(peripheral, BusConfig, hspi)),
313+
peripheral => validate_peripheral(get_value(peripheral, BusConfig, <<"spi2">>)),
313314
sclk => validate_integer_entry(sclk, BusConfig)
314315
},
315316
ValidatedConfig1 = maybe_validate_optional_integer(miso, ValidatedConfig0, BusConfig),

0 commit comments

Comments
 (0)