mk20dx256_prefix.c 849 B

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