libsigrokdecode  unreleased development snapshot
sigrok protocol decoding library
Data Structures | Macros | Functions
irmp-main-sharedlib.h File Reference
#include <stdint.h>
#include <stdlib.h>
+ Include dependency graph for irmp-main-sharedlib.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  irmp_result_data
 IR decoder result data at the library's public API. More...
 

Macros

#define IRMP_DLLEXPORT   __attribute__((visibility("default")))
 
#define WITH_IRMP_DETECT_BUFFER   0
 
#define IRMP_DATA_FLAG_REPETITION   (1 << 0)
 
#define IRMP_DATA_FLAG_RELEASE   (1 << 1)
 

Functions

IRMP_DLLEXPORT struct irmp_instance * irmp_instance_alloc (void)
 Allocate a decoder instance. More...
 
IRMP_DLLEXPORT void irmp_instance_free (struct irmp_instance *state)
 Release a decoder instance. More...
 
IRMP_DLLEXPORT size_t irmp_instance_id (struct irmp_instance *state)
 Get the client ID of an IRMP decoder core instance. More...
 
IRMP_DLLEXPORT int irmp_instance_lock (struct irmp_instance *state, int wait)
 Acquire a decoder instance's lock. More...
 
IRMP_DLLEXPORT void irmp_instance_unlock (struct irmp_instance *state)
 Release a decoder instance's lock. More...
 
IRMP_DLLEXPORT uint32_t irmp_get_sample_rate (void)
 Query the IRMP library's configured sample rate. More...
 
IRMP_DLLEXPORT void irmp_reset_state (void)
 Reset internal decoder state. More...
 
IRMP_DLLEXPORT int irmp_add_one_sample (int sample)
 Feed an individual sample to the detector. More...
 
IRMP_DLLEXPORT int irmp_get_result_data (struct irmp_result_data *data)
 Query result data after detection succeeded. More...
 
IRMP_DLLEXPORT const char * irmp_get_protocol_name (uint32_t protocol)
 Resolve the protocol identifer to the protocol's name. More...
 

Macro Definition Documentation

#define IRMP_DATA_FLAG_RELEASE   (1 << 1)

Definition at line 93 of file irmp-main-sharedlib.h.

#define IRMP_DATA_FLAG_REPETITION   (1 << 0)

Definition at line 92 of file irmp-main-sharedlib.h.

#define IRMP_DLLEXPORT   __attribute__((visibility("default")))

Definition at line 29 of file irmp-main-sharedlib.h.

Referenced by irmp_get_result_data().

#define WITH_IRMP_DETECT_BUFFER   0

Definition at line 34 of file irmp-main-sharedlib.h.

Function Documentation

IRMP_DLLEXPORT int irmp_add_one_sample ( int  sample)

Feed an individual sample to the detector.

See irmp_get_result_data() for result retrieval when detection of an IR frame completes. Make sure irmp_reset_state() was called before providing the first sample.

Parameters
[in]sampleThe pin value to feed to the detector.
Returns
Non-zero when an IR frame was detected.

Definition at line 251 of file irmp-main-sharedlib.c.

References irmp_ISR().

Referenced by irmp_get_result_data().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

IRMP_DLLEXPORT const char* irmp_get_protocol_name ( uint32_t  protocol)

Resolve the protocol identifer to the protocol's name.

Parameters
[in]protocolThe numerical identifier.
Returns
A pointer to the string literal, or #NULL in case of failure.

Definition at line 294 of file irmp-main-sharedlib.c.

References ARRAY_SIZE, and irmp_result_data::protocol.

Referenced by irmp_get_result_data().

+ Here is the caller graph for this function:

IRMP_DLLEXPORT int irmp_get_result_data ( struct irmp_result_data data)

Query result data after detection succeeded.

Parameters
[out]dataThe caller provided result buffer.
Returns
Non-zero if data was available, zero otherwise.

Definition at line 261 of file irmp-main-sharedlib.c.

References irmp_result_data::address, IRMP_PACKED_STRUCT::address, irmp_result_data::command, IRMP_PACKED_STRUCT::command, irmp_result_data::end_sample, irmp_result_data::flags, IRMP_PACKED_STRUCT::flags, irmp_add_one_sample(), IRMP_DLLEXPORT, irmp_get_data(), irmp_get_protocol_name(), irmp_get_result_data(), irmp_result_data::protocol, IRMP_PACKED_STRUCT::protocol, irmp_result_data::protocol_name, and irmp_result_data::start_sample.

Referenced by irmp_get_result_data().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

IRMP_DLLEXPORT uint32_t irmp_get_sample_rate ( void  )

Query the IRMP library's configured sample rate.

The internally used sample rate is a compile time option. Any data that is provided at runtime needs to match this rate, or detection will fail.

Definition at line 210 of file irmp-main-sharedlib.c.

IRMP_DLLEXPORT struct irmp_instance* irmp_instance_alloc ( void  )

Allocate a decoder instance.

Returns
Reference to the allocated instance state.

Definition at line 136 of file irmp-main-sharedlib.c.

IRMP_DLLEXPORT void irmp_instance_free ( struct irmp_instance *  state)

Release a decoder instance.

Parameters
[in]stateReference to the instance's state.

Definition at line 152 of file irmp-main-sharedlib.c.

IRMP_DLLEXPORT size_t irmp_instance_id ( struct irmp_instance *  state)

Get the client ID of an IRMP decoder core instance.

Definition at line 163 of file irmp-main-sharedlib.c.

IRMP_DLLEXPORT int irmp_instance_lock ( struct irmp_instance *  state,
int  wait 
)

Acquire a decoder instance's lock.

Parameters
[in]stateReference to the instance's state.
[in]waitWhether to block until the lock is acquired.
Returns
0 upon success, non-zero upon failure

Definition at line 171 of file irmp-main-sharedlib.c.

IRMP_DLLEXPORT void irmp_instance_unlock ( struct irmp_instance *  state)

Release a decoder instance's lock.

Parameters
[in]stateReference to the instance's state.
Returns
0 upon success, non-zero upon failure

Definition at line 197 of file irmp-main-sharedlib.c.

IRMP_DLLEXPORT void irmp_reset_state ( void  )

Reset internal decoder state.

This must be called before data processing starts.

Definition at line 215 of file irmp-main-sharedlib.c.

References irmp_get_data(), and irmp_ISR().

+ Here is the call graph for this function: