Microprocessor and peripheral 2 assignments for AUTH
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.
 
 
 
 
 
 

77 lines
2.3 KiB

  1. /*!
  2. * \file driver_types.h
  3. *
  4. * Copyright (C) 2020 Choutouridis Christos <cchoutou@ece.auth.gr>
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as
  8. * published by the Free Software Foundation, either version 3
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. */
  20. #ifndef DRIVERS_DRIVER_TYPES_H_
  21. #define DRIVERS_DRIVER_TYPES_H_
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. #include <stdint.h>
  26. typedef uint8_t byte_t; /*!< 8 bits wide */
  27. typedef uint16_t word_t; /*!< 16 bits wide */
  28. typedef uint32_t dword_t; /*!< 32 bits wide */
  29. typedef int32_t iterator_t; /*!< general iterator type */
  30. /*!
  31. * This is a driver wide generic driver status type.
  32. * \note
  33. * DRV_NOINIT = 0, so after memset to zero called by XXXX_deinit() the
  34. * module/device will automatically set to NOINIT state.
  35. */
  36. typedef enum {
  37. DRV_NODEV=-1, /*!< No device/module */ //!< DRV_NODEV
  38. DRV_NOINIT=0, /*!< Module/Device exist but no initialized *///!< DRV_NOINIT
  39. DRV_READY, /*!< Module/Device initialized succesfully */ //!< DRV_READY
  40. DRV_BUSY, /*!< Module/Device busy */ //!< DRV_BUSY
  41. //DRV_COMPLETE, /*!< Module/device operation complete status */
  42. DRV_ERROR /*!< Module/Device error */ //!< DRV_ERROR
  43. }drv_status_en;
  44. typedef enum {
  45. drv_pin_disable = 0,
  46. drv_pin_input,
  47. drv_pin_output
  48. }drv_pin_dir_en;
  49. /*!
  50. * Pin function pointers
  51. * \note
  52. * These function pointers do not correspond to pin levels.
  53. * They correspond to the enable/disable functionality of that pin.
  54. */
  55. //! @{
  56. typedef uint8_t (*drv_pinin_ft) (void);
  57. typedef void (*drv_pinout_ft) (uint8_t);
  58. typedef uint8_t (*drv_pinio_ft) (uint8_t);
  59. typedef void (*drv_pindir_ft) (drv_pin_dir_en);
  60. //! @}
  61. #ifdef __cplusplus
  62. }
  63. #endif
  64. #endif /* DRIVERS_DRIVER_TYPES_H_ */