Subversion Repositories HomeAutomation

Rev

Rev 523 | 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_FAILED           -1  //?
  14. #define IR_NO_PROTOCOL      2
  15. #define IR_TIME_OVFL        3
  16. #define IR_NO_DATA          4
  17. #define IR_NOT_CORRECT_DATA 5
  18.  
  19. #define CYCLES_PER_US       (F_CPU/1000000)
  20. #define TIMER_PRESC         8
  21.  
  22. #define TIM_OVFL_RELOAD_VAL 65536-(12000*CYCLES_PER_US/TIMER_PRESC)     //timeout of 12ms when CYCLES_PER_US is 8 and TIMER_PRESC is 8
  23.  
  24. #define IR_PROTO_RC5        0
  25. #define IR_RC5_ST_BIT       864*CYCLES_PER_US/TIMER_PRESC       //us
  26. #define IR_RC5_BIT          864*2*CYCLES_PER_US/TIMER_PRESC
  27. #define IR_RC5_REPETITION   105                                 //ms    (time between pulsetrains)
  28. #define IR_RC5_F_MOD        36                                  //kHz   (modulation frequency)
  29.  
  30. #define IR_PROTO_RC6        1
  31. #define IR_RC6_ST_BIT       1*CYCLES_PER_US/TIMER_PRESC         //us
  32. #define IR_RC6_REPETITION   1                                   //ms    (time between pulsetrains)
  33. #define IR_RC6_F_MOD        36                                  //kHz   (modulation frequency)
  34.  
  35. #define IR_PROTO_RCMM       2                               //Wont work together with SHARP
  36. #define IR_RCMM_ST_BIT      256*CYCLES_PER_US/TIMER_PRESC       //us
  37. #define IR_RCMM_REPETITION 158                                  //ms    (time between pulsetrains)
  38. #define IR_RCMM_F_MOD       36                                  //kHz   (modulation frequency)
  39.  
  40. #define IR_PROTO_SIRC       3
  41. #define IR_SIRC_ST_BIT      2400*CYCLES_PER_US/TIMER_PRESC      //us
  42. #define IR_SIRC_REPETITION  40                                  //ms    (time between pulsetrains)
  43. #define IR_SIRC_F_MOD       40                                  //kHz   (modulation frequency)
  44. #define IR_SIRC_ZERO_LOW    450*CYCLES_PER_US/TIMER_PRESC       //us
  45. #define IR_SIRC_ZERO_HIGH   750*CYCLES_PER_US/TIMER_PRESC       //us
  46. #define IR_SIRC_ONE_LOW     1050*CYCLES_PER_US/TIMER_PRESC      //us
  47. #define IR_SIRC_ONE_HIGH    1350*CYCLES_PER_US/TIMER_PRESC      //us
  48.  
  49. #define IR_PROTO_SHARP      4                               //Wont work together with RCMM
  50. #define IR_SHARP_ST_BIT     275*CYCLES_PER_US/TIMER_PRESC       //us
  51. #define IR_SHARP_REPETITION 55                                  //ms    (time between pulsetrains)
  52. #define IR_SHARP_F_MOD      38                                  //kHz   (modulation frequency)
  53.  
  54.  
  55.  
  56. #endif /*IRCOMMON_H_*/
  57.