My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fastio_STM32F4.h 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
  7. * Copyright (C) 2017 Victor Perez
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. #pragma once
  24. /**
  25. * Fast I/O interfaces for STM32F4
  26. * These use GPIO functions instead of Direct Port Manipulation, as on AVR.
  27. */
  28. #undef _BV
  29. #define _BV(b) (1 << (b))
  30. #define READ(IO) digitalRead(IO)
  31. #define WRITE(IO,V) digitalWrite(IO,V)
  32. #define WRITE_VAR(IO,V) WRITE(IO,V)
  33. #define _GET_MODE(IO)
  34. #define _SET_MODE(IO,M) pinMode(IO, M)
  35. #define _SET_OUTPUT(IO) pinMode(IO, OUTPUT) /*!< Output Push Pull Mode & GPIO_NOPULL */
  36. #define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)
  37. #define SET_INPUT(IO) _SET_MODE(IO, INPUT) /*!< Input Floating Mode */
  38. #define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) /*!< Input with Pull-up activation */
  39. #define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN) /*!< Input with Pull-down activation */
  40. #define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
  41. #define SET_PWM(IO) pinMode(IO, PWM)
  42. #define TOGGLE(IO) OUT_WRITE(IO, !READ(IO))
  43. #define IS_INPUT(IO)
  44. #define IS_OUTPUT(IO)
  45. #define PWM_PIN(P) true
  46. // digitalRead/Write wrappers
  47. #define extDigitalRead(IO) digitalRead(IO)
  48. #define extDigitalWrite(IO,V) digitalWrite(IO,V)
  49. //
  50. // Pins Definitions
  51. //
  52. #define PORTA 0
  53. #define PORTB 1
  54. #define PORTC 2
  55. #define PORTD 3
  56. #define PORTE 4
  57. #define _STM32_PIN(_PORT,_PIN) ((PORT##_PORT * 16) + _PIN)
  58. #define PA0 _STM32_PIN(A, 0)
  59. #define PA1 _STM32_PIN(A, 1)
  60. #define PA2 _STM32_PIN(A, 2)
  61. #define PA3 _STM32_PIN(A, 3)
  62. #define PA4 _STM32_PIN(A, 4)
  63. #define PA5 _STM32_PIN(A, 5)
  64. #define PA6 _STM32_PIN(A, 6)
  65. #define PA7 _STM32_PIN(A, 7)
  66. #define PA8 _STM32_PIN(A, 8)
  67. #define PA9 _STM32_PIN(A, 9)
  68. #define PA10 _STM32_PIN(A, 10)
  69. #define PA11 _STM32_PIN(A, 11)
  70. #define PA12 _STM32_PIN(A, 12)
  71. #define PA13 _STM32_PIN(A, 13)
  72. #define PA14 _STM32_PIN(A, 14)
  73. #define PA15 _STM32_PIN(A, 15)
  74. #define PB0 _STM32_PIN(B, 0)
  75. #define PB1 _STM32_PIN(B, 1)
  76. #define PB2 _STM32_PIN(B, 2)
  77. #define PB3 _STM32_PIN(B, 3)
  78. #define PB4 _STM32_PIN(B, 4)
  79. #define PB5 _STM32_PIN(B, 5)
  80. #define PB6 _STM32_PIN(B, 6)
  81. #define PB7 _STM32_PIN(B, 7)
  82. #define PB8 _STM32_PIN(B, 8)
  83. #define PB9 _STM32_PIN(B, 9)
  84. #define PB10 _STM32_PIN(B, 10)
  85. #define PB11 _STM32_PIN(B, 11)
  86. #define PB12 _STM32_PIN(B, 12)
  87. #define PB13 _STM32_PIN(B, 13)
  88. #define PB14 _STM32_PIN(B, 14)
  89. #define PB15 _STM32_PIN(B, 15)
  90. #define PC0 _STM32_PIN(C, 0)
  91. #define PC1 _STM32_PIN(C, 1)
  92. #define PC2 _STM32_PIN(C, 2)
  93. #define PC3 _STM32_PIN(C, 3)
  94. #define PC4 _STM32_PIN(C, 4)
  95. #define PC5 _STM32_PIN(C, 5)
  96. #define PC6 _STM32_PIN(C, 6)
  97. #define PC7 _STM32_PIN(C, 7)
  98. #define PC8 _STM32_PIN(C, 8)
  99. #define PC9 _STM32_PIN(C, 9)
  100. #define PC10 _STM32_PIN(C, 10)
  101. #define PC11 _STM32_PIN(C, 11)
  102. #define PC12 _STM32_PIN(C, 12)
  103. #define PC13 _STM32_PIN(C, 13)
  104. #define PC14 _STM32_PIN(C, 14)
  105. #define PC15 _STM32_PIN(C, 15)
  106. #define PD0 _STM32_PIN(D, 0)
  107. #define PD1 _STM32_PIN(D, 1)
  108. #define PD2 _STM32_PIN(D, 2)
  109. #define PD3 _STM32_PIN(D, 3)
  110. #define PD4 _STM32_PIN(D, 4)
  111. #define PD5 _STM32_PIN(D, 5)
  112. #define PD6 _STM32_PIN(D, 6)
  113. #define PD7 _STM32_PIN(D, 7)
  114. #define PD8 _STM32_PIN(D, 8)
  115. #define PD9 _STM32_PIN(D, 9)
  116. #define PD10 _STM32_PIN(D, 10)
  117. #define PD11 _STM32_PIN(D, 11)
  118. #define PD12 _STM32_PIN(D, 12)
  119. #define PD13 _STM32_PIN(D, 13)
  120. #define PD14 _STM32_PIN(D, 14)
  121. #define PD15 _STM32_PIN(D, 15)
  122. #define PE0 _STM32_PIN(E, 0)
  123. #define PE1 _STM32_PIN(E, 1)
  124. #define PE2 _STM32_PIN(E, 2)
  125. #define PE3 _STM32_PIN(E, 3)
  126. #define PE4 _STM32_PIN(E, 4)
  127. #define PE5 _STM32_PIN(E, 5)
  128. #define PE6 _STM32_PIN(E, 6)
  129. #define PE7 _STM32_PIN(E, 7)
  130. #define PE8 _STM32_PIN(E, 8)
  131. #define PE9 _STM32_PIN(E, 9)
  132. #define PE10 _STM32_PIN(E, 10)
  133. #define PE11 _STM32_PIN(E, 11)
  134. #define PE12 _STM32_PIN(E, 12)
  135. #define PE13 _STM32_PIN(E, 13)
  136. #define PE14 _STM32_PIN(E, 14)
  137. #define PE15 _STM32_PIN(E, 15)