Loading...
Searching...
No Matches
max31343.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2026 Technische Universität Hamburg
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
35
36#include <stdint.h>
37#include <time.h>
38#include <stdbool.h>
39
40#include "periph/i2c.h"
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
53typedef struct {
56
63typedef enum {
64 MAX31343_SQW_1HZ = 0,
65 MAX31343_SQW_2HZ = 1,
66 MAX31343_SQW_4HZ = 2,
67 MAX31343_SQW_8HZ = 3,
68 MAX31343_SQW_16HZ = 4,
69 MAX31343_SQW_32HZ = 5,
71
90
102
106typedef struct {
109
131
141int max31343_get_time(const max31343_t *dev, struct tm *time);
142
156int max31343_set_time(const max31343_t *dev, const struct tm *time);
157
169
181
200int max31343_set_alarm(const max31343_t *dev, const struct tm *time);
201
215int max31343_get_alarm(const max31343_t *dev, struct tm *time);
216
232int max31343_set_alarm_int(const max31343_t *dev, bool enable);
233
248
260int max31343_get_temp(const max31343_t *dev, int16_t *temp_centi);
261
278 bool diode,
280
290
302int max31343_temp_set_automode(const max31343_t *dev, bool enable, max31343_ttsint_t ttsint);
303
305
306#ifdef __cplusplus
307}
308#endif
int max31343_poweroff(const max31343_t *dev)
Disable RTC oscillator (stop timekeeping).
int max31343_set_sqw(const max31343_t *dev, max31343_sqw_freq_t freq)
Configure the square-wave (SQW) output frequency.
max31343_ttsint_t
Automatic temperature conversion interval.
Definition max31343.h:80
int max31343_get_temp(const max31343_t *dev, int16_t *temp_centi)
Read temperature in centi-degrees Celsius (°C * 100)
max31343_trickle_res_t
Trickle charger resistor selection.
Definition max31343.h:97
int max31343_trickle_charge_disable(const max31343_t *dev)
Disable the trickle charger.
int max31343_trickle_charge_enable(const max31343_t *dev, bool diode, max31343_trickle_res_t res)
Enable the trickle charger.
int max31343_poweron(const max31343_t *dev)
Enable RTC oscillator (power on timekeeping).
int max31343_temp_set_automode(const max31343_t *dev, bool enable, max31343_ttsint_t ttsint)
Configure automatic temperature conversion mode and interval.
int max31343_get_time(const max31343_t *dev, struct tm *time)
Read current time from device.
int max31343_set_time(const max31343_t *dev, const struct tm *time)
Set current time on device.
int max31343_init(max31343_t *dev, const max31343_params_t *params)
Initialize MAX31343 device.
max31343_sqw_freq_t
Square-wave output frequency selection.
Definition max31343.h:63
int max31343_get_alarm(const max31343_t *dev, struct tm *time)
Get the currently configured alarm time.
int max31343_set_alarm_int(const max31343_t *dev, bool enable)
Enable or disable the alarm interrupt.
int max31343_set_alarm(const max31343_t *dev, const struct tm *time)
Set alarm time registers.
@ MAX31343_TTSINT_8S
update temperature every 8s
Definition max31343.h:84
@ MAX31343_TTSINT_64S
update temperature every 64s
Definition max31343.h:87
@ MAX31343_TTSINT_16S
update temperature every 16s
Definition max31343.h:85
@ MAX31343_TTSINT_32S
update temperature every 32s
Definition max31343.h:86
@ MAX31343_TTSINT_1S
update temperature every 1s
Definition max31343.h:81
@ MAX31343_TTSINT_2S
update temperature every 2s
Definition max31343.h:82
@ MAX31343_TTSINT_128S
update temperature every 128s
Definition max31343.h:88
@ MAX31343_TTSINT_4S
update temperature every 4s
Definition max31343.h:83
@ MAX31343_TRICKLE_RES_11K
11 kOhm
Definition max31343.h:100
@ MAX31343_TRICKLE_RES_3K
3 kOhm
Definition max31343.h:98
@ MAX31343_TRICKLE_RES_6K
6 kOhm
Definition max31343.h:99
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:155
Low-level I2C peripheral driver interface definition.
Configuration parameters for MAX31343 initialization.
Definition max31343.h:106
i2c_t i2c
I2C bus the device is connected to.
Definition max31343.h:107
Device descriptor for the MAX31343 RTC.
Definition max31343.h:53
i2c_t i2c
I2C bus.
Definition max31343.h:54