Skip to content

Commit

Permalink
drivers: sensor: mcp9600: fix wrong register address
Browse files Browse the repository at this point in the history
The address of most of the registers defined in
the driver are wrong. This fixes it, following
the correct numbering as can be found in the
device's datasheet. Moreover, re-grouping of
the macros according to their functionality.

Signed-off-by: Nikos Agianniotis <[email protected]>
  • Loading branch information
naNEQ authored and fabiobaltieri committed Dec 7, 2023
1 parent a3e5af9 commit ed61040
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions drivers/sensor/mcp9600/mcp9600.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,23 @@ LOG_MODULE_REGISTER(MCP9600, CONFIG_SENSOR_LOG_LEVEL);

#define MCP9600_REG_TC_CONFIG 0x05
#define MCP9600_REG_DEV_CONFIG 0x06
#define MCP9600_REG_A1_CONFIG 0x07

#define MCP9600_REG_A2_CONFIG 0x08
#define MCP9600_REG_A3_CONFIG 0x09
#define MCP9600_REG_A4_CONFIG 0x0A
#define MCP9600_A1_HYST 0x0B

#define MCP9600_A2_HYST 0x0C
#define MCP9600_A3_HYST 0x0D
#define MCP9600_A4_HYST 0x0E
#define MCP9600_A1_LIMIT 0x0F

#define MCP9600_A2_LIMIT 0x10
#define MCP9600_A3_LIMIT 0x11
#define MCP9600_A4_LIMIT 0x12
#define MCP9600_REG_ID_REVISION 0x13

#define MCP9600_REG_A1_CONFIG 0x08
#define MCP9600_REG_A2_CONFIG 0x09
#define MCP9600_REG_A3_CONFIG 0x0A
#define MCP9600_REG_A4_CONFIG 0x0B

#define MCP9600_A1_HYST 0x0C
#define MCP9600_A2_HYST 0x0D
#define MCP9600_A3_HYST 0x0E
#define MCP9600_A4_HYST 0x0F

#define MCP9600_A1_LIMIT 0x10
#define MCP9600_A2_LIMIT 0x11
#define MCP9600_A3_LIMIT 0x12
#define MCP9600_A4_LIMIT 0x13

#define MCP9600_REG_ID_REVISION 0x20

struct mcp9600_data {
int32_t temp;
Expand Down

0 comments on commit ed61040

Please sign in to comment.