io.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /**
  2. ******************************************************************************
  3. * @file io.h
  4. * @author MCD Application Team
  5. * @brief This file contains all the functions prototypes for the IO driver.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef __IO_H
  21. #define __IO_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include <stdint.h>
  27. /** @addtogroup BSP
  28. * @{
  29. */
  30. /** @addtogroup Components
  31. * @{
  32. */
  33. /** @addtogroup IO
  34. * @{
  35. */
  36. /** @defgroup IO_Exported_Types
  37. * @{
  38. */
  39. /**
  40. * @brief IO Bit SET and Bit RESET enumeration
  41. */
  42. typedef enum
  43. {
  44. IO_PIN_RESET = 0,
  45. IO_PIN_SET
  46. }IO_PinState;
  47. typedef enum
  48. {
  49. IO_MODE_INPUT = 0, /* input floating */
  50. IO_MODE_OUTPUT, /* output Push Pull */
  51. IO_MODE_IT_RISING_EDGE, /* float input - irq detect on rising edge */
  52. IO_MODE_IT_FALLING_EDGE, /* float input - irq detect on falling edge */
  53. IO_MODE_IT_LOW_LEVEL, /* float input - irq detect on low level */
  54. IO_MODE_IT_HIGH_LEVEL, /* float input - irq detect on high level */
  55. /* following modes only available on MFX*/
  56. IO_MODE_ANALOG, /* analog mode */
  57. IO_MODE_OFF, /* when pin isn't used*/
  58. IO_MODE_INPUT_PU, /* input with internal pull up resistor */
  59. IO_MODE_INPUT_PD, /* input with internal pull down resistor */
  60. IO_MODE_OUTPUT_OD, /* Open Drain output without internal resistor */
  61. IO_MODE_OUTPUT_OD_PU, /* Open Drain output with internal pullup resistor */
  62. IO_MODE_OUTPUT_OD_PD, /* Open Drain output with internal pulldown resistor */
  63. IO_MODE_OUTPUT_PP, /* PushPull output without internal resistor */
  64. IO_MODE_OUTPUT_PP_PU, /* PushPull output with internal pullup resistor */
  65. IO_MODE_OUTPUT_PP_PD, /* PushPull output with internal pulldown resistor */
  66. IO_MODE_IT_RISING_EDGE_PU, /* push up resistor input - irq on rising edge */
  67. IO_MODE_IT_RISING_EDGE_PD, /* push dw resistor input - irq on rising edge */
  68. IO_MODE_IT_FALLING_EDGE_PU, /* push up resistor input - irq on falling edge */
  69. IO_MODE_IT_FALLING_EDGE_PD, /* push dw resistor input - irq on falling edge */
  70. IO_MODE_IT_LOW_LEVEL_PU, /* push up resistor input - irq detect on low level */
  71. IO_MODE_IT_LOW_LEVEL_PD, /* push dw resistor input - irq detect on low level */
  72. IO_MODE_IT_HIGH_LEVEL_PU, /* push up resistor input - irq detect on high level */
  73. IO_MODE_IT_HIGH_LEVEL_PD, /* push dw resistor input - irq detect on high level */
  74. }IO_ModeTypedef;
  75. /** @defgroup IO_Driver_structure IO Driver structure
  76. * @{
  77. */
  78. typedef struct
  79. {
  80. void (*Init)(uint16_t);
  81. uint16_t (*ReadID)(uint16_t);
  82. void (*Reset)(uint16_t);
  83. void (*Start)(uint16_t, uint32_t);
  84. uint8_t (*Config)(uint16_t, uint32_t, IO_ModeTypedef);
  85. void (*WritePin)(uint16_t, uint32_t, uint8_t);
  86. uint32_t (*ReadPin)(uint16_t, uint32_t);
  87. void (*EnableIT)(uint16_t);
  88. void (*DisableIT)(uint16_t);
  89. uint32_t (*ITStatus)(uint16_t, uint32_t);
  90. void (*ClearIT)(uint16_t, uint32_t);
  91. }IO_DrvTypeDef;
  92. /**
  93. * @}
  94. */
  95. /**
  96. * @}
  97. */
  98. /**
  99. * @}
  100. */
  101. /**
  102. * @}
  103. */
  104. /**
  105. * @}
  106. */
  107. #ifdef __cplusplus
  108. }
  109. #endif
  110. #endif /* __IO_H */
  111. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/