Implement a secure ICS protocol targeting LoRa Node151 microcontroller for controlling irrigation.
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.
 
 
 
 
 
 

303 lines
6.8 KiB

  1. /*!
  2. * \file display-board.h
  3. *
  4. * \brief Target board OLED low level driver implementation
  5. *
  6. * \remarks Some snippets of these drivers are based on the Adafruit_GFX library.
  7. * https://github.com/adafruit/Adafruit-GFX-Library
  8. * Please take a look at their LICENSE.TXT file.
  9. * Copyright (c) 2012 Adafruit Industries. All rights reserved.
  10. *
  11. * \copyright Revised BSD License, see section \ref LICENSE.
  12. *
  13. * \code
  14. * ______ _
  15. * / _____) _ | |
  16. * ( (____ _____ ____ _| |_ _____ ____| |__
  17. * \____ \| ___ | (_ _) ___ |/ ___) _ \
  18. * _____) ) ____| | | || |_| ____( (___| | | |
  19. * (______/|_____)_|_|_| \__)_____)\____)_| |_|
  20. * (C)2013-2017 Semtech
  21. *
  22. * \endcode
  23. *
  24. * \author Miguel Luis ( Semtech )
  25. *
  26. * \author Gregory Cristian ( Semtech )
  27. */
  28. #ifndef __DISPLAY_BOARD_H__
  29. #define __DISPLAY_BOARD_H__
  30. #ifdef __cplusplus
  31. extern "C"
  32. {
  33. #endif
  34. #include <stdint.h>
  35. #include <stdbool.h>
  36. /*!
  37. * \brief Display colors enumeration
  38. */
  39. typedef enum
  40. {
  41. DISPLAY_BLACK,
  42. DISPLAY_WHITE,
  43. DISPLAY_INVERSE,
  44. }DisplayColor_t;
  45. /*!
  46. * \brief Initializes the display
  47. */
  48. void DisplayInit( void );
  49. /*!
  50. * \brief Resets the display
  51. */
  52. void DisplayReset( void );
  53. /*!
  54. * \brief Sends a command to the display
  55. *
  56. * \param cmd Command to be sent
  57. */
  58. void DisplaySendCommand( uint8_t cmd );
  59. /*!
  60. * \brief Sends a data buffer to the display
  61. *
  62. * \param buffer Buffer to be sent
  63. * \param size Buffer size to be sent
  64. */
  65. void DisplaySendData( uint8_t *buffer, uint16_t size );
  66. /*!
  67. * \brief Enables the display
  68. */
  69. void DisplayOn( void );
  70. /*!
  71. * \brief Disables the display
  72. */
  73. void DisplayOff( void );
  74. /*!
  75. * \brief Clears the display
  76. */
  77. void DisplayClear( void );
  78. /*!
  79. * \brief Inverts colors of the display
  80. *
  81. * \param invert [true: invert, false: normal]
  82. */
  83. void DisplayInvertColors( bool invert );
  84. /*!
  85. * \brief Updates the display with MCU RAM copy
  86. */
  87. void DisplayUpdate( void );
  88. /*!
  89. * \brief Sets the cursor at coordinates (x,y)
  90. *
  91. * \param x X coordinate
  92. * \param y Y coordinate
  93. */
  94. void DisplaySetCursor( int16_t x, int16_t y );
  95. /*!
  96. * \brief Gets current X coordinate of the cursor
  97. *
  98. * \retval x X coordinate
  99. */
  100. int16_t DisplayGetCursorX( void );
  101. /*!
  102. * \brief Gets current Y coordinate of the cursor
  103. *
  104. * \retval y Y coordinate
  105. */
  106. int16_t DisplayGetCursorY( void );
  107. /*!
  108. * \brief Sets text size
  109. *
  110. * \param s New text size
  111. */
  112. void DisplaySetTextSize( uint8_t s );
  113. /*!
  114. * \brief Sets text color
  115. *
  116. * \param color New text color
  117. */
  118. void DisplaySetTextColor( DisplayColor_t color );
  119. /*!
  120. * \brief Sets foreground and background color
  121. *
  122. * \param fg Foreground color
  123. * \param bg Background color
  124. */
  125. void DisplaySetFgAndBg( DisplayColor_t fg, DisplayColor_t bg );
  126. /*!
  127. * \brief Enables/Disable text wrapping
  128. *
  129. * \param w [true: wrap ON, false: wrap OFF]
  130. */
  131. void DisplaySetTextWrap( bool w );
  132. /*!
  133. * \brief Gets current display rotation
  134. *
  135. * \retval rotation Display rotation (Vertical/Horizontal)
  136. */
  137. uint8_t DisplayGetRotation( void );
  138. /*!
  139. * \brief Sets current display rotation
  140. *
  141. * \param x Display rotation (Vertical/Horizontal)
  142. */
  143. void DisplaySetRotation( uint8_t x );
  144. /*!
  145. * \brief Draws a pixel of color at coordinates (x,y)
  146. *
  147. * \param x X coordinate
  148. * \param y Y coordinate
  149. * \param color Pixel color
  150. */
  151. void DisplayDrawPixel( int16_t x, int16_t y, DisplayColor_t color );
  152. /*!
  153. * \brief Draws a line starting at coordinates (x0,y0) ending at
  154. * coordinates (x1,y1) of color
  155. *
  156. * \param x0 X0 coordinate
  157. * \param y0 Y0 coordinate
  158. * \param x1 X1 coordinate
  159. * \param y1 Y1 coordinate
  160. * \param color Line color
  161. */
  162. void DisplayDrawLine( int16_t x0, int16_t y0, int16_t x1, int16_t y1, DisplayColor_t color );
  163. /*!
  164. * \brief Draws a vertical line starting at coordinates (x,y) with given height
  165. *
  166. * \param x X coordinate
  167. * \param y Y coordinate
  168. * \param h Line height
  169. * \param color Line color
  170. */
  171. void DisplayDrawVerticalLine( int16_t x, int16_t y, int16_t h, DisplayColor_t color );
  172. /*!
  173. * \brief Draws an Horizontal line starting at coordinates (x,y) with given width
  174. *
  175. * \param x X coordinate
  176. * \param y Y coordinate
  177. * \param w Line width
  178. * \param color Line color
  179. */
  180. void DisplayDrawHorizontalLine( int16_t x, int16_t y, int16_t w, DisplayColor_t color );
  181. /*!
  182. * \brief Draws a rectangle at coordinates (x,y) with given width and height
  183. *
  184. * \param x X coordinate
  185. * \param y Y coordinate
  186. * \param w Line width
  187. * \param h Line height
  188. * \param color Line color
  189. */
  190. void DisplayDrawRect( int16_t x, int16_t y, int16_t w, int16_t h, DisplayColor_t color );
  191. /*!
  192. * \brief Draws a filled rectangle at coordinates (x,y) with given width and height
  193. *
  194. * \param x X coordinate
  195. * \param y Y coordinate
  196. * \param w Line width
  197. * \param h Line height
  198. * \param color Fill color
  199. */
  200. void DisplayFillRect( int16_t x, int16_t y, int16_t w, int16_t h, DisplayColor_t color );
  201. /*!
  202. * \brief Fills all display with pixels of color
  203. *
  204. * \param color Fill color
  205. */
  206. void DisplayFillScreen( DisplayColor_t color );
  207. /*!
  208. * \brief Draws a triangle by giving the 3 vertices coordinates
  209. *
  210. * \param x0 X0 coordinate
  211. * \param y0 Y0 coordinate
  212. * \param x1 X1 coordinate
  213. * \param y1 Y1 coordinate
  214. * \param x2 X2 coordinate
  215. * \param y2 Y2 coordinate
  216. * \param color Line color
  217. */
  218. void DisplayDrawTriangle( int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, DisplayColor_t color );
  219. /*!
  220. * \brief Draws a filled triangle by giving the 3 vertices coordinates
  221. *
  222. * \param x0 X0 coordinate
  223. * \param y0 Y0 coordinate
  224. * \param x1 X1 coordinate
  225. * \param y1 Y1 coordinate
  226. * \param x2 X2 coordinate
  227. * \param y2 Y2 coordinate
  228. * \param color Fill color
  229. */
  230. void DisplayFillTriangle( int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, DisplayColor_t color ) ;
  231. /*!
  232. * \brief Draws a character at given coordinates
  233. *
  234. * \param x X coordinate
  235. * \param y Y coordinate
  236. * \param c Character
  237. * \param color Character color
  238. * \param bg Background color
  239. * \param size Character size
  240. */
  241. void DisplayDrawChar( int16_t x, int16_t y, unsigned char c, DisplayColor_t color, DisplayColor_t bg, uint8_t size );
  242. /*!
  243. * \brief Display putc function. (Mimics standard C putc function)
  244. *
  245. * \param c Character
  246. */
  247. void DisplayPutc( uint8_t c );
  248. /*!
  249. * \brief Sets cursor at line
  250. *
  251. * \param line Line number
  252. */
  253. void DisplaySetLine( uint8_t line );
  254. /*!
  255. * \brief Display print function. Prints the given string
  256. */
  257. void DisplayPrint( const char *string );
  258. /*!
  259. * \brief Display printf function. (Mimics standard C printf function)
  260. */
  261. void DisplayPrintf( const char *format, ... );
  262. #ifdef __cplusplus
  263. }
  264. #endif
  265. #endif // __DISPLAY_BOARD_H__