-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathiso14819-2.h
More file actions
140 lines (125 loc) · 4.59 KB
/
iso14819-2.h
File metadata and controls
140 lines (125 loc) · 4.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/* Arduino RDS/RBDS (IEC 62016/NRSC-4-B) Decoding Library
* See the README file for author and licensing information. In case it's
* missing from your distribution, use the one here as the authoritative
* version: https://github.com/csdexter/RDSDecoder/blob/master/README
*
* This library is for decoding RDS/RBDS data streams (groups).
* See the example sketches to learn how to use the library in your code.
*
* This file contains definitions that are only used by ISO 14819-2 -specific
* code i.e. TMC event rendering.
*
* NOTE: the term "EEPROM" as used in the conditional #defines below refers to
* an externally connected EEPROM that's large enough to store the entire
* data structure configured for EEPROM storage (e.g. serial EEPROM via
* SPI or I2C). It does *NOT* in any way or form refer to the EEPROM
* memory in the AVR chip itself!
*/
#ifndef _ISO14819_2_H_INCLUDED
#define _ISO14819_2_H_INCLUDED
#if defined(__GNUC__)
# if defined(__AVR__)
# if defined(ARDUINO) && ARDUINO >= 100
# include <Arduino.h>
# else
# include <WProgram.h>
# endif
# elif defined(__i386__) || defined(__x86_64__)
# include <stdint.h>
# include <stdbool.h>
# define byte uint8_t
# define PROGMEM
# endif
#else
# warning Non-GNU compiler detected, you are on your own!
#endif
/* Ask for ALL IN by default so that it fails on most AVRs and makes people pay
* attention and make an informed and deliberate choice about their
* configuration.
*/
#if !(defined(WITH_RDS_TMC_ALLIN_FLASH) || defined(WITH_RDS_TMC_ALLIN_EEPROM))
# warning No ISO 14819-2 string tables storage configuration specified, using\
defaults which may not be what you want!
# define WITH_RDS_TMC_ALLIN_FLASH
#endif
#if defined(WITH_RDS_TMC_ALLIN_FLASH)
# define WITH_RDS_TMC_EVENTS
# define WITH_RDS_TMC_SUPPLEMENTARY
# define WITH_RDS_TMC_EVENT_STRING_POINTERS
# define WITH_RDS_TMC_EVENT_STRINGS_FLASH
# define WITH_RDS_TMC_SUPPLEMENTARY_STRINGS_FLASH
#endif
#if defined(WITH_RDS_TMC_ALLIN_EEPROM)
# define WITH_RDS_TMC_EVENTS
# define WITH_RDS_TMC_SUPPLEMENTARY
# define WITH_RDS_TMC_EVENT_STRING_POINTERS
# define WITH_RDS_TMC_EVENT_STRINGS_EEPROM
# define WITH_RDS_TMC_SUPPLEMENTARY_STRINGS_EEPROM
#endif
/* Sanity check string table configuration */
#if defined(WITH_RDS_TMC_EVENT_STRING_POINTERS) && \
!defined(WITH_RDS_TMC_EVENTS)
# warning ISO 14819-2 string pointers in event list requested but event list\
not enabled: enabling event list in FLASH!
# define WITH_RDS_TMC_EVENTS
#endif
#if defined(WITH_RDS_TMC_EVENT_STRING_POINTERS) && \
!(defined(WITH_RDS_TMC_EVENT_STRINGS_FLASH) ||\
defined(WITH_RDS_TMC_EVENT_STRINGS_EEPROM))
# warning ISO 14819-2 string pointers in event list requested but no storage\
configuration specified for the pointed-to strings: choosing FLASH which may\
not be what you want!
# define WITH_RDS_TMC_EVENT_STRINGS_FLASH
#endif
#if defined(WITH_RDS_TMC_SUPPLEMENTARY) && \
!(defined(WITH_RDS_TMC_SUPPLEMENTARY_STRINGS_FLASH) ||\
defined(WITH_RDS_TMC_SUPPLEMENTARY_STRINGS_EEPROM))
# warning ISO 14819-2 supplementary information string table requested but no\
storage configuration specified for said strings: choosing FLASH which may not\
be what you want!
# define WITH_RDS_TMC_SUPPLEMENTARY_STRINGS_FLASH
#endif
#define RDS_TMC_QUANTIFIER_SMALL_NUMBER 0x0
#define RDS_TMC_QUANTIFIER_NUMBER 0x1
#define RDS_TMC_QUANTIFIER_LESSTHAN_METERS 0x2
#define RDS_TMC_QUANTIFIER_PERCENT 0x3
#define RDS_TMC_QUANTIFIER_UPTO_KMH 0x4
#define RDS_TMC_QUANTIFIER_UPTO_MINUTES 0x5
#define RDS_TMC_QUANTIFIER_DEGREES_CELSIUS 0x6
#define RDS_TMC_QUANTIFIER_TIME 0x7
#define RDS_TMC_QUANTIFIER_TONNES 0x8
#define RDS_TMC_QUANTIFIER_METERS 0x9
#define RDS_TMC_QUANTIFIER_UPTO_MILLIMETERS 0xA
#define RDS_TMC_QUANTIFIER_MHZ 0xB
#define RDS_TMC_QUANTIFIER_KHZ 0xC
#define RDS_TMC_QUANTIFIER_LAST RDS_TMC_QUANTIFIER_KHZ
#define RDS_TMC_NATURE_INFORMATION 0x0
#define RDS_TMC_NATURE_FORECAST 0x1
#define RDS_TMC_NATURE_SILENT 0x2
#define RDS_TMC_URGENCY_NORMAL 0x0
#define RDS_TMC_URGENCY_URGENT 0x1
#define RDS_TMC_URGENCY_XURGENT 0x2
#if defined(WITH_RDS_TMC_EVENTS)
typedef struct __attribute__ ((__packed__)) {
uint16_t code:12;
uint8_t quantifier:4;
uint8_t nature:2;
uint8_t urgency:2;
uint8_t longerLasting:1;
uint8_t silentDuration:1;
uint8_t bidirectional:1;
byte updateClass;
# if defined(WITH_RDS_TMC_EVENT_STRING_POINTERS)
const char * const description;
# endif
} TRDSTMCEventListEntry;
#endif
#if defined(WITH_RDS_TMC_SUPPLEMENTARY)
typedef struct {
byte code;
const char * const description;
} TRDSTMCSupplementaryEntry;
#endif
#include "iso14819-2-events.h"
#include "iso14819-2-supplementary.h"
#endif