no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
adt75.h
Go to the documentation of this file.
1/***************************************************************************/
33#ifndef _ADT75_H
34#define _ADT75_H
35
36#include <stdint.h>
37#include "no_os_i2c.h"
38
40#define ADT75_ADDR(x) (0x48 + (x))
41#define ADT75_CONV_DELAY_MS 40
42#define ADT75_FRAME_SIZE 3
43
44#define ADT75_TEMP_VALUE_REG 0x0
45#define ADT75_CONF_REG 0x1
46#define ADT75_HYST_REG 0x2
47#define ADT75_OS_REG 0x3
48#define ADT75_ONE_SHOT_REG 0x4
49
50#define ADT75_DATA_REG_MASK NO_OS_GENMASK(2, 0)
51#define ADT75_CONFIG_REG_MASK NO_OS_GENMASK(7, 0)
52
53#define ADT75_TEMP_MASK NO_OS_GENMASK(15, 4)
54#define ADT75_SIGN_BIT 11
55
57#define ADT75_SHUTDOWN_MASK NO_OS_BIT(0)
58#define ADT75_COMP_INT_MASK NO_OS_BIT(1)
59#define ADT75_ALERT_POL_MASK NO_OS_BIT(2)
60#define ADT75_FAULT_QUEUE_MASK NO_OS_GENMASK(4, 3)
61#define ADT75_ONESHOT_MASK NO_OS_BIT(5)
62
63#define ADT75_HYST_MASK NO_OS_GENMASK(15, 4)
64#define ADT75_OVER_TEMP_MASK NO_OS_GENMASK(15, 4)
65
67#define ADT75_TEMP_DIV 16
68
75
79struct adt75_desc {
81};
82
84int adt75_get_single_temp(struct adt75_desc *, int32_t *);
85
87int adt75_reg_read(struct adt75_desc *, uint32_t, uint16_t *);
88
90int adt75_reg_write(struct adt75_desc *, uint32_t, uint16_t);
91
93int adt75_init(struct adt75_desc **, struct adt75_init_param *);
94
96int adt75_remove(struct adt75_desc *);
97
98#endif // _ADT75_H
int adt75_reg_write(struct adt75_desc *, uint32_t, uint16_t)
Write a raw value to a register.
Definition adt75.c:82
int adt75_remove(struct adt75_desc *)
Free the device descriptor.
Definition adt75.c:154
int adt75_get_single_temp(struct adt75_desc *, int32_t *)
Read the current temperature sample (in milliCelsius)
Definition adt75.c:101
int adt75_init(struct adt75_desc **, struct adt75_init_param *)
Initialize the device structure.
Definition adt75.c:126
int adt75_reg_read(struct adt75_desc *, uint32_t, uint16_t *)
Read the raw value of a register.
Definition adt75.c:50
Header file of I2C Interface.
ADT75 device descriptor.
Definition adt75.h:79
struct no_os_i2c_desc * comm_desc
Definition adt75.h:80
Initialization parameter for the device descriptor.
Definition adt75.h:72
struct no_os_i2c_init_param comm_param
Definition adt75.h:73
Structure holding I2C address descriptor.
Definition no_os_i2c.h:89
Structure holding the parameters for I2C initialization.
Definition no_os_i2c.h:52