Skip to content

Commit 8b942cb

Browse files
authored
Fix #32, improve SPI dependency (#33)
- Fix #32, improve handling SPI dependency. - update examples
1 parent 65e8190 commit 8b942cb

File tree

16 files changed

+32
-17
lines changed

16 files changed

+32
-17
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88

9+
## [0.5.0] - 2024-01-20
10+
- Fix #32, improve handling SPI dependency.
11+
- update examples
12+
13+
----
14+
915
## [0.4.0] - 2023-12-24
1016
- Fix #30, support for Arduino ESP32 S3 - breaking change
1117
- update readme.md

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021-2023 Rob Tillaart
3+
Copyright (c) 2021-2024 Rob Tillaart
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

MCP23S17.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// FILE: MCP23S17.cpp
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.4.0
4+
// VERSION: 0.5.0
55
// PURPOSE: Arduino library for SPI MCP23S17 16 channel port expander
66
// DATE: 2021-12-30
77
// URL: https://github.com/RobTillaart/MCP23S17
@@ -50,8 +50,8 @@ bool MCP23S17::begin()
5050

5151
if (_hwSPI)
5252
{
53-
_mySPI->end();
54-
_mySPI->begin();
53+
// _mySPI->end();
54+
// _mySPI->begin();
5555
}
5656
else
5757
{

MCP23S17.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// FILE: MCP23S17.h
44
// AUTHOR: Rob Tillaart
5-
// VERSION: 0.4.0
5+
// VERSION: 0.5.0
66
// PURPOSE: Arduino library for SPI MCP23S17 16 channel port expander
77
// DATE: 2021-12-30
88
// URL: https://github.com/RobTillaart/MCP23S17
@@ -13,7 +13,7 @@
1313
#include "MCP23S17_registers.h"
1414

1515

16-
#define MCP23S17_LIB_VERSION (F("0.4.0"))
16+
#define MCP23S17_LIB_VERSION (F("0.5.0"))
1717

1818
// ERROR CODES
1919
#define MCP23S17_OK 0x00

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ This IC is strongly related to the MCP23017 I2C port expander - https://github.c
2222
Programming Interface is kept the same as much as possible.
2323

2424

25+
#### 0.5.0 Breaking change
26+
27+
Version 0.5.0 introduced a breaking change to improve handling the SPI dependency.
28+
The user has to call **SPI.begin()** or equivalent before calling **MCP.begin()**.
29+
Optionally the user can provide parameters to the **SPI.begin(...)**
30+
31+
2532
#### 0.4.0 Breaking change
2633

2734
The version 0.4.0 has breaking changes in the interface.

examples/MCP23S17_digitalRead/MCP23S17_digitalRead.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77

88
#include "MCP23S17.h"
9-
#include "SPI.h"
109

1110

1211
MCP23S17 MCP(10);
@@ -22,6 +21,7 @@ void setup()
2221
delay(100);
2322

2423
SPI.begin();
24+
2525
rv = MCP.begin();
2626
Serial.println(rv ? "true" : "false");
2727

examples/MCP23S17_digitalWrite/MCP23S17_digitalWrite.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
#include "MCP23S17.h"
9-
#include "SPI.h"
9+
1010

1111
MCP23S17 MCP(10, 5, 6, 7); // SW SPI address 0x00
1212

@@ -20,6 +20,7 @@ void setup()
2020
delay(100);
2121

2222
SPI.begin();
23+
2324
bool b = MCP.begin();
2425
Serial.println(b ? "true" : "false");
2526
delay(100);

examples/MCP23S17_four_ADDRESS_array/MCP23S17_four_ADDRESS_array.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99

1010
#include "MCP23S17.h"
11-
#include "SPI.h"
1211

1312

1413
MCP23S17 MCP_A(10, 12, 11, 13, 0); // SW SPI, address 0
@@ -34,6 +33,7 @@ void setup()
3433
delay(100);
3534

3635
SPI.begin();
36+
3737
for (int addr = 0; addr < 4; addr++)
3838
{
3939
MCP[addr].begin();

examples/MCP23S17_performance/MCP23S17_performance.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
#include "MCP23S17.h"
9-
#include "SPI.h"
9+
1010

1111
// MCP23S17 MCP(10, 12, 11, 13); // SW SPI address 0x00
1212
MCP23S17 MCP(10); // HW SPI address 0x00
@@ -28,6 +28,7 @@ void setup()
2828
delay(100);
2929

3030
SPI.begin();
31+
3132
bool b = MCP.begin();
3233
Serial.println(b ? "true" : "false");
3334

examples/MCP23S17_test/MCP23S17_test.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77

88
#include "MCP23S17.h"
9-
#include "SPI.h"
109

1110

1211
// MCP23S17 MCP(10, 12, 11, 13); // SW SPI address 0x00
@@ -23,6 +22,7 @@ void setup()
2322
delay(100);
2423

2524
SPI.begin();
25+
2626
bool b = MCP.begin();
2727
Serial.println(b ? "true" : "false");
2828

0 commit comments

Comments
 (0)