1
0

pins_arduino.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2006-2023, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2023-02-22 ChuShicheng first version
  9. * 2023-02-23 Wangyuqiang second version
  10. */
  11. #include <Arduino.h>
  12. #include <board.h>
  13. #include <drv_pin.h>
  14. #include "pins_arduino.h"
  15. /*
  16. * {Arduino Pin, RT-Thread Pin [, Device Name, Channel]}
  17. * [] means optional
  18. * Digital pins must NOT give the device name and channel.
  19. * Analog pins MUST give the device name and channel(ADC, PWM or DAC).
  20. * Arduino Pin must keep in sequence.
  21. */
  22. const pin_map_t pin_map_table[]=
  23. {
  24. {D0, GET_PINS(1,24), "uart2"}, /* Serial2-RX */
  25. {D1, GET_PINS(0,27), "uart2"}, /* Serial2-TX */
  26. {D2, GET_PINS(0,15)},
  27. {D3, GET_PINS(1,6)},
  28. {D4, GET_PINS(1,7), "pwm2", 2}, /* PWM */
  29. {D5, GET_PINS(1,4), "pwm2", 1}, /* PWM */
  30. {D6, GET_PINS(1,10)},
  31. {D7, GET_PINS(1,9), "pwm1", 0}, /* PWM */
  32. {D8, GET_PINS(1,8)},
  33. {D9, GET_PINS(1,5)},
  34. {D10, GET_PINS(1,1)},
  35. {D11, GET_PINS(0,26)},
  36. {D12, GET_PINS(1,3)},
  37. {D13, GET_PINS(1,2)},
  38. {D14, GET_PINS(1,21), "i2c4"}, /* I2C-SDA (Wire) */
  39. {D15, GET_PINS(1,20), "i2c4"}, /* I2C-SCL (Wire) */
  40. {A0, GET_PINS(0,16), "adc0", 8}, /* ADC */
  41. {A1, GET_PINS(0,23), "adc0", 0}, /* ADC */
  42. {A2, RT_NULL},
  43. {A3, GET_PINS(1,31)},
  44. {A4, GET_PINS(0,13), "i2c1"}, /* I2C-SDA (Wire) */
  45. {A5, GET_PINS(1,14), "i2c1"}, /* I2C-SCL (Wire) */
  46. {A6, RT_NULL, "adc0", 13}, /* ADC, On-Chip: internal reference voltage, ADC_CHANNEL_VREFINT */
  47. {A7, RT_NULL, "adc0", 26}, /* ADC, On-Chip: internal temperature sensor, ADC_CHANNEL_TEMPSENSOR */
  48. };