hardware.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. // defining the hardware connections
  2. #ifdef __AVR_ATmega328P__
  3. // Arduino Hardware
  4. const byte Din_1 = 0;
  5. const byte Din_2 = 1;
  6. const byte Din_3 = 2;
  7. const byte Din_4 = 3;
  8. const byte Dout_1 = 4;
  9. const byte Dout_2 = 5;
  10. const byte Dout_3 = 6;
  11. const byte Dout_4 = 7;
  12. const byte ADC_0 = 0; //(15)
  13. const byte ADC_1 = 1; //(16)
  14. const byte PWM_1 = 9;
  15. const byte PWM_2 = 10;
  16. #ifdef SPS_RCRECEIVER
  17. const byte RC_0 = 18;
  18. const byte RC_1 = 19;
  19. #endif
  20. #ifdef SPS_SERVO
  21. const byte SERVO_1 = 9;
  22. const byte SERVO_2 = 10;
  23. #endif
  24. const byte SW_PRG = 8;
  25. const byte SW_SEL = 11;
  26. #ifdef SPS_USE_DISPLAY
  27. const byte DIGIT_DATA_IO = 12;
  28. const byte DIGIT_CLOCK = 13;
  29. #endif
  30. #define getAnalog(pin) (analogRead(pin) >> 2)
  31. #endif
  32. #ifdef __AVR_ATtiny84__
  33. // ATTiny84 Hardware
  34. const byte Dout_1 = 6;
  35. const byte Dout_2 = 5;
  36. const byte Dout_3 = 4;
  37. const byte Dout_4 = 1;
  38. const byte Din_1 = 10;
  39. const byte Din_2 = 9;
  40. const byte Din_3 = 8;
  41. const byte Din_4 = 7;
  42. const byte ADC_0 = 0;
  43. const byte ADC_1 = 1;
  44. const byte PWM_1 = 2;
  45. const byte PWM_2 = 3;
  46. #ifdef SPS_RCRECEIVER
  47. const byte RC_0 = 10;
  48. const byte RC_1 = 9;
  49. #endif
  50. #ifdef SPS_SERVO
  51. const byte SERVO_1 = 2;
  52. const byte SERVO_2 = 3;
  53. #endif
  54. const byte SW_PRG = 0;
  55. const byte SW_SEL = 8;
  56. #ifdef SPS_USE_DISPLAY
  57. const byte DIGIT_DATA_IO = 4;
  58. const byte DIGIT_CLOCK = 5;
  59. #endif
  60. #define getAnalog(pin) (analogRead(pin) >> 2)
  61. #endif
  62. #ifdef __AVR_ATtiny4313__
  63. // ATTiny4313 Hardware
  64. const byte Dout_1 = 0;
  65. const byte Dout_2 = 1;
  66. const byte Dout_3 = 2;
  67. const byte Dout_4 = 3;
  68. const byte Din_1 = 4;
  69. const byte Din_2 = 5;
  70. const byte Din_3 = 6;
  71. const byte Din_4 = 7;
  72. const byte ADC_0 = 13;
  73. const byte ADC_1 = 14;
  74. const byte PWM_1 = 11;
  75. const byte PWM_2 = 12;
  76. #ifdef SPS_RCRECEIVER
  77. const byte RC_0 = 15;
  78. const byte RC_1 = 16;
  79. #endif
  80. #ifdef SPS_SERVO
  81. const byte SERVO_1 = 11;
  82. const byte SERVO_2 = 12;
  83. #endif
  84. const byte SW_PRG = 9;
  85. const byte SW_SEL = 8;
  86. #define getAnalog(pin) (analogRead(pin) >> 2)
  87. #endif
  88. #ifdef __AVR_ATtiny861__
  89. // ATTiny4313 Hardware
  90. const byte Dout_1 = 0;
  91. const byte Dout_2 = 1;
  92. const byte Dout_3 = 2;
  93. const byte Dout_4 = 3;
  94. const byte Din_1 = 4;
  95. const byte Din_2 = 5;
  96. const byte Din_3 = 6;
  97. const byte Din_4 = 7;
  98. const byte ADC_0 = 13;
  99. const byte ADC_1 = 14;
  100. const byte PWM_1 = 11;
  101. const byte PWM_2 = 12;
  102. #ifdef SPS_RCRECEIVER
  103. const byte RC_0 = 15;
  104. const byte RC_1 = 16;
  105. #endif
  106. #ifdef SPS_SERVO
  107. const byte SERVO_1 = 11;
  108. const byte SERVO_2 = 12;
  109. #endif
  110. const byte SW_PRG = 9;
  111. const byte SW_SEL = 8;
  112. #define getAnalog(pin) (analogRead(pin) >> 2)
  113. #endif
  114. #ifdef _MICROBIT_V2_
  115. // Microbit V2 Hardware
  116. const byte Din_1 = 0;
  117. const byte Din_2 = 1;
  118. const byte Din_3 = 2;
  119. const byte Din_4 = 3;
  120. const byte Dout_1 = 4;
  121. const byte Dout_2 = 5;
  122. const byte Dout_3 = 6;
  123. const byte Dout_4 = 7;
  124. const byte ADC_0 = 0; //(15)
  125. const byte ADC_1 = 1; //(16)
  126. const byte PWM_1 = 9;
  127. const byte PWM_2 = 10;
  128. #ifdef SPS_RCRECEIVER
  129. const byte RC_0 = 18;
  130. const byte RC_1 = 19;
  131. #endif
  132. #ifdef SPS_SERVO
  133. const byte SERVO_1 = 9;
  134. const byte SERVO_2 = 10;
  135. #endif
  136. const byte SW_PRG = 8;
  137. const byte SW_SEL = 11;
  138. #ifdef SPS_USE_DISPLAY
  139. const byte DIGIT_DATA_IO = 12;
  140. const byte DIGIT_CLOCK = 13;
  141. #endif
  142. #define getAnalog(pin) (analogRead(pin) >> 2)
  143. #endif
  144. #ifdef ESP32
  145. // ESP32 Hardware
  146. const byte Din_1 = 26;
  147. const byte Din_2 = 18;
  148. const byte Din_3 = 19;
  149. const byte Din_4 = 23;
  150. const byte Dout_1 = 22;
  151. const byte Dout_2 = 21;
  152. const byte Dout_3 = 17;
  153. const byte Dout_4 = 16;
  154. const byte ADC_0 = 36;
  155. const byte ADC_1 = 39;
  156. const byte PWM_1 = 27;
  157. const byte PWM_2 = 25;
  158. #ifdef SPS_RCRECEIVER
  159. const byte RC_0 = 34;
  160. const byte RC_1 = 35;
  161. #endif
  162. #ifdef SPS_SERVO
  163. const byte SERVO_1 = 27; //14
  164. const byte SERVO_2 = 25; //32
  165. #endif
  166. const byte SW_PRG = 13;
  167. const byte SW_SEL = 12;
  168. #ifdef SPS_USE_DISPLAY
  169. const byte DIGIT_DATA_IO = 32;
  170. const byte DIGIT_CLOCK = 33;
  171. #endif
  172. #define getAnalog(pin) (analogRead(pin) >> 4)
  173. #endif