Skip to content

Commit b8cd3b9

Browse files
Merge pull request #286 from padok/master
Expose last wire.endTransmission code
2 parents 52885d1 + 4b37d87 commit b8cd3b9

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ Please do not hesitate to leave an issue if you have problems/advices/suggestion
132132

133133
Pull requests are welcome, but let's first discuss them in [community forum](https://community.simplefoc.com)!
134134

135-
If you'd like to contribute to this porject but you are not very familiar with github, don't worry, let us know either by posting at the community forum , by posting a github issue or at our discord server.
135+
If you'd like to contribute to this project but you are not very familiar with github, don't worry, let us know either by posting at the community forum , by posting a github issue or at our discord server.
136+
137+
If you are familiar, we accept pull requests to the dev branch!
136138

137139
## Arduino code example
138140
This is a simple Arduino code example implementing the velocity control program of a BLDC motor with encoder.

src/sensors/MagneticSensorI2C.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ int MagneticSensorI2C::read(uint8_t angle_reg_msb) {
9595
// notify the device that is aboout to be read
9696
wire->beginTransmission(chip_address);
9797
wire->write(angle_reg_msb);
98-
wire->endTransmission(false);
98+
currWireError = wire->endTransmission(false);
9999

100100
// read the data msb and lsb
101101
wire->requestFrom(chip_address, (uint8_t)2);

src/sensors/MagneticSensorI2C.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ class MagneticSensorI2C: public Sensor{
5151
/** experimental function to check and fix SDA locked LOW issues */
5252
int checkBus(byte sda_pin , byte scl_pin );
5353

54+
/** current error code from Wire endTransmission() call **/
55+
uint8_t currWireError = 0;
56+
5457
private:
5558
float cpr; //!< Maximum range of the magnetic sensor
5659
uint16_t lsb_used; //!< Number of bits used in LSB register

0 commit comments

Comments
 (0)