stm32f4xx_prefix.c 851 B

1234567891011121314151617181920212223242526272829303132
  1. // stm32f4xx_prefix.c becomes the initial portion of the generated pins file.
  2. #include <stdio.h>
  3. #include "py/obj.h"
  4. #include "py/mphal.h"
  5. #include "pin.h"
  6. #define AF(af_idx, af_fn, af_unit, af_type, af_ptr) \
  7. { \
  8. { &pin_af_type }, \
  9. .name = MP_QSTR_AF ## af_idx ## _ ## af_fn ## af_unit, \
  10. .idx = (af_idx), \
  11. .fn = AF_FN_ ## af_fn, \
  12. .unit = (af_unit), \
  13. .type = AF_PIN_TYPE_ ## af_fn ## _ ## af_type, \
  14. .reg = (af_ptr) \
  15. }
  16. #define PIN(p_port, p_pin, p_af, p_adc_num, p_adc_channel) \
  17. { \
  18. { &pin_type }, \
  19. .name = MP_QSTR_ ## p_port ## p_pin, \
  20. .port = PORT_ ## p_port, \
  21. .pin = (p_pin), \
  22. .num_af = (sizeof(p_af) / sizeof(pin_af_obj_t)), \
  23. .pin_mask = (1 << ((p_pin) & 0x0f)), \
  24. .gpio = GPIO ## p_port, \
  25. .af = p_af, \
  26. .adc_num = p_adc_num, \
  27. .adc_channel = p_adc_channel, \
  28. }