Skip to content

Commit

Permalink
Merge pull request #4 from sparkfun/release_candidate
Browse files Browse the repository at this point in the history
v1.0.2 Fix pin check
  • Loading branch information
PaulZC authored Oct 25, 2024
2 parents bf9cf34 + 585b653 commit e2d4c76
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=SparkFun Qwiic Power Switch Arduino Library
version=1.0.1
version=1.0.2
author=SparkFun Electronics <[email protected]>
maintainer=SparkFun Electronics <sparkfun.com>
sentence=Arduino library for the Qwiic Power Switch
Expand Down
8 changes: 4 additions & 4 deletions src/SparkFun_Qwiic_Power_Switch_Arduino_Library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ PCA9536_error_t QWIIC_POWER::pinMode(uint8_t pin, uint8_t mode)
PCA9536_error_t err;
uint8_t cfgRegister = 0;

if (pin > 4) return PCA9536_ERROR_UNDEFINED;
if (pin > 3) return PCA9536_ERROR_UNDEFINED;

err = readI2CRegister(&cfgRegister, PCA9536_REGISTER_CONFIGURATION);
if (err != PCA9536_ERROR_SUCCESS)
Expand All @@ -163,7 +163,7 @@ PCA9536_error_t QWIIC_POWER::write(uint8_t pin, uint8_t value)
PCA9536_error_t err;
uint8_t outputRegister = 0;

if (pin > 4) return PCA9536_ERROR_UNDEFINED;
if (pin > 3) return PCA9536_ERROR_UNDEFINED;

err = readI2CRegister(&outputRegister, PCA9536_REGISTER_OUTPUT_PORT);
if (err != PCA9536_ERROR_SUCCESS)
Expand Down Expand Up @@ -202,7 +202,7 @@ uint8_t QWIIC_POWER::read(uint8_t pin)
PCA9536_error_t err;
uint8_t inputRegister = 0;

if (pin > 4) return PCA9536_ERROR_UNDEFINED;
if (pin > 3) return PCA9536_ERROR_UNDEFINED;

err = readI2CRegister(&inputRegister, PCA9536_REGISTER_INPUT_PORT);
if (err != PCA9536_ERROR_SUCCESS)
Expand All @@ -222,7 +222,7 @@ PCA9536_error_t QWIIC_POWER::invert(uint8_t pin, PCA9536_invert_t inversion)
PCA9536_error_t err;
uint8_t invertRegister = 0;

if (pin > 4) return PCA9536_ERROR_UNDEFINED;
if (pin > 3) return PCA9536_ERROR_UNDEFINED;

err = readI2CRegister(&invertRegister, PCA9536_REGISTER_POLARITY_INVERSION);
if (err != PCA9536_ERROR_SUCCESS)
Expand Down

0 comments on commit e2d4c76

Please sign in to comment.