Skip to content

Commit

Permalink
Merge pull request #5 from teamonestone/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jonas-merkle authored Oct 30, 2019
2 parents d1045aa + 489d49e commit 854d417
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"name": "Wire",
"frameworks": "arduino"
},
"version": "1.0.1",
"version": "1.0.2",
"frameworks": "arduino",
"platforms": "*"
}
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=TCA9548A
version=1.0.1
version=1.0.2
author=Jonas Merkle [JJM] <jonas.merkle@tam-onestone.net>
author=Dominik Authaler <dominik.authaler@team-onestone.net>
maintainer=Team Onestone <info@team-onestone.net>
Expand Down
29 changes: 15 additions & 14 deletions src/TCA9548A.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/**
* @file TCA9548A.cpp
* @brief The source file of the Arduino library for the I²C Multiplexer TCA9548A.
* @author Jonas Merkle [JJM]
* @author Jonas Merkle [JJM] <a href="mailto:jonas.merkle@tam-onestone.net">jonas.merkle@tam-onestone.net</a>
* @author Dominik Authaler <a href="mailto:dominik.authaler@team-onestone.net">dominik.authaler@team-onestone.net</a>
* @author
* This library is maintained by <a href="https://team-onestone.net">Team Onestone</a>.
* E-Mail: <a href="mailto:info@team-onestone.net">info@team-onestone.net</a>
* @version 1.0.1
* @date 02 December 2018
* @version 1.0.2
* @date 30 October 2019
* @copyright This project is released under the GNU General Public License v3.0
*/

Expand Down Expand Up @@ -53,8 +54,8 @@
* @brief Main construcor of the TCA9548A class.
*/
TCA9548A::TCA9548A() {
__addressTCA9548A = STD_TCA9548A_ADDRESS;
__portTCA9548A = 255;
_addressTCA9548A = _TCA9548A_STD_ADDRESS;
_portTCA9548A = 255;
}

/**
Expand All @@ -63,8 +64,8 @@ TCA9548A::TCA9548A() {
* @param address new i2c address.
*/
TCA9548A::TCA9548A(uint8_t address) {
__addressTCA9548A = address;
__portTCA9548A = 255;
_addressTCA9548A = address;
_portTCA9548A = 255;
}

/**
Expand Down Expand Up @@ -93,10 +94,10 @@ void TCA9548A::init() {
* @brief Disable the TCA9548A Multiplexer.
*/
void TCA9548A::disable() {
__portTCA9548A = 255;
_portTCA9548A = 255;

// disable all ports
Wire.beginTransmission(__addressTCA9548A);
Wire.beginTransmission(_addressTCA9548A);
Wire.write(0);
Wire.endTransmission();
}
Expand All @@ -109,11 +110,11 @@ void TCA9548A::disable() {
void TCA9548A::set_port(uint8_t port) {
// check if selected port is valid
if (port > 7) return;
__portTCA9548A = port;
_portTCA9548A = port;

// select port
Wire.beginTransmission(__addressTCA9548A);
Wire.write(1 << __portTCA9548A);
Wire.beginTransmission(_addressTCA9548A);
Wire.write(1 << _portTCA9548A);
Wire.endTransmission();
}

Expand All @@ -123,7 +124,7 @@ void TCA9548A::set_port(uint8_t port) {
* @return the current selected port on which the TCA9548A Multiplexer operates.
*/
uint8_t TCA9548A::get_port() {
return __portTCA9548A;
return _portTCA9548A;
}

/**
Expand All @@ -132,5 +133,5 @@ uint8_t TCA9548A::get_port() {
* @return the current version of the library.
*/
uint16_t TCA9548A::get_version() {
return _lib_version;
return _TCA9548A_LIB_VERSION;
}
33 changes: 16 additions & 17 deletions src/TCA9548A.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/**
* @file TCA9548A.h
* @brief The header file of the Arduino library for the I²C Multiplexer TCA9548A.
* @author Jonas Merkle [JJM]
* @author Jonas Merkle [JJM] <a href="mailto:jonas.merkle@tam-onestone.net">jonas.merkle@tam-onestone.net</a>
* @author Dominik Authaler <a href="mailto:dominik.authaler@team-onestone.net">dominik.authaler@team-onestone.net</a>
* @author
* This library is maintained by <a href="https://team-onestone.net">Team Onestone</a>.
* E-Mail: <a href="mailto:info@team-onestone.net">info@team-onestone.net</a>
* @version 1.0.1
* @date 02 December 2018
* @version 1.0.2
* @date 30 October 2019
* @copyright This project is released under the GNU General Public License v3.0
*/

Expand All @@ -19,7 +20,8 @@
#include <Wire.h>

// defines
#define STD_TCA9548A_ADDRESS 0x70 ///< The standard i2c address of the TCA9548A.
#define _TCA9548A_STD_ADDRESS 0x70 ///< The standard i2c address of the TCA9548A.
#define _TCA9548A_LIB_VERSION 102 ///< The version number of the library.

/**
* @class TCA9548A
Expand All @@ -30,30 +32,27 @@ class TCA9548A {
public:

// constructors
TCA9548A(); ///< Main construcor of the TCA9548A class.
TCA9548A(uint8_t address); ///< Constructor of the TCA9548A class with non standard i2c address.
~TCA9548A(); ///< Main destructor of the TCA9548A class.
TCA9548A(); // Main construcor of the TCA9548A class.
TCA9548A(uint8_t address); // Constructor of the TCA9548A class with non standard i2c address.
~TCA9548A(); // Main destructor of the TCA9548A class.

// init function
void init(); ///< Initialize the TCA9548A Multiplexer.
void init(); // Initialize the TCA9548A Multiplexer.

// functions
void disable(); ///< Disable the TCA9548A Multiplexer.
void set_port(uint8_t port); ///< Select the port on which the TCA9548A Multiplexer will operate.
uint8_t get_port(); ///< Get the current port on which the TCA9548A Multiplexer operates.
uint16_t get_version(); ///< Get the version of the library.
void disable(); // Disable the TCA9548A Multiplexer.
void set_port(uint8_t port); // Select the port on which the TCA9548A Multiplexer will operate.
uint8_t get_port(); // Get the current port on which the TCA9548A Multiplexer operates.
uint16_t get_version(); // Get the version of the library.

// End PUBLIC --------------------------------------------------------------------

// Begin PRIVATE -----------------------------------------------------------------
private:

// constants
uint16_t const _lib_version = 101;

// variables
uint8_t __addressTCA9548A;
uint8_t __portTCA9548A;
uint8_t _addressTCA9548A;
uint8_t _portTCA9548A;

// End PRIVATE -------------------------------------------------------------------
};
Expand Down

0 comments on commit 854d417

Please sign in to comment.