X-Git-Url: http://cloudbase.mooo.com/gitweb/irmp.git/blobdiff_plain/f50e01e79ba83c2142178a0e2431034c410d7fd0..93570cd97cecf623cf97269629090259826f93ee:/irmp.h diff --git a/irmp.h b/irmp.h index cac734f..b694e26 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.60 2011/04/11 12:54:24 fm Exp $ + * $Id: irmp.h,v 1.65 2011/09/08 13:22:16 fm Exp $ * * ATMEGA88 @ 8 MHz * @@ -17,11 +17,6 @@ #ifndef _WC_IRMP_H_ #define _WC_IRMP_H_ -#ifdef __cplusplus -extern "C" -{ -#endif - /*--------------------------------------------------------------------------------------------------------------------------------------------------- * timing constants: *--------------------------------------------------------------------------------------------------------------------------------------------------- @@ -77,7 +72,9 @@ typedef uint8_t PAUSE_LEN; #define IRMP_NEC16_PROTOCOL 27 // NEC with 16 bits (incl. sync) #define IRMP_NEC42_PROTOCOL 28 // NEC with 42 bits #define IRMP_LEGO_PROTOCOL 29 // LEGO Power Functions RC -#define IRMP_IMON_PROTOCOL 99 // Imon (bitserial) PROTOTYPE! +#define IRMP_THOMSON_PROTOCOL 30 // Thomson + +#define IRMP_N_PROTOCOLS 30 // number of supported protocols // some flags of struct IRMP_PARAMETER: #define IRMP_PARAM_FLAG_IS_MANCHESTER 0x01 @@ -204,8 +201,8 @@ typedef uint8_t PAUSE_LEN; #define RC5_BIT_TIME 889.0e-6 // 889 usec pulse/pause #define RC5_FRAME_REPEAT_PAUSE_TIME 45.0e-3 // frame repeat after 45ms -#define RC5_ADDRESS_OFFSET 2 // skip 2 bits (2nd start + 1 toggle) -#define RC5_ADDRESS_LEN 5 // read 5 address bits +#define RC5_ADDRESS_OFFSET 1 // skip 1 bit (2nd start) +#define RC5_ADDRESS_LEN 6 // read 1 toggle bit (for key repetition detection) + 5 address bits #define RC5_COMMAND_OFFSET 7 // skip 5 bits (2nd start + 1 toggle + 5 address) #define RC5_COMMAND_LEN 6 // read 6 command bits #define RC5_COMPLETE_DATA_LEN 13 // complete length @@ -399,7 +396,7 @@ typedef uint8_t PAUSE_LEN; #define NIKON_START_BIT_PULSE_TIME 2200.0e-6 // 2200 usec pulse #define NIKON_START_BIT_PAUSE_TIME 27100.0e-6 // 27100 usec pause -#define NIKON_PULSE_TIME 500.0e-6 // 520 usec pulse +#define NIKON_PULSE_TIME 500.0e-6 // 500 usec pulse #define NIKON_1_PAUSE_TIME 3500.0e-6 // 3500 usec pause #define NIKON_0_PAUSE_TIME 1500.0e-6 // 1500 usec pause #define NIKON_FRAME_REPEAT_PAUSE_TIME 60.0e-3 // frame repeat after 60ms @@ -462,21 +459,20 @@ typedef uint8_t PAUSE_LEN; #define LEGO_LSB 0 // MSB...LSB #define LEGO_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 THOMSON_PULSE_TIME 550.0e-6 // 550 usec pulse +#define THOMSON_1_PAUSE_TIME 4500.0e-6 // 4500 usec pause +#define THOMSON_0_PAUSE_TIME 2000.0e-6 // 2000 usec pause +#define THOMSON_FRAMES 1 // THOMSON sends 1 frame +#define THOMSON_AUTO_REPETITION_PAUSE_TIME 65.0e-3 // repetition after 65ms +#define THOMSON_FRAME_REPEAT_PAUSE_TIME 65.0e-3 // frame repeat after 65ms +#define THOMSON_ADDRESS_OFFSET 0 // skip 0 bits +#define THOMSON_ADDRESS_LEN 4 // read 4 address bits +#define THOMSON_COMMAND_OFFSET 5 // skip 4 address bits + 1 toggle bit +#define THOMSON_COMMAND_LEN 7 // read 7 command bits +#define THOMSON_COMPLETE_DATA_LEN 12 // complete length +#define THOMSON_STOP_BIT 1 // has stop bit +#define THOMSON_LSB 0 // MSB...LSB +#define THOMSON_FLAGS 0 // flags #define AUTO_FRAME_REPETITION_TIME 80.0e-3 // SIRCS/SAMSUNG32/NUBERT: automatic repetition after 25-50ms // KASEIKYO: automatic repetition after 75ms @@ -494,29 +490,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_ */