X-Git-Url: http://cloudbase.mooo.com/gitweb/irmp.git/blobdiff_plain/03780b34ba14fb64f369e677a2548ac2b130cccd..0f700c8ea4b0e9729805828c4fab5ab0fe2b6443:/irmp.h diff --git a/irmp.h b/irmp.h index 6198263..ccaee81 100644 --- a/irmp.h +++ b/irmp.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009-2011 Frank Meyer - frank(at)fli4l.de * - * $Id: irmp.h,v 1.64 2011/08/16 07:51:19 fm Exp $ + * $Id: irmp.h,v 1.68 2012/02/13 10:55:50 fm Exp $ * * ATMEGA88 @ 8 MHz * @@ -17,17 +17,18 @@ #ifndef _WC_IRMP_H_ #define _WC_IRMP_H_ -#ifdef __cplusplus -extern "C" -{ -#endif +#if defined(__18CXX) // Microchip C18 declaration of missing typedef +typedef unsigned char uint8_t; +typedef unsigned int uint16_t; +#endif //Microchip C18 /*--------------------------------------------------------------------------------------------------------------------------------------------------- * timing constants: *--------------------------------------------------------------------------------------------------------------------------------------------------- */ -#define IRMP_TIMEOUT_TIME 16500.0e-6 // timeout after 16.5 ms darkness -#define IRMP_TIMEOUT_TIME_MS 16500L // timeout after 16.5 ms darkness +// fm 22.09.2011: may not be more than 16000L, otherwise some JVC codes will not be accepted +#define IRMP_TIMEOUT_TIME 15500.0e-6 // timeout after 15.5 ms darkness +#define IRMP_TIMEOUT_TIME_MS 15500L // timeout after 15.5 ms darkness #if IRMP_SUPPORT_NIKON_PROTOCOL == 1 #define IRMP_TIMEOUT_NIKON_TIME 29500.0e-6 // 2nd timeout after 29.5 ms darkness (only for NIKON!) @@ -78,8 +79,8 @@ typedef uint8_t PAUSE_LEN; #define IRMP_NEC42_PROTOCOL 28 // NEC with 42 bits #define IRMP_LEGO_PROTOCOL 29 // LEGO Power Functions RC #define IRMP_THOMSON_PROTOCOL 30 // Thomson -#define IRMP_MERLIN_PROTOCOL 31 // Pollin Merlin keyboard (bitserial) -#define IRMP_IMON_PROTOCOL 99 // Imon (bitserial) PROTOTYPE! + +#define IRMP_N_PROTOCOLS 30 // number of supported protocols // some flags of struct IRMP_PARAMETER: #define IRMP_PARAM_FLAG_IS_MANCHESTER 0x01 @@ -135,8 +136,9 @@ typedef uint8_t PAUSE_LEN; #define SAMSUNG_START_BIT_PULSE_TIME 4500.0e-6 // 4500 usec pulse #define SAMSUNG_START_BIT_PAUSE_TIME 4500.0e-6 // 4500 usec pause #define SAMSUNG_PULSE_TIME 550.0e-6 // 550 usec pulse -#define SAMSUNG_1_PAUSE_TIME 1450.0e-6 // 1450 usec pause -#define SAMSUNG_0_PAUSE_TIME 450.0e-6 // 450 usec pause +#define SAMSUNG_1_PAUSE_TIME 1650.0e-6 // 1650 usec pause +#define SAMSUNG_0_PAUSE_TIME 550.0e-6 // 550 usec pause + #define SAMSUNG_FRAME_REPEAT_PAUSE_TIME 25.0e-3 // frame repeat after 25ms #define SAMSUNG_ADDRESS_OFFSET 0 // skip 0 bits #define SAMSUNG_ADDRESS_LEN 16 // read 16 address bits @@ -152,7 +154,7 @@ typedef uint8_t PAUSE_LEN; #define SAMSUNG32_COMMAND_OFFSET 16 // skip 16 bits #define SAMSUNG32_COMMAND_LEN 16 // read 16 command bits #define SAMSUNG32_COMPLETE_DATA_LEN 32 // complete length -#define SAMSUNG32_FRAMES 2 // SAMSUNG32 sends each frame 2 times +#define SAMSUNG32_FRAMES 1 // SAMSUNG32 sends each frame 1 times #define SAMSUNG32_AUTO_REPETITION_PAUSE_TIME 47.0e-3 // repetition after 47 ms #define SAMSUNG32_FRAME_REPEAT_PAUSE_TIME 47.0e-3 // frame repeat after 40ms @@ -449,22 +451,6 @@ typedef uint8_t PAUSE_LEN; #define NETBOX_LSB 1 // LSB #define NETBOX_FLAGS IRMP_PARAM_FLAG_IS_SERIAL // flags -#define MERLIN_START_BIT_PULSE_TIME 340.0e-6 // 340 usec pulse -#define MERLIN_START_BIT_PAUSE_TIME 300.0e-6 // 300 usec pause -#define MERLIN_PULSE_TIME 380.0e-6 // 380 usec pulse -#define MERLIN_PAUSE_TIME 310.0e-6 // 310 usec pause -#define MERLIN_FRAMES 1 // Merlin sends 1 frame -#define MERLIN_AUTO_REPETITION_PAUSE_TIME 35.0e-3 // auto repetition after 35ms -#define MERLIN_FRAME_REPEAT_PAUSE_TIME 35.0e-3 // frame repeat after 35ms -#define MERLIN_ADDRESS_OFFSET 0 // skip 0 bits -#define MERLIN_ADDRESS_LEN 9 // read 16 address bits -#define MERLIN_COMMAND_OFFSET 9 // skip 16 bits -#define MERLIN_COMMAND_LEN 16 // read 9 bits -#define MERLIN_COMPLETE_DATA_LEN 25 // complete length -#define MERLIN_STOP_BIT 0 // has no stop bit -#define MERLIN_LSB 1 // LSB -#define MERLIN_FLAGS IRMP_PARAM_FLAG_IS_SERIAL // flags - #define LEGO_START_BIT_PULSE_TIME 158.0e-6 // 158 usec pulse ( 6 x 1/38kHz) #define LEGO_START_BIT_PAUSE_TIME 1026.0e-6 // 1026 usec pause (39 x 1/38kHz) #define LEGO_PULSE_TIME 158.0e-6 // 158 usec pulse ( 6 x 1/38kHz) @@ -495,22 +481,6 @@ typedef uint8_t PAUSE_LEN; #define THOMSON_LSB 0 // MSB...LSB #define THOMSON_FLAGS 0 // flags -#define IMON_START_BIT_PULSE_TIME 1333.0e-6 // 1333 usec pulse -#define IMON_START_BIT_PAUSE_TIME 1172.0e-6 // 1333 usec pause -#define IMON_PULSE_TIME 500.0e-6 // 500 usec pulse -#define IMON_PAUSE_TIME 500.0e-6 // 500 usec pause -#define IMON_FRAMES 1 // Imon sends 1 frame -#define IMON_AUTO_REPETITION_PAUSE_TIME 35.0e-3 // auto repetition after 35ms -#define IMON_FRAME_REPEAT_PAUSE_TIME 35.0e-3 // frame repeat after 35ms -#define IMON_ADDRESS_OFFSET 0 // skip 0 bits -#define IMON_ADDRESS_LEN 0 // read 0 address bits -#define IMON_COMMAND_OFFSET 26 // skip 26 bits -#define IMON_COMMAND_LEN 16 // read last 16 bits, ignore rest -#define IMON_COMPLETE_DATA_LEN 42 // complete length, last is stop bit -#define IMON_STOP_BIT 1 // has stop bit -#define IMON_LSB 1 // LSB -#define IMON_FLAGS IRMP_PARAM_FLAG_IS_SERIAL // flags - #define AUTO_FRAME_REPETITION_TIME 80.0e-3 // SIRCS/SAMSUNG32/NUBERT: automatic repetition after 25-50ms // KASEIKYO: automatic repetition after 75ms @@ -527,29 +497,17 @@ typedef struct uint8_t flags; // flags, e.g. repetition } IRMP_DATA; +extern void irmp_init (void); +extern uint8_t irmp_get_data (IRMP_DATA *); +extern uint8_t irmp_is_busy (void); +extern uint8_t irmp_ISR (void); -/** - * Initialize IRMP decoder - * @details Configures IRMP input pin - */ -extern void irmp_init (void); - -/** - * Get IRMP data - * @details gets decoded IRMP data - * @param pointer in order to store IRMP data - * @return TRUE: successful, FALSE: failed - */ -extern uint8_t irmp_get_data (IRMP_DATA *); - -/** - * ISR routine - * @details ISR routine, called 10000 times per second - */ -extern uint8_t irmp_ISR (void); - -#ifdef __cplusplus -} +#if IRMP_PROTOCOL_NAMES == 1 +extern char * irmp_protocol_names[IRMP_N_PROTOCOLS + 1]; #endif +#if IRMP_USE_CALLBACK == 1 +extern void irmp_set_callback_ptr (void (*cb)(uint8_t)); +#endif // IRSND_USE_CALLBACK == 1 + #endif /* _WC_IRMP_H_ */