Loading...
Searching...
No Matches
dcf77.h
Go to the documentation of this file.
1/*
2 * Copyright 2019 HAW Hamburg
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
22#ifndef DCF77_H
23#define DCF77_H
24
25#include <stdint.h>
26#include <stdlib.h>
27#include <inttypes.h>
28#include "xtimer.h"
29#include "time.h"
30#include "periph/gpio.h"
31#include "dcf77_internal.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37/* forward-declaration for dcf77_tick_cb_t */
38struct dcf77;
39
46typedef void(*dcf77_tick_cb_t)(struct dcf77 *dev, void *arg);
47
51enum {
56};
57
61typedef struct {
62 gpio_t pin;
66
80
90int dcf77_init(dcf77_t *dev, const dcf77_params_t *params);
91
103int dcf77_get_time(dcf77_t *dev, struct tm *time);
104
114void dcf77_set_tick_cb(dcf77_t *dev, dcf77_tick_cb_t cb, void *arg);
115
116#ifdef __cplusplus
117}
118#endif
119
120#endif /* DCF77_H */
Bit definitions for DCF77 transmission.
Low-level GPIO peripheral driver interface definitions.
void dcf77_set_tick_cb(dcf77_t *dev, dcf77_tick_cb_t cb, void *arg)
Set a tick callback for DCF77.
int dcf77_init(dcf77_t *dev, const dcf77_params_t *params)
Initialize a new DCF77 device.
void(* dcf77_tick_cb_t)(struct dcf77 *dev, void *arg)
Signature for tick callback.
Definition dcf77.h:46
struct dcf77 dcf77_t
Device descriptor for DCF77 sensor devices.
int dcf77_get_time(dcf77_t *dev, struct tm *time)
get a new timestamp from the device.
@ DCF77_INIT_ERROR
Initialization error.
Definition dcf77.h:55
@ DCF77_OK
all good
Definition dcf77.h:52
@ DCF77_NOCSUM
checksum error
Definition dcf77.h:53
@ DCF77_TIMEOUT
communication timed out
Definition dcf77.h:54
Adds include for missing inttype definitions.
gpio_mode_t
Available pin modes.
Definition periph_cpu.h:82
Configuration parameters for DCF77 devices.
Definition dcf77.h:61
gpio_t pin
GPIO pin of the device's data pin.
Definition dcf77.h:62
gpio_mode_t in_mode
input pin configuration from the device, without pull resistor
Definition dcf77.h:63
Device descriptor for DCF77 sensor devices.
Definition dcf77.h:70
dcf77_bits_t last_bitseq
contains all Bits from a last cycle
Definition dcf77.h:73
void * tick_cb_args
Arguments for the tick callback.
Definition dcf77.h:78
dcf77_tick_cb_t tick_cb
Callback to be called if a new minute starts.
Definition dcf77.h:77
dcf77_params_t params
Device parameters.
Definition dcf77.h:71
dcf77_bits_t bitseq
contains all Bits from a current cycle
Definition dcf77.h:72
uint8_t bitCounter
Counter of the Bits in a Bitsequenz.
Definition dcf77.h:76
uint32_t startTime
Timestamp to measure the term of the level.
Definition dcf77.h:74
uint8_t internal_state
internal States
Definition dcf77.h:75
Timeinformation bitfields for DCF77 devices.
xtimer interface definitions