pins_arduino.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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, 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, GET_PIN(B,7)},
  23. {D1, GET_PIN(B,6)},
  24. {D2, GET_PIN(B,5), "pwm3", 2}, /* PWM */
  25. {D3, GET_PIN(B,4), "pwm3", 1}, /* PWM */
  26. {D4, GET_PIN(B,3), "pwm2", 2}, /* PWM */
  27. {D5, GET_PIN(A,15), "pwm2", 1}, /* PWM */
  28. {D6, GET_PIN(A,8)},
  29. {D7, GET_PIN(B,12)},
  30. {D8, GET_PIN(C,13)}, /* LED_BUILTIN */
  31. {D9, GET_PIN(C,14)},
  32. {D10, GET_PIN(C,15)},
  33. {D11, GET_PIN(A,0)},
  34. {D12, GET_PIN(B,0), "pwm3", 3}, /* PWM */
  35. {D13, GET_PIN(B,1), "pwm3", 4}, /* PWM */
  36. {D14, GET_PIN(B,9), "i2c1"}, /* I2C (Wire) */
  37. {D15, GET_PIN(B,8), "i2c1"}, /* I2C (Wire) */
  38. {D16, GET_PIN(A,12), "usb"}, /* SerialUSB */
  39. {D17, GET_PIN(A,11), "usb"}, /* SerialUSB */
  40. {D18, GET_PIN(A,10), "uart1"}, /* Serial-Rx */
  41. {D19, GET_PIN(A,9), "uart1"}, /* Serial-Tx */
  42. {D20, GET_PIN(A,2), "uart2"}, /* Serial2-Tx */
  43. {D21, GET_PIN(A,3), "uart2"}, /* Serial2-Rx */
  44. {D22, GET_PIN(B,10), "uart3"}, /* Serial3-Tx */
  45. {D23, GET_PIN(B,11), "uart3"}, /* Serial3-Rx */
  46. {D24, GET_PIN(B,15), "spi2"}, /* SPI */
  47. {D25, GET_PIN(B,14), "spi2"}, /* SPI */
  48. {D26, GET_PIN(B,13), "spi2"}, /* SPI */
  49. {A0, GET_PIN(A,1), "adc1", 1}, /* ADC */
  50. {A1, GET_PIN(A,4), "adc1", 4}, /* ADC */
  51. {A2, GET_PIN(A,5), "adc1", 5}, /* ADC */
  52. {A3, GET_PIN(A,6), "adc1", 6}, /* ADC */
  53. {A4, GET_PIN(A,7), "adc1", 7}, /* ADC */
  54. {A5, RT_NULL, "adc1", 17}, /* ADC, On-Chip: internal reference voltage, ADC_CHANNEL_VREFINT */
  55. {A6, RT_NULL, "adc1", 16} /* ADC, On-Chip: internal temperature sensor, ADC_CHANNEL_TEMPSENSOR */
  56. };