pins_arduino.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-08-05 liYony first version
  9. */
  10. #include <Arduino.h>
  11. #include <board.h>
  12. #include "pins_arduino.h"
  13. /*
  14. {Arduino Pin, RT-Thread Pin [, Device Name(PWM or ADC), Channel]}
  15. [] means optional
  16. Digital pins must NOT give the device name and channel.
  17. Analog pins MUST give the device name and channel(ADC, PWM or DAC).
  18. Arduino Pin must keep in sequence.
  19. */
  20. const pin_map_t pin_map_table[]=
  21. {
  22. {D0}, /* RX */
  23. {D1}, /* TX */
  24. {D2}, /* I2C1-SDA */
  25. {D3}, /* I2C1-SCL */
  26. {D4, GET_PIN(B,7)},
  27. {D5, GET_PIN(B,6)},
  28. {D6, GET_PIN(B,5), "pwm3", 2},/* PWM */
  29. {D7, GET_PIN(B,4), "pwm3", 1}, /* PWM */
  30. {D8, GET_PIN(B,3), "pwm2", 2}, /* PWM */
  31. {D9, GET_PIN(A,15), "pwm2", 1}, /* PWM */
  32. {D10}, /* USB-DP */
  33. {D11}, /* USB-DM */
  34. {D12}, /* UART1-RX */
  35. {D13}, /* UART1-TX */
  36. {D14, GET_PIN(A,8), "pwm1", 1}, /* PWM */
  37. {D15, GET_PIN(B,15)},
  38. {D16, GET_PIN(B,14)},
  39. {D17, GET_PIN(B,13), "pwm1", -1}, /* PWM */
  40. {D18, GET_PIN(B,12)},
  41. {D19, GET_PIN(C,13)}, /* user led1 */
  42. {D20, GET_PIN(C,14)},
  43. {D21, GET_PIN(C,15)},
  44. {D22}, /* UART2-TX */
  45. {D23}, /* UART2-RX */
  46. /* The connection of RTdunio SPI has not been completed, *
  47. * and it can only be used as a common GPIO at present. */
  48. {D24, GET_PIN(A,5)}, /* SPI-SCK */
  49. {D25, GET_PIN(A,6)}, /* SPI-MISO */
  50. {D26, GET_PIN(A,7)}, /* SPI-MOSI */
  51. {D27}, /* UART3-TX */
  52. {D28}, /* UART3-RX */
  53. {A0, GET_PIN(A,0), "adc1", 0}, /* ADC */
  54. {A1, GET_PIN(A,1), "adc1", 1}, /* ADC */
  55. {A2, GET_PIN(A,4), "adc1", 4}, /* ADC */
  56. {A3, GET_PIN(B,0), "adc1", 8}, /* ADC */
  57. {A4, GET_PIN(B,1), "adc1", 9}, /* ADC */
  58. {A5, RT_NULL, "adc1", 17}, /* ADC, On-Chip: internal reference voltage, ADC_CHANNEL_VREFINT */
  59. {A6, RT_NULL, "adc1", 16} /* ADC, On-Chip: internal temperature sensor, ADC_CHANNEL_TEMPSENSOR */
  60. };