cc3200_prefix.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * This file is part of the MicroPython project, http://micropython.org/
  3. *
  4. * The MIT License (MIT)
  5. *
  6. * Copyright (c) 2013, 2014 Damien P. George
  7. * Copyright (c) 2015 Daniel Campora
  8. *
  9. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10. * of this software and associated documentation files (the "Software"), to deal
  11. * in the Software without restriction, including without limitation the rights
  12. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13. * copies of the Software, and to permit persons to whom the Software is
  14. * furnished to do so, subject to the following conditions:
  15. *
  16. * The above copyright notice and this permission notice shall be included in
  17. * all copies or substantial portions of the Software.
  18. *
  19. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  24. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  25. * THE SOFTWARE.
  26. */
  27. // cc3200_prefix.c becomes the initial portion of the generated pins file.
  28. #include <stdio.h>
  29. #include <stdint.h>
  30. #include "py/mpconfig.h"
  31. #include "py/obj.h"
  32. #include "inc/hw_types.h"
  33. #include "inc/hw_memmap.h"
  34. #include "pin.h"
  35. #include "gpio.h"
  36. #include "pybpin.h"
  37. #define AF(af_name, af_idx, af_fn, af_unit, af_type) \
  38. { \
  39. .name = MP_QSTR_ ## af_name, \
  40. .idx = (af_idx), \
  41. .fn = PIN_FN_ ## af_fn, \
  42. .unit = (af_unit), \
  43. .type = PIN_TYPE_ ## af_fn ## _ ## af_type, \
  44. }
  45. #define PIN(p_pin_name, p_port, p_bit, p_pin_num, p_af_list, p_num_afs) \
  46. { \
  47. { &pin_type }, \
  48. .name = MP_QSTR_ ## p_pin_name, \
  49. .port = PORT_A ## p_port, \
  50. .af_list = (p_af_list), \
  51. .pull = PIN_TYPE_STD, \
  52. .bit = (p_bit), \
  53. .pin_num = (p_pin_num), \
  54. .af = PIN_MODE_0, \
  55. .strength = PIN_STRENGTH_4MA, \
  56. .mode = GPIO_DIR_MODE_IN, \
  57. .num_afs = (p_num_afs), \
  58. .value = 0, \
  59. .used = false, \
  60. .irq_trigger = 0, \
  61. .irq_flags = 0, \
  62. }