Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v5.2.3
target: esp32
target: esp32-s3

- name: Check for Binary
run: |
Expand Down
2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

ESP_IDF_DIR = '''$HOME/esp/'''

CMAKE_GEN_CMD = '''cmake -S . -B cmake-build/{PORT} -G Ninja -DPORT={PORT} -DPLATFORM={PLATFORM}'''
CMAKE_GEN_CMD = '''cmake -S . -B cmake-build/{PORT} -G Ninja -DPORT={PORT} -DPLATFORM={PLATFORM} -DIDF_TARGET=esp32s3'''
CMAKE_BUILD_CMD = '''cmake --build cmake-build/{PORT}'''

IMAGE_DIR = '''cmake-build/{PORT}/mission-timer.bin'''
Expand Down
4 changes: 4 additions & 0 deletions drivers/include/bsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ namespace BSP
*/
void init_sensors();
/**
* @brief Init hardware timers for periodic tasks
*/
void init_hardware_timers();
/**
* @brief Turn onboard LED ON
* @note Init actuators must have been called
*/
Expand Down
27 changes: 18 additions & 9 deletions drivers/ports/ESP32/bsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
#include "driver/gpio.h"
#include "timebomb.h"

constexpr unsigned int BUTTON_INTERVAL_MS = 50;

namespace BSP{
void init() {
init_actuators();
init_sensors();
init_hardware_timers();
}

void init_actuators() {
Expand All @@ -21,11 +24,17 @@ namespace BSP{
}

void init_sensors() {
gpio_set_direction(GPIO_NUM_25, GPIO_MODE_INPUT);
gpio_set_pull_mode(GPIO_NUM_25, GPIO_PULLDOWN_ONLY);
gpio_set_direction(GPIO_NUM_42, GPIO_MODE_INPUT);
gpio_set_pull_mode(GPIO_NUM_42, GPIO_PULLDOWN_ONLY);

gpio_set_direction(GPIO_NUM_41, GPIO_MODE_INPUT);
gpio_set_pull_mode(GPIO_NUM_41, GPIO_PULLDOWN_ONLY);
}

gpio_set_direction(GPIO_NUM_26, GPIO_MODE_INPUT);
gpio_set_pull_mode(GPIO_NUM_26, GPIO_PULLDOWN_ONLY);
void init_hardware_timers() {
if (TimerHandle_t button_timer = xTimerCreate("ButtonTimer", pdMS_TO_TICKS(BUTTON_INTERVAL_MS), pdTRUE, nullptr, ESP_BSP::button_read); button_timer != nullptr) {
xTimerStart(button_timer, 0);
}
}


Expand Down Expand Up @@ -81,8 +90,8 @@ namespace BSP{
uint16_t previous;
} button = {0U, 0U}, button2 = {0U, 0U};

button_status[0] = gpio_get_level(GPIO_NUM_25);
button_status[1] = gpio_get_level(GPIO_NUM_26);
button_status[0] = gpio_get_level(GPIO_NUM_42);
button_status[1] = gpio_get_level(GPIO_NUM_41);

uint16_t tmp = button.depressed;
uint16_t tmp2 = button2.depressed;
Expand Down Expand Up @@ -122,17 +131,17 @@ namespace BSP{
}

LED* get_blue_led() {
static ESP_LED led(16);
static ESP_LED led(47);
return &led;
}

LED* get_green_led() {
static ESP_LED led(17);
static ESP_LED led(3);
return &led;
}

LED* get_red_led() {
static ESP_LED led(5);
static ESP_LED led(48);
return &led;
}

Expand Down
2 changes: 1 addition & 1 deletion mk-hsm
2 changes: 2 additions & 0 deletions services/timebomb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ StateHandler defused = std::bind(&TimeBomb::_defused, TimeBomb::get_default_inst

TimeBomb::TimeBomb(): Active((std::bind(&TimeBomb::_initial, this, std::placeholders::_1))) {
printf("Timebomb init\n");
_task_name = "TimeBomb";
_stack_size = 4096;
te = TimeEvent::get_default_instance(TIMEOUT_SIG, this);
}

Expand Down