-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
working state
- Loading branch information
Showing
35 changed files
with
937 additions
and
1,183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
APPLICATION = teamagotchi | ||
BOARD = feather-nrf52840-sense | ||
|
||
# This has to be the absolute path to the RIOT base directory: | ||
RIOTBASE ?= $(CURDIR)/RIOT | ||
|
||
# Comment this out to disable code in RIOT that does safety checking | ||
# which is not needed in a production environment but helps in the | ||
# development process: | ||
DEVELHELP ?= 1 | ||
|
||
FEATURES_REQUIRED += cpp | ||
FEATURES_REQUIRED += libstdcpp | ||
|
||
# Internal Modules | ||
# Teamagotchi MODULES | ||
#USEMODULE += lwm2m_handler | ||
USEMODULE += io_handler | ||
USEMODULE += display_handler | ||
EXTERNAL_MODULE_DIRS += modules | ||
|
||
# External modules | ||
USEMODULE += cpp11-compat | ||
USEMODULE += ztimer | ||
USEMODULE += ztimer_msec | ||
USEMODULE += shell | ||
USEMODULE += xtimer | ||
|
||
# As there is an 'Kconfig' we want to explicitly disable Kconfig by setting | ||
# the variable to empty | ||
#SHOULD_RUN_KCONFIG ?= | ||
|
||
# Include "inc" directory for the header files | ||
INCLUDES += -I$(CURDIR)/inc | ||
|
||
# Set the C standard to C17 [C23 (even experimental) is not yet supported] | ||
# and enable all warnings | ||
CFLAGS += -std=c17 -Wall -Wextra | ||
|
||
# Set the C++ standard to C++20 [C++23 with all the cool stuff is not yet supported] | ||
# and enable all warnings | ||
CXXEXFLAGS += -std=c++20 -Wall -Wextra | ||
|
||
# Disable volatile warnings | ||
# C++20 introduced a deprecation for this, which was then | ||
# reverted in C++23 because it wasn't thought through | ||
CXXEXFLAGS += -Wno-volatile | ||
|
||
|
||
#include $(CURDIR)/modules/lwm2m/Makefile.include | ||
include $(RIOTBASE)/Makefile.include | ||
|
||
|
||
BOARD_BLACKLIST += native64 | ||
|
||
## DEBUG | ||
CFLAGS += -DDEBUG_ASSERT_VERBOSE | ||
|
||
##### LWM2M ##### | ||
#SERVER_URI = '"coap://[2001:db8:1::1]:5684"' | ||
LWM2M_SERVER_SHORT_ID ?= 1 | ||
CFLAGS += -DEVENT_THREAD_MEDIUM_STACKSIZE='(3*1024)' | ||
# Uncomment to enable Wakaama debug log | ||
#CFLAGS += -DCONFIG_LWM2M_WITH_LOGS=1 | ||
# Specific the server URI address (NOTE: Domain names not supported yet) | ||
LWM2M_SERVER_URI ?= '"coap://[fd00:dead:beef::1]:5683"' | ||
# Configure via CFLAGS only if not done via Kconfig | ||
ifndef CONFIG_LWM2M_SERVER_URI | ||
CFLAGS += -DCONFIG_LWM2M_SERVER_URI=$(LWM2M_SERVER_URI) | ||
CFLAGS += -DCONFIG_LWM2M_SERVER_SHORT_ID=$(LWM2M_SERVER_SHORT_ID) | ||
CFLAGS += -DCONFIG_DTLS_PEER_MAX=2 | ||
CFLAGS += -DCONFIG_MAX_BUF=1024 | ||
# Uncomment to enable Wakaama debug log | ||
CFLAGS += -DCONFIG_LWM2M_WITH_LOGS=1 | ||
endif | ||
##### /LWM2M ##### | ||
|
||
|
||
# SDL requires more stack | ||
ifneq (,$(filter native native64,$(BOARD))) | ||
CFLAGS += -DTHREAD_STACKSIZE_MAIN=64*1024 | ||
else ifneq (,$(filter esp%,$(CPU_FAM))) | ||
CFLAGS += -DTHREAD_STACKSIZE_MAIN=4*1024 | ||
else | ||
CFLAGS += -DTHREAD_STACKSIZE_MAIN=2*1024 | ||
endif | ||
|
||
|
||
# Note that this will probably only work for me <3 | ||
windows: all | ||
@echo "Creating UF2" | ||
@python RIOT/dist/tools/uf2/uf2conv.py -f 0xADA52840 bin/feather-nrf52840-sense/teamagotchi.hex --base 0x1000 -c | ||
@echo "Flashing UF2 via Windows (Make sure your device is actually at D)" | ||
@powershell.exe -command "cp ./flash.uf2 d:/flash.uf2" | ||
@echo "Connecting COM via USBIPD (Make sure you have the USBIPD installed + your device bound to the WSL)" | ||
@sleep 3 | ||
@usbipd.exe attach --wsl -i 1209:7d00 | ||
@sleep 3 | ||
@echo "Connected :D" | ||
@echo "Cleaning up uf2 flash file" | ||
@rm flash.uf2 | ||
|
||
|
||
|
Submodule RIOT
updated
41 files
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include "events.h" | ||
#include "event.h" | ||
|
||
#define ENABLE_DEBUG 1 | ||
#include "debug.h" | ||
|
||
#define RCV_QUEUE_SIZE (8) | ||
|
||
kernel_pid_t t_events_pid; | ||
static msg_t rcv_queue[RCV_QUEUE_SIZE]; | ||
|
||
void set_t_events_pid(kernel_pid_t pid){ | ||
t_events_pid = pid; | ||
} | ||
|
||
void trigger_event(EVENT_T _event){ | ||
DEBUG("event input \n"); | ||
msg_t msg; | ||
msg.type = _event; | ||
if (msg_try_send(&msg, t_events_pid) == 0) { | ||
printf("Receiver queue full.\n"); | ||
} | ||
} | ||
|
||
|
||
void events_start(void (*fsm_callback)(EVENT_T event)){ | ||
msg_t msg; | ||
msg_init_queue(rcv_queue, RCV_QUEUE_SIZE); | ||
while (1) { | ||
msg_receive(&msg); | ||
fsm_callback(msg.type); | ||
} | ||
} |
Oops, something went wrong.