pins_arduino.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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-10-28 Wangyuqiang first version
  9. */
  10. #include <Arduino.h>
  11. #include "pins_arduino.h"
  12. #include <rtthread.h>
  13. #include "hal_data.h"
  14. #include <rtdevice.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, BSP_IO_PORT_02_PIN_06, "uart4"}, /* Serial4-RX */
  25. {D1, BSP_IO_PORT_02_PIN_05, "uart4"}, /* Serial4-TX */
  26. {D2, BSP_IO_PORT_00_PIN_08},
  27. {D3, BSP_IO_PORT_05_PIN_06},
  28. {D4, BSP_IO_PORT_06_PIN_03},
  29. {D5, BSP_IO_PORT_06_PIN_04},
  30. {D6, BSP_IO_PORT_06_PIN_05},
  31. {D7, BSP_IO_PORT_02_PIN_08},
  32. {D8, BSP_IO_PORT_02_PIN_07},
  33. {D9, BSP_IO_PORT_00_PIN_09}, /* SPI-SS */
  34. {D10, BSP_IO_PORT_07_PIN_12, "pwm2", 2}, /* PWM */
  35. {D11, BSP_IO_PORT_05_PIN_12, "i2c2"}, /* I2C-SCL (Wire) */
  36. {D12, BSP_IO_PORT_05_PIN_11, "i2c2"}, /* I2C-SDA (Wire) */
  37. {D13, BSP_IO_PORT_02_PIN_04},
  38. {D14, BSP_IO_PORT_02_PIN_03},
  39. {D15, BSP_IO_PORT_02_PIN_02},
  40. {A0, BSP_IO_PORT_00_PIN_00, "adc0", 0}, /* ADC */
  41. {A1, BSP_IO_PORT_00_PIN_01, "adc0", 1}, /* ADC */
  42. {A2, BSP_IO_PORT_00_PIN_02, "adc0", 2}, /* ADC */
  43. {A3, BSP_IO_PORT_00_PIN_03, "adc0", 7}, /* ADC */
  44. {A4, BSP_IO_PORT_05_PIN_08, "adc0", 20}, /* ADC */
  45. {A5, BSP_IO_PORT_00_PIN_14, "adc0", 5} /* ADC */
  46. };