|
Contiki 3.x
|
Sensors for DS3231 (RTC with Temperature Sensor).More...
#include <lib/sensors.h>#include <stdbool.h>#include "time.h"Go to the source code of this file.
Macros | |
| #define | EARLIEST_EPOCH 946684800 |
| Earliest time supported by the rtc - 2000/01/01 00:00:00. | |
| #define | DS3231_SENSOR_TEMP 0 |
| DS3231 Sensor and Config Command List. | |
Functions | |
| int | ds3231_get_time (struct tm *t) |
| ds3231_get_time More... | |
| int | ds3231_set_time (struct tm *t) |
| ds3231_set_time More... | |
| int | ds3231_set_alarm (struct tm *t) |
| ds3231_set_alarm More... | |
| int | ds3231_clear_alarm (void) |
| ds3231_clear_alarm More... | |
| int | ds3231_get_temperature (int *temp) |
| ds3231_temperature More... | |
| int | configure (int type, int c) |
| configure | |
| int | status (int type) |
| status | |
Variables | |
| const struct sensors_sensor | ds3231_sensor |
| Export the DS3231 sensor object. More... | |
Sensors for DS3231 (RTC with Temperature Sensor).
Definition in file ds3231-sensor.h.
| int ds3231_clear_alarm | ( | void | ) |
ds3231_clear_alarm
Clears and disables Alarm 1.
Clears and disables Alarm 1.
Definition at line 230 of file ds3231-sensor.c.
Referenced by configure().
| int ds3231_get_temperature | ( | int * | temperature | ) |
ds3231_temperature
Register 11h: bit 7 is sign, bit 6-0 are temperature. Register 12h: bit 7 & 6 are decimal point (0.25 * xxb).
Definition at line 263 of file ds3231-sensor.c.
References I2C().
| int ds3231_get_time | ( | struct tm * | t | ) |
ds3231_get_time
Definition at line 100 of file ds3231-sensor.c.
References I2C().
| int ds3231_set_alarm | ( | struct tm * | t | ) |
ds3231_set_alarm
Sets the first alarm of the DS3231. Alarm Mask Bits A1M1-4 are all set to 0 which means the alarm will fire on the complete alarm setting (date, hour, minute & second).
When the alarm is triggered the INT pin of the DS3231 will be pulled low. This pin is connected to Port C Pin 2 of the AVR XMega.
Sets the first alarm of the DS3231. Alarm Mask Bits A1M1-4 are all set to 0 which means the alarm will fire on the complete alarm setting (date, hour, minute & second).
When the alarm is triggered the INT pin of the DS3231 will be pulled low. This pin is connected to Port C Pin 2 of the AVR XMega.
Definition at line 180 of file ds3231-sensor.c.
Referenced by configure().
| int ds3231_set_time | ( | struct tm * | t | ) |
ds3231_set_time
Definition at line 136 of file ds3231-sensor.c.
Referenced by configure().
| const struct sensors_sensor ds3231_sensor |
Export the DS3231 sensor object.
Can be called as follows:
#include <dev/ds3231-sensor.h>
SENSORS_ACTIVATE(ds3231_sensor);
ds3231_sensor.configure(DS3231_CONFIG_SET_TIME, (int)&t);
ds3231_sensor.configure(DS3231_CONFIG_SET_ALARM, (int)&t);
ds3231_sensor.value(DS3231_SENSOR_TEMP);
ds3231_sensor.value(DS3231_SENSOR_GET_EPOCH_SECONDS_LSB);
ds3231_sensor.value(DS3231_SENSOR_GET_EPOCH_SECONDS_MSB);
ds3231_sensor.configure(DS3231_CONFIG_CLEAR_ALARM, 0);
Definition at line 82 of file ds3231-sensor.c.
1.8.6