MAX6642 I2C Temperature Sensor Interface implementation.
More...
#include "FreeRTOS.h"
#include "task.h"
#include "port.h"
#include "sdr.h"
#include "task_priorities.h"
#include "i2c.h"
#include "i2c_mapping.h"
#include "max6642.h"
#include "utils.h"
#include "uart_debug.h"
MAX6642 I2C Temperature Sensor Interface implementation.
- Author
- Henrique Silva henri.nosp@m.que..nosp@m.silva.nosp@m.@lnl.nosp@m.s.br, LNLS
◆ MAX6642_init()
void MAX6642_init |
( |
void | | ) |
|
Initializes MAX6642 sensor and creates vTaskMAX6642.
- Returns
- None
◆ max6642_read_cfg()
uint8_t max6642_read_cfg |
( |
sensor_t * | sensor | ) |
|
Reads MAX6642 configuration byte.
Cfg byte:
[7] - MASK1 - Disables 'ALERT interrupts
[6] - STOP/RUN - Puts MAX6642 in standby mode
[5] - External Only - disables local temperature measurements so that only remote temperature is measured. The measurement rate becomes 8Hz.
[4] - Fault queue - (0):'ALERT is set by single fault; (1):Two consecutive faults are required to assert 'ALERT
[3:0] - Reserved
- Parameters
-
sensor | Pointer to sensor info struct |
- Returns
- Configuration byte
◆ max6642_read_local()
Bool max6642_read_local |
( |
sensor_t * | sensor, |
|
|
uint8_t * | temp ) |
Reads MAX6642's local temperature value.
- Parameters
-
sensor | Pointer to sensor struct |
- Returns
- Temperature value
◆ max6642_read_local_extd()
Bool max6642_read_local_extd |
( |
sensor_t * | sensor, |
|
|
uint8_t * | temp ) |
Reads MAX6642's local extended temperature value.
The extended value is the fractional part of the reading, with 0.25 oC steps. The value is the 2 MSBits returned.
- Parameters
-
sensor | Pointer to sensor struct |
- Returns
- Extended temperature value (2 MSB)
◆ max6642_read_remote()
Bool max6642_read_remote |
( |
sensor_t * | sensor, |
|
|
uint8_t * | temp ) |
Reads MAX6642's remote temperature value.
- Parameters
-
sensor | Pointer to sensor struct |
- Returns
- Temperature value
◆ max6642_read_remote_extd()
Bool max6642_read_remote_extd |
( |
sensor_t * | sensor, |
|
|
uint8_t * | temp ) |
Reads MAX6642's remote extended temperature value.
The extended value is the fractional part of the reading, with 0.25 oC steps. The value is the 2 MSBits returned.
- Parameters
-
sensor | Pointer to sensor info struct |
- Returns
- Extended temperature value (2 MSB)
◆ max6642_read_status()
uint8_t max6642_read_status |
( |
sensor_t * | sensor | ) |
|
Reads MAX6642 status byte.
Status byte:
[7] - BUSY - Indicates the MAX6642 is busy converting data
[6] - LHIGH - Internal high temperature fault
[5] - Reserved
[4] - RHIGH - External high temperature fault
[3] - Reserved
[2] - OPEN - Diode open condition
[1:0] - Reserved
- Parameters
-
sensor | Pointer to sensor info struct |
- Returns
- Status byte
◆ max6642_write_cfg()
void max6642_write_cfg |
( |
sensor_t * | sensor, |
|
|
uint8_t | cfg ) |
Writes MAX6642 configuration byte.
Cfg byte:
[7] - MASK1 - Disables 'ALERT interrupts
[6] - STOP/RUN - Puts MAX6642 in standby mode
[5] - External Only - disables local temperature measurements so that only remote temperature is measured. The measurement rate becomes 8Hz.
[4] - Fault queue - (0):'ALERT is set by single fault; (1):Two consecutive faults are required to assert 'ALERT
[3:0] - Reserved
- Parameters
-
sensor | Pointer to sensor info struct |
cfg | Configuration byte |
- Returns
- None
◆ max6642_write_local_limit()
void max6642_write_local_limit |
( |
sensor_t * | sensor, |
|
|
uint8_t | limit ) |
Sets internal high temperature limit that asserts 'ALERT.
- Parameters
-
sensor | Pointer to sensor info struct |
limit | High temperature limit value |
◆ max6642_write_remote_limit()
void max6642_write_remote_limit |
( |
sensor_t * | sensor, |
|
|
uint8_t | limit ) |
Sets external high temperature limit that asserts 'ALERT.
- Parameters
-
sensor | Pointer to sensor info struct |
limit | High temperature limit value |
◆ vTaskMAX6642()
void vTaskMAX6642 |
( |
void * | Parameters | ) |
|
MAX6642 Monitor Task.
- Parameters
-
Parameters | Pointer to parameter list passed to task upon initialization (not used here) |
◆ vTaskMAX6642_Handle
TaskHandle_t vTaskMAX6642_Handle |
MAX6642 monitor Task Handle.