nrf51_prefix.c 728 B

1234567891011121314151617181920212223242526272829
  1. // nrf51_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. .af_fn = (af_ptr) \
  15. }
  16. #define PIN(p_pin, p_af, p_adc_num, p_adc_channel) \
  17. { \
  18. { &pin_type }, \
  19. .name = MP_QSTR_P ## p_pin, \
  20. .pin = (p_pin), \
  21. .num_af = (sizeof(p_af) / sizeof(pin_af_obj_t)), \
  22. .af = p_af, \
  23. .adc_num = p_adc_num, \
  24. .adc_channel = p_adc_channel, \
  25. }