Subversion Repositories HomeAutomation

Rev

Rev 524 | 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.  
  33. #define IR_PROTO_RC6        1
  34. #define IR_RC6_ST_BIT       1*CYCLES_PER_US/TIMER_PRESC         //us
  35. #define IR_RC6_REPETITION   1                                   //ms    (time between pulsetrains)
  36. #define IR_RC6_F_MOD        36                                  //kHz   (modulation frequency)
  37.  
  38. #define IR_PROTO_RCMM       2                               //Wont work together with SHARP
  39. #define IR_RCMM_ST_BIT      256*CYCLES_PER_US/TIMER_PRESC       //us
  40. #define IR_RCMM_REPETITION 158                                  //ms    (time between pulsetrains)
  41. #define IR_RCMM_F_MOD       36                                  //kHz   (modulation frequency)
  42.  
  43. #define IR_PROTO_SIRC       3
  44. #define IR_SIRC_ST_BIT      2400*CYCLES_PER_US/TIMER_PRESC      //us
  45. #define IR_SIRC_REPETITION  40                                  //ms    (time between pulsetrains)
  46. #define IR_SIRC_F_MOD       40                                  //kHz   (modulation frequency)
  47. #define IR_SIRC_LOW         600*CYCLES_PER_US/TIMER_PRESC       //us
  48. #define IR_SIRC_HIGH_ONE    1200*CYCLES_PER_US/TIMER_PRESC      //us
  49. #define IR_SIRC_HIGH_ZERO   600*CYCLES_PER_US/TIMER_PRESC       //us
  50. #if 0
  51. #define IR_SIRC_ZERO_LOW    450*CYCLES_PER_US/TIMER_PRESC       //us
  52. #define IR_SIRC_ZERO_HIGH   750*CYCLES_PER_US/TIMER_PRESC       //us
  53. #define IR_SIRC_ONE_LOW     1050*CYCLES_PER_US/TIMER_PRESC      //us
  54. #define IR_SIRC_ONE_HIGH    1350*CYCLES_PER_US/TIMER_PRESC      //us
  55. #endif
  56.  
  57. #define IR_PROTO_SHARP      4                               //Wont work together with RCMM
  58. #define IR_SHARP_ST_BIT     275*CYCLES_PER_US/TIMER_PRESC       //us
  59. #define IR_SHARP_REPETITION 55                                  //ms    (time between pulsetrains)
  60. #define IR_SHARP_F_MOD      38                                  //kHz   (modulation frequency)
  61.  
  62.  
  63. #define IR_PROTO_UNKNOWN    0xff                                //
  64.  
  65. #endif /*IRCOMMON_H_*/
  66.