1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
28
29
30
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* ... */
#ifndef TOUCHGFXINIT_HPP
#define TOUCHGFXINIT_HPP
#include <touchgfx/hal/HAL.hpp>
#include <touchgfx/hal/DMA.hpp>
#include <platform/driver/touch/TouchController.hpp>
#include <texts/TypedTextDatabase.hpp>
#include <fonts/ApplicationFontProvider.hpp>
#include <gui/common/FrontendHeap.hpp>
#include <BitmapDatabase.hpp>
7 includes
static ApplicationFontProvider fontProvider;
/* ... */
namespace touchgfx
{
static Texts texts;
template <class T>
HAL& getHAL(DMA_Interface& dma, LCD& display, TouchController& tc, int16_t width, int16_t height)
{
static T hal(dma, display, tc, width, height);
return hal;
}
template <class HALType>
HAL& touchgfx_generic_init(DMA_Interface& dma, LCD& display, TouchController& tc, int16_t width, int16_t height,
uint16_t* bitmapCache, uint32_t bitmapCacheSize, uint32_t numberOfDynamicBitmaps = 0)
{
HAL& hal = getHAL<HALType>(dma, display, tc, width, height);
hal.initialize();
Bitmap::registerBitmapDatabase(BitmapDatabase::getInstance(),
BitmapDatabase::getInstanceSize(),
bitmapCache,
bitmapCacheSize,
numberOfDynamicBitmaps);
TypedText::registerTexts(&texts);
Texts::setLanguage(0);
FontManager::setFontProvider(&fontProvider);
FrontendHeap& heap = FrontendHeap::getInstance();
(void)heap;
hal.registerEventListener(*(Application::getInstance()));
return hal;
}
}
#endif