Subversion Repositories HomeAutomation

Rev

Rev 1931 | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. /**
  2.  * @defgroup infrared IR Driver Library
  3.  * @code #include <drivers/ir/transceiver/transceiver.h> @endcode
  4.  *
  5.  * @brief  
  6.  *
  7.  *
  8.  * @author  Andreas Fritiofson, Anders Runeson
  9.  * @date    2007
  10.  */
  11.  
  12. /**@{*/
  13.  
  14. #ifndef IRTRANSCEIVER_H_
  15. #define IRTRANSCEIVER_H_
  16.  
  17. /*-----------------------------------------------------------------------------
  18.  * Includes
  19.  *---------------------------------------------------------------------------*/
  20. #include <stdio.h>
  21.  
  22. /*-----------------------------------------------------------------------------
  23.  * Defines
  24.  *---------------------------------------------------------------------------*/
  25.  
  26. #ifndef MAX_NR_TIMES
  27. #define MAX_NR_TIMES        127                                 //max ir pulses+pauses, used for dimensioning the buffer
  28. #endif
  29.  
  30. #define TRUE 1
  31. #define FALSE 0
  32.  
  33. #ifndef IR_RX_ACTIVE_LOW
  34. #define IR_RX_ACTIVE_LOW    1
  35. #endif
  36.  
  37. #ifndef IR_TX_ACTIVE_LOW
  38. #define IR_TX_ACTIVE_LOW    0
  39. #endif
  40.  
  41. #ifndef IR_TX_ENABLE
  42. #define IR_TX_ENABLE    0
  43. #endif
  44.  
  45. #ifndef IR_RX_ENABLE
  46. #define IR_RX_ENABLE    0
  47. #endif
  48.  
  49. #ifndef IR_SUPPORTED_NUM_CHANNELS
  50. #define IR_SUPPORTED_NUM_CHANNELS 3
  51. #endif
  52.  
  53. #ifndef IR_RX_CONTINUOUS_MODE
  54. #define IR_RX_CONTINUOUS_MODE   0
  55. #endif
  56.  
  57.  
  58. /**
  59.  * @brief Type of the callback function pointer
  60.  * parameters: channel, buffer, length
  61.  */
  62. typedef void (*irRxCallback_t)(uint8_t, uint16_t*, uint8_t, uint8_t);
  63. typedef void (*irTxCallback_t)(uint8_t);
  64.  
  65.  
  66. /*-----------------------------------------------------------------------------
  67.  * Public Function Prototypes
  68.  *---------------------------------------------------------------------------*/
  69. int IrTransceiver_Transmit(uint8_t channel, uint16_t *buffer, uint8_t start, uint8_t length, uint16_t modfreqkHz);
  70.  
  71. void IrTransceiver_Init(void);
  72. uint8_t IrTransceiver_GetStoreEnableRx(uint8_t channel);
  73. void IrTransceiver_DisableRx(uint8_t channel);
  74. void IrTransceiver_EnableRx(uint8_t channel);
  75. void IrTransceiver_ResetRx(uint8_t channel);
  76.  
  77. void IrTransceiver_InitRxChannel(uint8_t channel, uint16_t *buffer, irRxCallback_t callback, uint8_t pcint_id, volatile uint8_t* port, volatile uint8_t* pin, volatile uint8_t* ddr,uint8_t nr, uint8_t pcint);
  78. void IrTransceiver_DeInitRxChannel(uint8_t channel, uint8_t pcint_id, volatile uint8_t* port, volatile uint8_t* pin, volatile uint8_t* ddr,uint8_t nr, uint8_t pcint);
  79. void IrTransceiver_InitTxChannel(uint8_t channel, irTxCallback_t callback, volatile uint8_t *port, volatile uint8_t *pin, volatile uint8_t *ddr,uint8_t nr, uint8_t pcint);
  80.  
  81. //void IrTransceiver_Init_RX_Channel(uint8_t channel, uint16_t *buffer, irCallback_t callback, uint8_t pcint_id, volatile uint8_t* port, volatile uint8_t* pin, volatile uint8_t* ddr,uint8_t nr, uint8_t pcint);
  82.  
  83. /* Active TX mod freq in kHz */
  84. extern uint16_t drvIrTxModFreqkHz;
  85.  
  86. /*-----------------------------------------------------------------------------
  87.  * Private Function Prototypes
  88.  *---------------------------------------------------------------------------*/
  89.  
  90. void IrTransceiver_Store(uint8_t channel);
  91.  
  92. #endif /*IRTRANSCEIVER_H_*/
  93.