Microprocessor and peripheral 2 assignments for AUTH
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

thermostat_shield.h 3.0 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*!
  2. * \file
  3. * thermostat_shield.h
  4. * \brief
  5. * Nucleo thermostat shield port file. This file contain the implementation of driver
  6. * calls for the shield.
  7. *
  8. * Author: Christos Choutouridis AEM: 8997
  9. * email : <cchoutou@ece.auth.gr>
  10. */
  11. #ifndef DRIVERS_THERMOSTAT_SHIELD_H_
  12. #define DRIVERS_THERMOSTAT_SHIELD_H_
  13. #include "NUCLEO_F401RE.h"
  14. #include "driver_types.h"
  15. #include "deque08.h"
  16. /*
  17. * =============== Digital I/O ===============
  18. */
  19. /*
  20. * =============== LCD ===============
  21. * LCD_BD4 -- D8 -- PA9
  22. * LCD_BD5 -- D7 -- PA8
  23. * LCD_BD6 -- D6 -- PB10
  24. * LCD_BD7 -- D5 -- PB4
  25. * LCD_RS -- D15 -- PB8
  26. * LCD_EN -- D14 -- PB9
  27. * LCD_BL -- D2 -- PA10
  28. */
  29. void SHIELD_LCD_DB4 (uint8_t en);
  30. void SHIELD_LCD_DB5 (uint8_t en);
  31. void SHIELD_LCD_DB6 (uint8_t en);
  32. void SHIELD_LCD_DB7 (uint8_t en);
  33. void SHIELD_LCD_RS (uint8_t en);
  34. void SHIELD_LCD_EN (uint8_t en);
  35. void SHIELD_LCD_BL (uint8_t en);
  36. /*
  37. * =============== LED ===============
  38. * LED0 -- D4 -- PB5
  39. * LED1 -- D3 -- PB3
  40. */
  41. void SHIELD_LED0 (uint8_t on);
  42. void SHIELD_LED1 (uint8_t on);
  43. #define LED_RED SHIELD_LED0
  44. #define LED_GREEN SHIELD_LED1
  45. /*
  46. * =============== BRIDGE ===============
  47. * BR1 -- D10 -- PB6
  48. * BR2 -- D9 -- PC7
  49. */
  50. void SHIELD_BR1 (uint8_t on);
  51. void SHIELD_BR2 (uint8_t on);
  52. /*
  53. * =============== SR04 ===============
  54. * TRIG -- D11 -- PA7
  55. * ECHO -- D12 -- PA6
  56. */
  57. void SHIELD_TRIG (uint8_t on);
  58. uint8_t SHIELD_ECHO (void);
  59. /*
  60. * ============= 1 Wire USART6 (AF08)===============
  61. * 1W_Tx -- PA11 (OD+PU)
  62. * 1W_Rx -- PA12 (I)
  63. */
  64. // non-shared resources
  65. #define _1WIRE_UART_INSTANCE (USART6)
  66. #define _1WIRE_UART_INIT_BR (9600)
  67. #define _1WIRE_UART_TIMEOUT (10) /*!< 10msec is good enough */
  68. /*!
  69. * Helper Macros linked to USART used
  70. */
  71. #define _1WIRE_UART_CLK_ENABLE __HAL_RCC_USART6_CLK_ENABLE
  72. #define _1WIRE_UART_CLK_DISABLE __HAL_RCC_USART6_CLK_DISABLE
  73. LLD_Status_en SHIELD_1W_Init (void);
  74. drv_status_en SHIELD_1W_UART_BR (uint32_t br);
  75. uint16_t SHIELD_1W_RW (uint8_t byte);
  76. uint8_t SHIELD_1W_Rx (void);
  77. uint8_t SHIELD_1W_Tx (uint8_t byte);
  78. LLD_Status_en SHIELD_Init (void);
  79. /*
  80. * ============= Serial console UART2 (AF07)===============
  81. * COM_Tx -- PA2 (PP)
  82. * COM_Rx -- PA3 (I)
  83. */
  84. #define COM_UART_INSTANCE USART2
  85. #define COM_UART_IRQ USART2_IRQn
  86. #define COM_UART_BAUDRATE (57600)
  87. #define COM_UART_GETCHAR_TIMEOUT (5) // 5sec
  88. #define COM_UART_PUTCHAR_TIMEOUT (10) // 1 [CPU time]
  89. #define COM_BUFFER_SIZE (256)
  90. /*!
  91. * Helper Macros linked to USART used
  92. */
  93. #define _COM_CLK_ENABLE __HAL_RCC_USART2_CLK_ENABLE
  94. #define _COM_CLK_DISNABLE __HAL_RCC_USART2_CLK_DISABLE
  95. LLD_Status_en COM_Init (void);
  96. LLD_Status_en COM_baudrate (uint32_t br);
  97. int COM_putchar (char c);
  98. int COM_getchar (void);
  99. int COM_Transmit (uint8_t *data, int size);
  100. int COM_CheckReceive (void);
  101. void COM_ReceiveFlush (void);
  102. int COM_Receive (uint8_t *data, int size);
  103. #endif /* DRIVERS_THERMOSTAT_SHIELD_H_ */