pins_arduino.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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-04-19 Meco Man first version
  9. * 2022-07-26 liYony Perfect PWM (docking of complementary outputs)
  10. */
  11. #include <Arduino.h>
  12. #include <board.h>
  13. #include "pins_arduino.h"
  14. /*
  15. {Arduino Pin, RT-Thread Pin [, Device Name(PWM or ADC), Channel]}
  16. [] means optional
  17. Digital pins must NOT give the device name and channel.
  18. Analog pins MUST give the device name and channel(ADC, PWM or DAC).
  19. Arduino Pin must keep in sequence.
  20. */
  21. const pin_map_t pin_map_table[]=
  22. {
  23. {D0}, /* RX */
  24. {D1}, /* TX */
  25. {D2, GET_PIN(A,10)},
  26. {D3, GET_PIN(B,3), "pwm2", 2}, /* PWM2-CH2 */
  27. {D4, GET_PIN(B,5)},
  28. {D5, GET_PIN(B,4), "pwm3", 1}, /* PWM3-CH1 */
  29. {D6, GET_PIN(B,10), "pwm2", 3}, /* PWM2-CH3 */
  30. {D7, GET_PIN(A,8)},
  31. {D8, GET_PIN(A,9)},
  32. {D9, GET_PIN(C,7), "pwm3", 2}, /* PWM3-CH2 */
  33. {D10, GET_PIN(B,6), "pwm4", 1}, /* PWM4-CH1 */
  34. {D11, GET_PIN(A,7), "pwm1", -1}, /* PWM1-CH1N */
  35. {D12, GET_PIN(A,6)},
  36. {D13, GET_PIN(A,5)},
  37. {D14}, /* I2C1-SDA */
  38. {D15}, /* I2C1-SCL */
  39. {D16, GET_PIN(C,13)}, /* user button */
  40. {A0, GET_PIN(A,0), "adc1", 0}, /* ADC */
  41. {A1, GET_PIN(A,1), "adc1", 1}, /* ADC */
  42. {A2, GET_PIN(A,4), "adc1", 4}, /* ADC */
  43. {A3, GET_PIN(B,0), "adc1", 8}, /* ADC */
  44. {A4, GET_PIN(C,1), "adc1", 11}, /* ADC */
  45. {A5, GET_PIN(C,0), "adc1", 10}, /* ADC */
  46. {A6, RT_NULL, "adc1", 17}, /* ADC, On-Chip: internal reference voltage, ADC_CHANNEL_VREFINT */
  47. {A7, RT_NULL, "adc1", 16} /* ADC, On-Chip: internal temperature sensor, ADC_CHANNEL_TEMPSENSOR */
  48. };