openMMC
Open Source Modular MMC for AMCs
Loading...
Searching...
No Matches
max6642.h
Go to the documentation of this file.
1/*
2 * openMMC -- Open Source modular IPM Controller firmware
3 *
4 * Copyright (C) 2015-2016 Henrique Silva <henrique.silva@lnls.br>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>
20 */
21
35#ifndef MAX6642_H_
36#define MAX6642_H_
37
38#define MAX6642_UPDATE_RATE 500
39
40#define MAX6642_CMD_READ_LOCAL 0x00
41#define MAX6642_CMD_READ_REMOTE 0x01
42#define MAX6642_CMD_READ_STATUS 0x02
43#define MAX6642_CMD_READ_CONFIG 0x03
44#define MAX6642_CMD_READ_LOCAL_LIMIT 0x05
45#define MAX6642_CMD_READ_REMOTE_LIMIT 0x07
46#define MAX6642_CMD_WRITE_CONFIG 0x09
47#define MAX6642_CMD_WRITE_LOCAL_LIMIT 0x0B
48#define MAX6642_CMD_WRITE_REMOTE_LIMIT 0x0D
49#define MAX6642_CMD_SINGLESHOT 0x0D
50#define MAX6642_CMD_READ_REMOTE_EXTD 0x10
51#define MAX6642_CMD_READ_LOCAL_EXTD 0x11
52#define MAX6642_CMD_READ_MANUF_ID 0xFE
53
54/* MAX6642 Configuration bits */
55#define MAX6642_CFG_ALERT_MASK (1 << 7)
56#define MAX6642_CFG_STOP_RUN_MASK (1 << 6)
57#define MAX6642_CFG_EXT_ONLY_MASK (1 << 5)
58#define MAX6642_CFG_FAULT_QUEUE_MASK (1 << 4)
59
60/* MAX6642 Status bits */
61#define MAX6642_STATUS_BUSY_MASK (1 << 7)
62#define MAX6642_STATUS_LOCAL_HIGH_MASK (1 << 6)
63#define MAX6642_STATUS_REMOTE_HIGH_MASK (1 << 5)
64#define MAX6642_STATUS_OPEN_MASK (1 << 4)
65
69extern TaskHandle_t vTaskMAX6642_Handle;
70
72
78void MAX6642_init( void );
79
85void vTaskMAX6642( void *Parameters );
86
94Bool max6642_read_local( sensor_t *sensor, uint8_t *temp );
95
103Bool max6642_read_remote( sensor_t *sensor, uint8_t *temp );
104
114Bool max6642_read_local_extd( sensor_t *sensor, uint8_t *temp );
115
125Bool max6642_read_remote_extd( sensor_t *sensor, uint8_t *temp );
126
143uint8_t max6642_read_status( sensor_t *sensor );
144
159uint8_t max6642_read_cfg( sensor_t *sensor );
160
176void max6642_write_cfg( sensor_t *sensor, uint8_t cfg );
177
184void max6642_write_local_limit( sensor_t *sensor, uint8_t limit );
185
192void max6642_write_remote_limit( sensor_t *sensor, uint8_t limit );
193
194#endif
void max6642_write_cfg(sensor_t *sensor, uint8_t cfg)
Writes MAX6642 configuration byte.
Definition max6642.c:183
const SDR_type_01h_t SDR_MAX6642_FPGA
void max6642_write_local_limit(sensor_t *sensor, uint8_t limit)
Sets internal high temperature limit that asserts 'ALERT.
Definition max6642.c:195
uint8_t max6642_read_status(sensor_t *sensor)
Reads MAX6642 status byte.
Definition max6642.c:153
Bool max6642_read_remote_extd(sensor_t *sensor, uint8_t *temp)
Reads MAX6642's remote extended temperature value.
Definition max6642.c:135
Bool max6642_read_remote(sensor_t *sensor, uint8_t *temp)
Reads MAX6642's remote temperature value.
Definition max6642.c:99
void max6642_write_remote_limit(sensor_t *sensor, uint8_t limit)
Sets external high temperature limit that asserts 'ALERT.
Definition max6642.c:207
TaskHandle_t vTaskMAX6642_Handle
MAX6642 monitor Task Handle.
Definition max6642.c:44
Bool max6642_read_local(sensor_t *sensor, uint8_t *temp)
Reads MAX6642's local temperature value.
Definition max6642.c:82
Bool max6642_read_local_extd(sensor_t *sensor, uint8_t *temp)
Reads MAX6642's local extended temperature value.
Definition max6642.c:117
void vTaskMAX6642(void *Parameters)
MAX6642 Monitor Task.
Definition max6642.c:46
void MAX6642_init(void)
Initializes MAX6642 sensor and creates vTaskMAX6642.
Definition max6642.c:77
uint8_t max6642_read_cfg(sensor_t *sensor)
Reads MAX6642 configuration byte.
Definition max6642.c:168
Definition sdr.h:90
Definition sdr.h:181