version 2.8
gos_arduino.c
1 /*
2  * This file is subject to the terms of the GFX License. If a copy of
3  * the license was not distributed with this file, you can obtain one at:
4  *
5  * http://ugfx.org/license.html
6  */
7 
8 #include "../../gfx.h"
9 
10 #if GFX_USE_OS_ARDUINO
11 
12 #include <string.h> // Prototype for memcpy()
13 
14 void _gosHeapInit(void);
15 void _gosThreadsInit(void);
16 
17 /*********************************************************
18  * Initialise
19  *********************************************************/
20 
21 void _gosInit(void)
22 {
23  /* No initialization of the operating system itself is needed as there isn't one.
24  * On the other hand the C runtime should still already be initialized before
25  * getting here!
26  */
27  #if !GFX_OS_INIT_NO_WARNING
28  #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
29  #warning "GOS: Arduino - Make sure you initialize your hardware and the C runtime before calling gfxInit() in your application!"
30  #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
31  COMPILER_WARNING("GOS: Arduino - Make sure you initialize your hardware and the C runtime before calling gfxInit() in your application!")
32  #endif
33  #endif
34 
35  // Start the heap allocator
36  _gosHeapInit();
37 
38  // Start the scheduler
39  _gosThreadsInit();
40 }
41 
42 void _gosPostInit(void)
43 {
44 }
45 
46 void _gosDeinit(void)
47 {
48  /* ToDo */
49 }
50 
51 /*********************************************************
52  * Exit everything functions
53  *********************************************************/
54 
55 void gfxHalt(const char *msg) {
56  volatile uint32_t dummy;
57  (void) msg;
58 
59  while(1)
60  dummy++;
61 }
62 
63 void gfxExit(void) {
64  volatile uint32_t dummy;
65 
66  while(1)
67  dummy++;
68 }
69 
70 
71 /*********************************************************
72  * Sleep functions
73  *********************************************************/
74 
75 systemticks_t gfxSystemTicks(void) {
76  return millis();
77 }
78 systemticks_t gfxMillisecondsToTicks(delaytime_t ms) {
79  return ms;
80 }
81 
82 #endif /* GFX_USE_OS_ARDUINO */
systemticks_t gfxSystemTicks(void)
Get the current operating system tick time.
systemticks_t gfxMillisecondsToTicks(delaytime_t ms)
Convert a given number of millseconds to a number of operating system ticks.
void gfxExit(void)
Exit the GFX application.
void gfxHalt(const char *msg)
Halt the GFX application due to an error.