hal_displays.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. /**
  14. * @file hal_displays.h
  15. * @brief Generic display interface header.
  16. *
  17. * @addtogroup HAL_DISPLAYS
  18. * @{
  19. */
  20. #ifndef HAL_DISPLAYS_H
  21. #define HAL_DISPLAYS_H
  22. /*===========================================================================*/
  23. /* Driver constants. */
  24. /*===========================================================================*/
  25. /*===========================================================================*/
  26. /* Driver pre-compile time settings. */
  27. /*===========================================================================*/
  28. /*===========================================================================*/
  29. /* Derived constants and error checks. */
  30. /*===========================================================================*/
  31. /*===========================================================================*/
  32. /* Driver data structures and types. */
  33. /*===========================================================================*/
  34. /**
  35. * @brief @p BaseDisplay specific methods.
  36. * @note No methods so far, just a common ancestor interface.
  37. */
  38. #define _base_display_methods_alone
  39. /**
  40. * @brief @p BaseDisplay specific methods with inherited ones.
  41. */
  42. #define _base_display_methods \
  43. _base_display_methods_alone
  44. /**
  45. * @brief @p BaseDisplay virtual methods table.
  46. */
  47. struct BaseDisplayVMT {
  48. _base_display_methods
  49. };
  50. /**
  51. * @brief @p BaseDisplay specific data.
  52. * @note It is empty because @p BaseDisplay is only an interface
  53. * without implementation.
  54. */
  55. #define _base_display_data
  56. /**
  57. * @brief Base display class.
  58. */
  59. typedef struct {
  60. /** @brief Virtual Methods Table.*/
  61. const struct BaseDisplayVMT *vmt_basedisplay;
  62. _base_display_data
  63. } BaseDisplay;
  64. /*===========================================================================*/
  65. /* Driver macros. */
  66. /*===========================================================================*/
  67. /**
  68. * @name Macro Functions (BaseDisplay)
  69. * @{
  70. */
  71. /**
  72. * @brief Sensors get axes number.
  73. *
  74. * @param[in] ip pointer to a @p BaseDisplay or derived class.
  75. * @return The number of axes of the BaseDisplay
  76. *
  77. * @api
  78. */
  79. #define displayGetType(ip) (ip)->vmt_basedisplay->get_type(ip)
  80. /** @} */
  81. /*===========================================================================*/
  82. /* External declarations. */
  83. /*===========================================================================*/
  84. #ifdef __cplusplus
  85. extern "C" {
  86. #endif
  87. #ifdef __cplusplus
  88. }
  89. #endif
  90. #endif /* HAL_DISPLAYS_H */
  91. /** @} */