libsigrokdecode
unreleased development snapshot
sigrok protocol decoding library
Main Page
Modules
Data Structures
Files
File List
Globals
irmp
irmpsystem.h
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------------------------------------------------------------------------------
2
* irmpsystem.h - system specific includes and defines
3
*
4
* Copyright (c) 2009-2019 Frank Meyer - frank(at)fli4l.de
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 2 of the License, or
9
* (at your option) any later version.
10
*---------------------------------------------------------------------------------------------------------------------------------------------------
11
*/
12
13
#ifndef _IRMPSYSTEM_H_
14
#define _IRMPSYSTEM_H_
15
16
#if !defined(_IRMP_H_) && !defined(_IRSND_H_)
17
# error please include only irmp.h or irsnd.h, not irmpsystem.h
18
#endif
19
20
/* Workaround required when building with xtensa (cross-)toolchains. */
21
#ifdef __xtensa__
22
#undef __xtensa__
23
#endif
24
25
#if defined(__18CXX) // Microchip PIC C18 compiler
26
# define PIC_C18
27
#elif defined(__XC8) // PIC XC8 compiler
28
# include <xc.h>
29
# define PIC_C18
30
#elif defined(__PCM__) || defined(__PCB__) || defined(__PCH__) // CCS PIC compiler
31
# define PIC_CCS
32
#elif defined(STM32L1XX_MD) || defined(STM32L1XX_MDP) || defined(STM32L1XX_HD) // ARM STM32
33
# include <stm32l1xx.h>
34
# define ARM_STM32
35
# define ARM_STM32L1XX
36
# define F_CPU (SysCtlClockGet())
37
#elif defined(STM32F10X_LD) || defined(STM32F10X_LD_VL) \
38
|| defined(STM32F10X_MD) || defined(STM32F10X_MD_VL) \
39
|| defined(STM32F10X_HD) || defined(STM32F10X_HD_VL) \
40
|| defined(STM32F10X_XL) || defined(STM32F10X_CL) // ARM STM32
41
# include <stm32f10x.h>
42
# define ARM_STM32
43
# define ARM_STM32F10X
44
# define F_CPU (SysCtlClockGet())
45
#elif defined(STM32F4XX) // ARM STM32
46
# include <stm32f4xx.h>
47
# define ARM_STM32
48
# define ARM_STM32F4XX
49
#elif defined(USE_HAL_DRIVER) // ARM STM32 with HAL Library
50
# include "gpio.h"
51
# if defined(_IRSND_H_)
52
# include"tim.h"
53
# endif
54
# define ARM_STM32_HAL
55
# define F_CPU SystemCoreClock
56
#elif defined(__SDCC_stm8) // STM8
57
# define SDCC_STM8
58
#elif defined(TARGET_IS_BLIZZARD_RA2) // TI Stellaris (tested on Stellaris Launchpad with Code Composer Studio)
59
# define STELLARIS_ARM_CORTEX_M4
60
# define F_CPU (SysCtlClockGet())
61
#elif defined(__xtensa__) // ESP8266 (Arduino)
62
# include "Arduino.h"
63
# include "ets_sys.h"
64
# include "osapi.h"
65
# include "gpio.h"
66
# include "os_type.h"
67
# include "c_types.h"
68
# define uint_fast8_t uint8_t
69
# define uint_fast16_t uint16_t
70
#elif defined(TEENSYDUINO) && (defined(__MK20DX256__) || defined(__MK20DX128__)) // Teensy 3.x (tested on Teensy 3.1 in Arduino 1.6.5 / Teensyduino 1.2.5)
71
# include <core_pins.h>
72
# define TEENSY_ARM_CORTEX_M4
73
#elif defined(unix) || defined(WIN32) || defined(__APPLE__) // Unix/Linux or Windows or Apple
74
# define UNIX_OR_WINDOWS
75
#elif defined(__MBED__) // mbed platform
76
// #include "mbed.h" // if mbed.h is used, source must be compiled as cpp
77
#include "gpio_api.h"
78
#elif defined(IRMP_CHIBIOS_HAL) // ChibiOS HAL
79
# include "hal.h"
80
#else
81
# define ATMEL_AVR // ATMEL AVR
82
#endif
83
84
#include <string.h>
85
86
#ifdef UNIX_OR_WINDOWS // Analyze on Unix/Linux or Windows
87
# include <stdio.h>
88
# include <stdlib.h>
89
# define F_CPU 8000000L
90
# define ANALYZE
91
# ifdef unix
92
# include <stdint.h>
93
# else
94
typedef
unsigned
char
uint8_t;
95
typedef
unsigned
short
uint16_t;
96
# endif
97
#endif
98
99
100
#if defined(ATMEL_AVR)
101
# include <stdint.h>
102
# include <stdio.h>
103
# include <avr/io.h>
104
# include <util/delay.h>
105
# include <avr/pgmspace.h>
106
# include <avr/interrupt.h>
107
# define IRSND_OC2 0 // OC2
108
# define IRSND_OC2A 1 // OC2A
109
# define IRSND_OC2B 2 // OC2B
110
# define IRSND_OC0 3 // OC0
111
# define IRSND_OC0A 4 // OC0A
112
# define IRSND_OC0B 5 // OC0B
113
114
# define IRSND_XMEGA_OC0A 0 // OC0A
115
# define IRSND_XMEGA_OC0B 1 // OC0B
116
# define IRSND_XMEGA_OC0C 2 // OC0C
117
# define IRSND_XMEGA_OC0D 3 // OC0D
118
# define IRSND_XMEGA_OC1A 4 // OC1A
119
# define IRSND_XMEGA_OC1B 5 // OC1B
120
121
#elif defined(STELLARIS_ARM_CORTEX_M4)
122
123
# include "inc/hw_ints.h"
124
# include "inc/hw_memmap.h"
125
# include "inc/hw_types.h"
126
# include "inc/hw_gpio.h"
127
# include "driverlib/fpu.h"
128
# include "driverlib/sysctl.h"
129
# include "driverlib/interrupt.h"
130
# include "driverlib/gpio.h"
131
# include "driverlib/rom.h"
132
# include "driverlib/systick.h"
133
# include "driverlib/pin_map.h"
134
# include "driverlib/timer.h"
135
# define PROGMEM
136
# define memcpy_P memcpy
137
# define APP_SYSTICKS_PER_SEC 32
138
139
#elif defined(ARM_STM32F10X)
140
141
# include "stm32f10x_gpio.h"
142
# include "stm32f10x_rcc.h"
143
# include "stm32f10x_tim.h"
144
# include "misc.h"
145
# define PROGMEM
146
# define memcpy_P memcpy
147
148
#elif defined(SDCC_STM8)
149
150
# include "stm8s.h"
151
# define PROGMEM
152
# define memcpy_P memcpy
153
# define __attribute__(x)
154
# define uint_fast8_t uint8_t
155
# define uint_fast16_t uint16_t
156
157
#elif defined(TEENSY_ARM_CORTEX_M4)
158
# define PROGMEM
159
# define memcpy_P memcpy
160
161
#elif defined(__xtensa__)
162
# define PROGMEM
163
# define memcpy_P memcpy
164
165
#elif defined(__MBED__)
166
# define PROGMEM
167
# define memcpy_P memcpy
168
169
#else
170
# define PROGMEM
171
# define memcpy_P memcpy
172
173
#endif
174
175
#if defined(PIC_CCS) || defined(PIC_C18)
176
typedef
unsigned
char
uint8_t;
177
typedef
unsigned
short
uint16_t;
178
typedef
unsigned
char
uint_fast8_t;
179
typedef
unsigned
short
uint_fast16_t;
180
#endif
181
182
#if defined (PIC_C18) // PIC C18 or XC8 compiler
183
# include <p18cxxx.h>
// main PIC18 h file
184
#ifndef __XC8
185
# include <timers.h>
// timer lib
186
# include <pwm.h>
// pwm lib
187
#endif
188
# define IRSND_PIC_CCP1 1 // PIC C18 RC2 = PWM1 module
189
# define IRSND_PIC_CCP2 2 // PIC C18 RC1 = PWM2 module
190
#endif
191
192
#ifndef TRUE
193
# define TRUE 1
194
# define FALSE 0
195
#endif
196
197
#if IRMP_32_BIT == 1
198
199
typedef
struct
200
{
201
uint8_t
protocol
;
// protocol, e.g. NEC_PROTOCOL
202
uint16_t
address
;
// address
203
uint32_t
command
;
// command
204
uint8_t
flags
;
// flags, e.g. repetition
205
}
IRMP_DATA
;
206
207
#else // not IRMP_32_BIT == 1
208
209
#if defined(PIC_C18)
210
#define IRMP_PACKED_STRUCT
211
#else
212
#define IRMP_PACKED_STRUCT __attribute__ ((__packed__))
213
#endif
214
215
typedef
struct
IRMP_PACKED_STRUCT
216
{
217
uint8_t
protocol
;
// protocol, e.g. NEC_PROTOCOL
218
uint16_t
address
;
// address
219
uint16_t
command
;
// command
220
uint8_t
flags
;
// flags, e.g. repetition
221
}
IRMP_DATA
;
222
223
#endif // IRMP_32_BIT == 1
224
225
#endif // _IRMPSYSTEM_H_
irmp_result_data::command
uint32_t command
!< address
Definition:
irmp-main-sharedlib.h:86
irmp_result_data::protocol
uint32_t protocol
Definition:
irmp-main-sharedlib.h:83
IRMP_PACKED_STRUCT::protocol
uint8_t protocol
Definition:
irmpsystem.h:217
irmp_result_data::flags
uint32_t flags
!< command
Definition:
irmp-main-sharedlib.h:87
irmp_result_data::address
uint32_t address
!< name of the protocol
Definition:
irmp-main-sharedlib.h:85
IRMP_PACKED_STRUCT::flags
uint8_t flags
Definition:
irmpsystem.h:220
IRMP_PACKED_STRUCT::command
uint16_t command
Definition:
irmpsystem.h:219
IRMP_DATA
struct IRMP_PACKED_STRUCT IRMP_DATA
IRMP_PACKED_STRUCT::address
uint16_t address
Definition:
irmpsystem.h:218
IRMP_PACKED_STRUCT
Definition:
irmpsystem.h:215
Generated on Wed Feb 28 2024 07:47:38 for libsigrokdecode by
1.8.11