1 /*---------------------------------------------------------------------------------------------------------------------------------------------------
4 * Copyright (c) 2009-2019 Frank Meyer - frank(at)fli4l.de
5 * Copyright (c) 2009-2019 René Staffen - r.staffen(at)gmx.de
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *---------------------------------------------------------------------------------------------------------------------------------------------------
19 #ifndef IRMP_DLLEXPORT
21 #if defined WIN32 && defined _MSC_VER
22 # define IRMP_DLLEXPORT __declspec(dllexport)
24 # define IRMP_DLLEXPORT
26 #endif // !IRMP_DLLEXPORT
28 #include "irmp-main-sharedlib.h"
32 static uint32_t s_endSample = 0;
34 uint32_t IRMP_GetSampleRate(void) {
39 void IRMP_Reset(void) {
43 for (i = 0; i < (int)(( F_INTERRUPTS )); i++) // long pause of 1s
47 (void)irmp_get_data(&data);
55 uint32_t IRMP_AddSample(const uint8_t i_sample) {
57 uint_fast8_t r = irmp_ISR();
59 s_endSample = s_curSample;
67 uint32_t IRMP_GetData(IRMP_DataExt* o_data) {
70 if (irmp_get_data(&d))
72 o_data->address = d.address;
73 o_data->command = d.command;
74 o_data->protocol = d.protocol;
75 o_data->protocolName = IRMP_GetProtocolName(d.protocol);
76 o_data->flags = d.flags;
77 o_data->startSample = s_startBitSample;
78 o_data->endSample = s_endSample;
85 IRMP_DataExt IRMP_Detect(const uint8_t* i_buff, uint32_t i_len) {
86 IRMP_DataExt ret = { 0 };
87 while (s_curSample < i_len) {
88 if (IRMP_AddSample(i_buff[s_curSample])) {
97 const char* IRMP_GetProtocolName(uint32_t i_protocol) {
98 if (i_protocol < IRMP_N_PROTOCOLS) {
99 return irmp_protocol_names[i_protocol];