PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.0KB

  1. /* Copyright (c) 2009 Nordic Semiconductor. All Rights Reserved.
  2. *
  3. * The information contained herein is property of Nordic Semiconductor ASA.
  4. * Terms and conditions of usage are described in detail in NORDIC
  5. * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
  6. *
  7. * Licensees are granted free, non-transferable use of the information. NO
  8. * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
  9. * the file.
  10. *
  11. * $LastChangedRevision$
  12. */
  13. /** @file
  14. */
  15. /** @defgroup hal_io hal_io
  16. * @{
  17. * @ingroup hal
  18. * @brief Macros input/output management
  19. */
  20. #include "hal_platform.h"
  21. #ifndef HAL_IO_H__
  22. #define HAL_IO_H__
  23. #define HAL_IO_P00 PIN0
  24. #define HAL_IO_P01 PIN1
  25. #define HAL_IO_P02 PIN2
  26. #define HAL_IO_P03 PIN3
  27. #define HAL_IO_P04 PIN4
  28. #define HAL_IO_P05 PIN5
  29. #define HAL_IO_P06 PIN6
  30. #define HAL_IO_P07 PIN7
  31. #define HAL_IO_P08 PIN8
  32. #define HAL_IO_P09 PIN9
  33. #define HAL_IO_OUTPUT OUTPUT
  34. #define HAL_IO_INPUT INPUT
  35. /**@brief Macro to configure an I/O.
  36. * @details
  37. * This macro configures a given I/O to input or output with pullup/buffer configuration.
  38. * @param io_name I/O to configure.
  39. * @param is_input Indicate if the I/O is to be set as an input.
  40. * @param io_mode Pull resistor and buffer configuration (must be HAL_IO_OUTPUT_NORMAL_STRENGTH, HAL_IO_OUTPUT_HIGH_STRENGTH, HAL_IO_INPUT_BUF_ON_NO_PULL,
  41. * HAL_IO_INPUT_BUF_ON_PULL_DOWN, HAL_IO_INPUT_BUF_ON_PULL_UP, or HAL_IO_INPUT_BUF_OFF).
  42. */
  43. #define HAL_IO_CONFIG(io_name, is_input, io_mode) pinMode(io_name, is_input)
  44. /**@brief Macro to set an output.
  45. * @details
  46. * This macro sets the given output to the given level (1 -> high, 0 -> low).
  47. * @param io_name Output to change.
  48. * @param io_state Level to set.
  49. */
  50. #define HAL_IO_SET_STATE(io_name, io_state) digitalWrite(io_name, io_state)
  51. /**@brief Macro that reads the current state of an input.
  52. * @details
  53. * This macro reads the current state of a logical input.
  54. * @param io_name Input to read.
  55. * @return Input state level (1 if high, 0 if low).
  56. */
  57. #define HAL_IO_READ(io_name) digitalRead(io_name)
  58. #endif //HAL_IO_H__
  59. /** @} */