File tree Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 41
41
/* Includes from GLCD */
42
42
#include "glcd.h"
43
43
44
+ /* Includes for RTOS */
45
+ #ifdef GLCD_USE_RTOS
46
+ #include "BRTOS.h"
47
+ #endif
48
+
44
49
void delay_ms (uint32_t ms );
45
50
46
51
//#define BACKLIGHT_INVERT // Uncomment if LED backlight turn on with low value
@@ -272,21 +277,16 @@ void glcd_reset(void)
272
277
GLCD_SELECT ();
273
278
GLCD_RESET_LOW ();
274
279
275
- uint32_t count = 0 ;
276
- const uint32_t utime = 120000 ;
277
- do
278
- {
279
- count ++ ;
280
- }
281
- while (count < utime );
282
280
283
- // delay_ms(GLCD_RESET_TIME);
281
+ delay_ms (GLCD_RESET_TIME );
284
282
//DelayTask(GLCD_RESET_TIME);
285
283
GLCD_RESET_HIGH ();
286
284
GLCD_DESELECT ();
287
285
}
288
286
289
287
void delay_ms (uint32_t ms ){
288
+
289
+ #ifndef GLCD_USE_RTOS
290
290
uint32_t count = 0 ;
291
291
uint32_t ms_counter = 0 ;
292
292
do {
@@ -298,6 +298,9 @@ void delay_ms(uint32_t ms){
298
298
while (count < utime );
299
299
ms_counter ++ ;
300
300
}while (ms_counter < ms );
301
+ #else
302
+ GLCD_RTOS_DELAY_FCN // Call the delay function defined in the header file.
303
+ #endif
301
304
}
302
305
303
306
Original file line number Diff line number Diff line change 106
106
#define GLCD_RESET_LOW () GPIO_ResetBits(CONTROLLER_SPI_RST_PORT,CONTROLLER_SPI_RST_PIN)
107
107
#define GLCD_RESET_HIGH () GPIO_SetBits(CONTROLLER_SPI_RST_PORT,CONTROLLER_SPI_RST_PIN)
108
108
109
+ /* RTOS delay function
110
+ * Enable the following define to use a RTOS.
111
+ * Update the call to the millisecond delay with the one of
112
+ * your RTOS and add the includes in STM32F4.c */
113
+ #define GLCD_USE_RTOS
114
+
115
+ #ifdef GLCD_USE_RTOS
116
+ #define GLCD_RTOS_DELAY_FCN DelayTask(ms);
117
+ #endif
109
118
/* Function prototypes: */
110
119
void glcd_enable_backlight (FunctionalState state );
111
120
#ifdef USE_TIMER_PWM
You can’t perform that action at this time.
0 commit comments