Subversion Repositories HomeAutomation

Rev

Rev 530 | Blame | Last modification | View Log | SVN | RSS feed

  1. #ifndef IRCOMMON_H_
  2. #define IRCOMMON_H_
  3.  
  4. /*-----------------------------------------------------------------------------
  5.  * Includes
  6.  *---------------------------------------------------------------------------*/
  7. #include <stdio.h>
  8.  
  9. /*-----------------------------------------------------------------------------
  10.  * Defines
  11.  *---------------------------------------------------------------------------*/
  12. #define IR_OK               1
  13. #define IR_NO_PROTOCOL      2
  14. #define IR_TIME_OVFL        3
  15. #define IR_NO_DATA          4
  16. #define IR_NOT_CORRECT_DATA 5
  17. #define IR_TO_MUCH_DATA     6
  18.  
  19. #define MAX_NR_TIMES        100
  20.  
  21. #define CYCLES_PER_US       (F_CPU/1000000)
  22. #define TIMER_PRESC         8
  23.  
  24. #define TIM_OVFL_RELOAD_VAL (65536-(12000*CYCLES_PER_US/TIMER_PRESC))   //timeout of 12ms, no pulses may be longer than this
  25.  
  26. #define IR_PROTO_RC5        0
  27. #define IR_RC5_ST_BIT       889*CYCLES_PER_US/TIMER_PRESC       //us
  28. #define IR_RC5_HALF_BIT     889*CYCLES_PER_US/TIMER_PRESC       //us
  29. #define IR_RC5_BIT          889*2*CYCLES_PER_US/TIMER_PRESC     //us
  30. #define IR_RC5_REPETITION   105                                 //ms    (time between pulsetrains)
  31. #define IR_RC5_F_MOD        36                                  //kHz   (modulation frequency)
  32. #define IR_RC5_TOL_DIV      4
  33.  
  34. /* not implemented */
  35. #define IR_PROTO_RC6        1
  36. #define IR_RC6_ST_BIT       1*CYCLES_PER_US/TIMER_PRESC         //us
  37. #define IR_RC6_REPETITION   1                                   //ms    (time between pulsetrains)
  38. #define IR_RC6_F_MOD        36                                  //kHz   (modulation frequency)
  39. #define IR_RC6_TOL_DIV      4
  40.  
  41. /* not implemented */
  42. #define IR_PROTO_RCMM       2                               //Wont work together with SHARP
  43. #define IR_RCMM_ST_BIT      256*CYCLES_PER_US/TIMER_PRESC       //us
  44. #define IR_RCMM_REPETITION 158                                  //ms    (time between pulsetrains)
  45. #define IR_RCMM_F_MOD       36                                  //kHz   (modulation frequency)
  46. #define IR_RCMM_TOL_DIV     4
  47.  
  48. #define IR_PROTO_SIRC       3
  49. #define IR_SIRC_ST_BIT      2400*CYCLES_PER_US/TIMER_PRESC      //us
  50. #define IR_SIRC_REPETITION  40                                  //ms    (time between pulsetrains)
  51. #define IR_SIRC_F_MOD       40                                  //kHz   (modulation frequency)
  52. #define IR_SIRC_LOW         600*CYCLES_PER_US/TIMER_PRESC       //us
  53. #define IR_SIRC_HIGH_ONE    1200*CYCLES_PER_US/TIMER_PRESC      //us
  54. #define IR_SIRC_HIGH_ZERO   600*CYCLES_PER_US/TIMER_PRESC       //us
  55. #define IR_SIRC_TOL_DIV     4
  56.  
  57. #define IR_PROTO_SHARP      4                               //Wont work together with RCMM
  58. #define IR_SHARP_HIGH       280*CYCLES_PER_US/TIMER_PRESC       //us
  59. #define IR_SHARP_LOW_ONE    1850*CYCLES_PER_US/TIMER_PRESC      //us
  60. #define IR_SHARP_LOW_ZERO   780*CYCLES_PER_US/TIMER_PRESC       //us
  61. #define IR_SHARP_REPETITION 55                                  //ms    (time between pulsetrains)
  62. #define IR_SHARP_F_MOD      38                                  //kHz   (modulation frequency)
  63. #define IR_SHARP_TOL_DIV    4
  64.  
  65. #define IR_PROTO_NEC        5
  66. #define IR_NEC_ST_BIT       9000*CYCLES_PER_US/TIMER_PRESC      //us
  67. #define IR_NEC_ST_PAUSE     4500*CYCLES_PER_US/TIMER_PRESC      //us
  68. #define IR_NEC_REPETITION   110                                 //ms    (time between pulsetrains)
  69. #define IR_NEC_F_MOD        38                                  //kHz   (modulation frequency)
  70. #define IR_NEC_LOW_ONE      1690*CYCLES_PER_US/TIMER_PRESC      //us
  71. #define IR_NEC_LOW_ZERO     560*CYCLES_PER_US/TIMER_PRESC       //us
  72. #define IR_NEC_HIGH         560*CYCLES_PER_US/TIMER_PRESC       //us
  73. #define IR_NEC_TOL_DIV      4
  74.  
  75. #define IR_PROTO_SAMS       6
  76. #define IR_SAMS_ST_BIT      4500*CYCLES_PER_US/TIMER_PRESC      //us
  77. #define IR_SAMS_ST_PAUSE    4500*CYCLES_PER_US/TIMER_PRESC      //us
  78. #define IR_SAMS_REPETITION  55                                  //ms    (time between pulsetrains)
  79. #define IR_SAMS_F_MOD       38                                  //kHz   (modulation frequency)
  80. #define IR_SAMS_LOW_ONE     1690*CYCLES_PER_US/TIMER_PRESC      //us
  81. #define IR_SAMS_LOW_ZERO    560*CYCLES_PER_US/TIMER_PRESC       //us
  82. #define IR_SAMS_HIGH        560*CYCLES_PER_US/TIMER_PRESC       //us
  83. #define IR_SAMS_TOL_DIV     3
  84.  
  85. #define IR_PROTO_UNKNOWN    0xff                                //
  86.  
  87. #endif /*IRCOMMON_H_*/
  88.