-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathmain.c
More file actions
152 lines (120 loc) · 4.8 KB
/
main.c
File metadata and controls
152 lines (120 loc) · 4.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/****************************************************************************
* Copyright 2021 Gorgon Meducer (Email:[email protected]) *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* *
****************************************************************************/
/*============================ INCLUDES ======================================*/
#include "pico/stdlib.h"
#include "perf_counter.h"
#include "bsp/bsp.h"
#include <stdio.h>
#include "RTE_Components.h"
#if defined(RTE_Compiler_EventRecorder) || defined(RTE_CMSIS_View_EventRecorder)
# include <EventRecorder.h>
#endif
#if defined(RTE_Script_PikaScript)
# include "pikaScript.h"
#endif
#if defined(__RTE_ACCELERATION_ARM_2D__) || defined(RTE_Acceleration_Arm_2D)
# include "arm_2d.h"
# include "arm_2d_helper.h"
# include "arm_2d_disp_adapters.h"
# include "arm_2d_scenes.h"
# include "arm_2d_demos.h"
#endif
#if defined(RTE_Acceleration_Arm_2D_Extra_Benchmark)
# include "arm_2d_benchmark.h"
#endif
# include "arm_2d_scene_bubble_charging.h"
/*============================ MACROS ========================================*/
/*============================ MACROFIED FUNCTIONS ===========================*/
/*============================ TYPES =========================================*/
/*============================ GLOBAL VARIABLES ==============================*/
/*============================ LOCAL VARIABLES ===============================*/
/*============================ PROTOTYPES ====================================*/
/*============================ IMPLEMENTATION ================================*/
void SysTick_Handler(void)
{
}
#if defined(__RTE_ACCELERATION_ARM_2D__) || defined(RTE_Acceleration_Arm_2D)
static bool __lcd_sync_handler(void *pTarget)
{
return Disp0_Flush();
}
#endif
static void system_init(void)
{
extern void SystemCoreClockUpdate();
SystemCoreClockUpdate();
/*! \note if you do want to use SysTick in your application, please use
*! init_cycle_counter(true);
*! instead of
*! init_cycle_counter(false);
*/
init_cycle_counter(false);
#if defined(RTE_Compiler_EventRecorder) || defined(RTE_CMSIS_View_EventRecorder)
EventRecorderInitialize(0, 1);
#endif
stdio_init_all();
bsp_init();
#if defined(RTE_Script_PikaScript)
pikaScriptInit();
#endif
#if defined(__RTE_ACCELERATION_ARM_2D__) || defined(RTE_Acceleration_Arm_2D)
arm_2d_init();
disp_adapter0_init();
/* register a low level sync-up handler to wait LCD finish rendering the previous frame */
do {
arm_2d_helper_pfb_dependency_t tDependency = {
.evtOnLowLevelSyncUp = {
.fnHandler = &__lcd_sync_handler,
},
};
arm_2d_helper_pfb_update_dependency(&DISP0_ADAPTER.use_as__arm_2d_helper_pfb_t,
ARM_2D_PFB_DEPEND_ON_LOW_LEVEL_SYNC_UP,
&tDependency);
} while(0);
#endif
}
int main(void)
{
system_init();
__cycleof__("printf") {
printf("Hello Pico-Template\r\n");
}
#if defined( __PERF_COUNTER_COREMARK__ ) && __PERF_COUNTER_COREMARK__
printf("\r\nRun Coremark 1.0...\r\n");
coremark_main();
#endif
#if defined(__RTE_ACCELERATION_ARM_2D__) || defined(RTE_Acceleration_Arm_2D)
# if defined(RTE_Acceleration_Arm_2D_Extra_Benchmark)
arm_2d_run_benchmark();
#else
//arm_2d_scene_bubble_charging_init(&DISP0_ADAPTER);
//arm_2d_scene_player_switch_to_next_scene(&DISP0_ADAPTER);
# endif
#endif
while (true) {
breath_led();
#if defined(__RTE_ACCELERATION_ARM_2D__) || defined(RTE_Acceleration_Arm_2D)
#if ARM_2D_VERSION >= 10105 && !defined(RTE_Acceleration_Arm_2D_Extra_Benchmark)
/* lock framerate: 30 FPS */
disp_adapter0_task(30);
#else
disp_adapter0_task();
#endif
#endif
}
//return 0;
}