hardware.h 4.5 KB

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