Skip to content

Commit

Permalink
Bug #6 fix
Browse files Browse the repository at this point in the history
Removed class "MCP7940_Class::" from the two Template function definitions.
  • Loading branch information
SV-Zanshin committed Oct 31, 2017
1 parent a5ed058 commit c49136e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion MCP7940.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ MCP7940_Class::~MCP7940_Class() {} // of class destructor //
** Method begin starts I2C communications with the device, using a default address if one is not specified and **
** return true if the device has been detected and false if it was not **
*******************************************************************************************************************/
bool MCP7940_Class::begin( ) { // Start I2C communications //
bool MCP7940_Class::begin() { // Start I2C communications //
Wire.begin(); // Start I2C as master device //
Wire.beginTransmission(MCP7940_ADDRESS); // Address the MCP7940M //
uint8_t errorCode = Wire.endTransmission(); // See if there's a device present //
Expand Down
5 changes: 3 additions & 2 deletions MCP7940.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
** **
** Vers. Date Developer Comments **
** ====== ========== ============================= ============================================================== **
** 1.0.5 2017-10-31 https://github.com/SV-Zanshin Bug #6 to remove classification on 2 template functions **
** 1.0.4c 2017-08-13 https://github.com/SV-Zanshin Enhancement #5 to remove checks after Wire.requestFrom() **
** 1.0.4b 2017-08-08 https://github.com/SV-Zanshin Replaced readRAM and writeRAM with template functions **
** 1.0.4a 2017-08-06 https://github.com/SV-Zanshin Removed unnecessary MCP7940_I2C_Delay and all references **
Expand Down Expand Up @@ -173,7 +174,7 @@
** or a structure. **
*************************************************************************************************************/
template< typename T > // method to read a structure //
uint8_t& MCP7940_Class::readRAM(const uint8_t addr,T &value) { // //
uint8_t& readRAM(const uint8_t addr,T &value) { // //
uint8_t* bytePtr = (uint8_t*)&value; // Pointer to structure beginning //
uint8_t structSize = sizeof(T); // Number of bytes in structure //
uint8_t i = 0; // loop counter //
Expand All @@ -187,7 +188,7 @@
return (i); // return bytes read //
} // of method readRAM() //----------------------------------//
template<typename T> // method to write any data type to //
bool MCP7940_Class::writeRAM(const uint8_t addr, const T &value) { // the MCP7940 SRAM //
bool writeRAM(const uint8_t addr, const T &value) { // the MCP7940 SRAM //
const uint8_t* bytePtr = (const uint8_t*)&value; // Pointer to structure beginning //
Wire.beginTransmission(MCP7940_ADDRESS); // Address the I2C device //
Wire.write((addr%64)+MCP7940_RAM_ADDRESS); // Send register address to write //
Expand Down

0 comments on commit c49136e

Please sign in to comment.