Subversion Repositories HomeAutomation

Rev

Rev 1853 | Rev 1866 | Go to most recent revision | 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. #define MAX_NR_TIMES        101                                 //max ir pulses+pauses, used for dimensioning the buffer
  27.  
  28. #define TRUE 1
  29. #define FALSE 0
  30.  
  31. #ifndef IR_RX_ACTIVE_LOW
  32. #define IR_RX_ACTIVE_LOW    1
  33. #endif
  34.  
  35. #ifndef IR_TX_ACTIVE_LOW
  36. #define IR_TX_ACTIVE_LOW    0
  37. #endif
  38.  
  39. #ifndef IR_TX_ENABLE
  40. #define IR_TX_ENABLE    0
  41. #endif
  42.  
  43. #ifndef IR_RX_ENABLE
  44. #define IR_RX_ENABLE    0
  45. #endif
  46.  
  47. #ifndef IR_SUPPORTED_NUM_CHANNELS
  48. #define IR_SUPPORTED_NUM_CHANNELS 3
  49. #endif
  50.  
  51. /**
  52.  * @brief Type of the callback function pointer
  53.  * parameters: channel, buffer, length
  54.  */
  55. typedef void (*irRxCallback_t)(uint8_t, uint16_t*, uint8_t);
  56. typedef void (*irTxCallback_t)(uint8_t);
  57.  
  58.  
  59. /*-----------------------------------------------------------------------------
  60.  * Public Function Prototypes
  61.  *---------------------------------------------------------------------------*/
  62. int IrTransceiver_Transmit(uint8_t channel, uint16_t *buffer, uint8_t start, uint8_t length, uint16_t modfreqkHz);
  63.  
  64. void IrTransceiver_Init(void);
  65. uint8_t IrTransceiver_GetStoreEnableRx(uint8_t channel);
  66. void IrTransceiver_DisableRx(uint8_t channel);
  67. void IrTransceiver_EnableRx(uint8_t channel);
  68. void IrTransceiver_ResetRx(uint8_t channel);
  69.  
  70. 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);
  71. 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);
  72. 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);
  73.  
  74. //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);
  75.  
  76. /* Active TX mod freq in kHz */
  77. extern uint16_t drvIrTxModFreqkHz;
  78.  
  79. /*-----------------------------------------------------------------------------
  80.  * Private Function Prototypes
  81.  *---------------------------------------------------------------------------*/
  82.  
  83. void IrTransceiver_Store(uint8_t channel);
  84.  
  85. #endif /*IRTRANSCEIVER_H_*/
  86.