Skip to content

Commit

Permalink
V1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinlyonsrepo committed Dec 22, 2022
1 parent 0c10747 commit e5b8b66
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 132 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,12 @@ Set the functional mode, Tos and Thyst: if that functionally desired.
**Connections**

The Sensor uses I2C for communication's, data is outputted to a PC.
Pins and I2C port can be set in the main.cpp. Default is I2C0 and GPIO16(data) GPIO17(clock).
If you want to use the other I2C port (I2C1) in addition to changing in the main.ccp,
The user must change it in library (lm75.h) as well:
* i2c_inst_t *i2c = i2c0 to i2c_inst_t *i2c = i2c1
Could not find a way around this.
Pins and I2C port(I2C0 or I2C1) can be set in the main.cpp. Default is I2C0 and GPIO16(data) GPIO17(clock).

**Files**

The main.cpp contains tests showing library functions
There is also the library files(LM75A.cpp and LM75A.h),
There is also the library files(LM75A.cpp and LM75A.hpp),

**Output**

Expand Down
2 changes: 2 additions & 0 deletions extra/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

* version 1.0.0 September 2022
* first release
* version 1.0.1 December 2022
* Change so user can pick any I2C interface (IC20 or IC21)


17 changes: 10 additions & 7 deletions include/lm75/lm75.h → include/lm75/lm75.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Project Name: Library for the LM75A temperature sensor by NXP and Texas Instruments.
* File: lm75.h
* File: lm75.hpp
* Description: library header file
* Author: Gavin Lyons.
* IDE: Rpi=PICo rp2040 C++
Expand Down Expand Up @@ -53,7 +53,11 @@ class LIB_LM75A
{
private:
// Private variables
uint8_t _i2cAddress;
uint8_t _i2cAddress;
i2c_inst_t *i2c = i2c0; // i2C port number, i2c1 or i2c0
uint8_t _SDataPin;
uint8_t _SClkPin;
uint16_t _CLKSpeed = 100; //I2C bus speed in khz typically 100-400

// Private functions
uint8_t read8bitRegister(const uint8_t reg);
Expand All @@ -64,11 +68,11 @@ class LIB_LM75A
public:

// Constructor
LIB_LM75A(uint8_t address);
LIB_LM75A(uint8_t address, i2c_inst_t* i2c_type, uint8_t SDApin, uint8_t SCLKpin, uint16_t CLKspeed);

//I2c init & deinit
void initLM75A(i2c_inst_t* i2c_type, uint8_t SDApin, uint8_t SCLKpin, uint16_t CLKspeed);
void deinitLM75A(i2c_inst_t* i2c_type);
void initLM75A();
void deinitLM75A();

// Power management
void shutdown();
Expand Down Expand Up @@ -96,8 +100,7 @@ class LIB_LM75A
uint8_t getConfig();
float getProdId();

i2c_inst_t *i2c = i2c0; // i2C port number
int16_t return_value = 0; //return value
int16_t return_value = 0; //return value, I2C routines
};

#endif
Loading

0 comments on commit e5b8b66

Please sign in to comment.