Skip to content

Commit adbf182

Browse files
authored
Merge pull request #49 from badgeteam/renze/troopers2023
Troopers 2023: initial support
2 parents 5a549a6 + c609792 commit adbf182

36 files changed

Lines changed: 4419 additions & 0 deletions
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
if(CONFIG_DRIVER_LAUNCHER_ENABLE)
2+
set(srcs
3+
"modlauncher.c"
4+
)
5+
else()
6+
set(srcs "")
7+
endif()
8+
9+
set(include
10+
"include"
11+
)
12+
13+
idf_component_register(
14+
SRCS "${srcs}"
15+
INCLUDE_DIRS "${include}"
16+
REQUIRES micropython
17+
)

components/driver_launcher/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
menu "Driver: Badge.team launcher"
2+
config DRIVER_BADGEAPI_ENABLE
3+
bool "Enable the Badge.team launcher driver"
4+
default n
5+
endmenu
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#ifndef NO_QSTR
2+
#include "py/mperrno.h"
3+
#include "py/mphal.h"
4+
#include "py/runtime.h"
5+
#include <driver/uart.h>
6+
7+
#include <esp_system.h>
8+
#include "soc/rtc.h"
9+
#include "soc/rtc_cntl_reg.h"
10+
#endif
11+
12+
#define TAG "LAUNCHER_UPY"
13+
14+
void driver_launcher_init() {
15+
16+
}
17+
18+
static mp_obj_t driver_launcher_return_to_launcher() {
19+
REG_WRITE(RTC_CNTL_STORE0_REG, 0);
20+
esp_restart();
21+
return mp_const_none;
22+
}
23+
24+
static MP_DEFINE_CONST_FUN_OBJ_0(launcher_return_to_launcher_obj, driver_launcher_return_to_launcher);
25+
26+
STATIC const mp_rom_map_elem_t launcher_module_globals_table[] = {
27+
{MP_ROM_QSTR(MP_QSTR_exit_python), MP_ROM_PTR(&launcher_return_to_launcher_obj)},
28+
};
29+
30+
STATIC MP_DEFINE_CONST_DICT(launcher_module_globals, launcher_module_globals_table);
31+
32+
//===================================
33+
const mp_obj_module_t launcher_module = {
34+
.base = {&mp_type_module},
35+
.globals = (mp_obj_dict_t *)&launcher_module_globals,
36+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#Include all files that contain MP bindings
2+
set(mods
3+
"${COMPONENT_DIR}/modlauncher.c"
4+
)
5+
6+
#Define the name of your module here
7+
set(mod_name "launcher")
8+
set(mod_register "launcher")
9+
10+
if(CONFIG_DRIVER_LAUNCHER_ENABLE)
11+
message(STATUS "Launcher API enabled")
12+
set(EXTMODS "${EXTMODS}" "${mods}" CACHE INTERNAL "")
13+
set(EXTMODS_NAMES "${EXTMODS_NAMES}" "${mod_name}" CACHE INTERNAL "")
14+
set(EXTMODS_INIT "${EXTMODS_INIT}" "\"${mod_name}\"@\"${mod_register}\"^" CACHE INTERNAL "")
15+
else()
16+
message(STATUS "Launcher API disabled")
17+
endif()

0 commit comments

Comments
 (0)