Skip to content

Commit

Permalink
feat: modify task logic
Browse files Browse the repository at this point in the history
  • Loading branch information
LynnL4 committed Jun 24, 2024
1 parent 3c111d5 commit f3346be
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 18 deletions.
8 changes: 4 additions & 4 deletions porting/himax/we2/drivers/drv_ov5647.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@
#elif (OV5647_MIPI_MODE == OV5647_MIPI_1296X972)
#define OV5647_SENSOR_WIDTH 1296
#define OV5647_SENSOR_HEIGHT 972
#define OV5647_SUB_SAMPLE INP_SUBSAMPLE_DISABLE
#define OV5647_BINNING_0 INP_BINNING_4TO2_B
#define OV5647_BINNING_1 INP_BINNING_8TO2_B
#define OV5647_BINNING_2 INP_BINNING_16TO2_B
#define OV5647_SUB_SAMPLE INP_SUBSAMPLE_4TO2
#define OV5647_BINNING_0 INP_BINNING_DISABLE
#define OV5647_BINNING_1 INP_BINNING_4TO2_B
#define OV5647_BINNING_2 INP_BINNING_8TO2_B
#else
#error "OV5647_MIPI_MODE not defined"
#endif
Expand Down
14 changes: 5 additions & 9 deletions porting/himax/we2/el_device_we2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,6 @@ void DeviceWE2::init() {
serial.type = EL_TRANSPORT_UART;
this->_transports.emplace_front(&serial);

static Serial2WE2 serial2{};
serial2.type = EL_TRANSPORT_UART;
this->_transports.emplace_front(&serial2);

this->_network = nullptr;

#ifndef CONFIG_EL_BOARD_GROVE_VISION_AI_WE2
Expand All @@ -176,6 +172,10 @@ void DeviceWE2::init() {
#endif

#ifdef CONFIG_EL_BOARD_GROVE_VISION_AI_WE2
static Serial2WE2 serial2{};
serial2.type = EL_TRANSPORT_UART;
this->_transports.emplace_front(&serial2);

static WireWE2 wire{0x62};
wire.type = EL_TRANSPORT_I2C;
this->_transports.emplace_front(&wire);
Expand All @@ -193,11 +193,7 @@ void DeviceWE2::enter_bootloader() {
hx_drv_scu_set_PB5_pinmux(SCU_PB5_PINMUX_SPI2AHB_CS, 1);
}


void DeviceWE2::feed_watchdog() {
hx_drv_watchdog_update(WATCHDOG_ID_0, WATCH_DOG_TIMEOUT_TH);
}

void DeviceWE2::feed_watchdog() { hx_drv_watchdog_update(WATCHDOG_ID_0, WATCH_DOG_TIMEOUT_TH); }

Device* Device::get_device() {
static DeviceWE2 device{};
Expand Down
2 changes: 1 addition & 1 deletion porting/himax/we2/el_serial_we2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ el_err_code_t SerialWE2::init() {
_rb_rx = new lwRingBuffer{8192};

if (!_rb_tx) [[likely]]
_rb_tx = new lwRingBuffer{32768};
_rb_tx = new lwRingBuffer{48192};

_mutex_tx = xSemaphoreCreateMutex();

Expand Down
2 changes: 1 addition & 1 deletion porting/himax/we2/el_sspi_we2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ el_err_code_t sspiWE2::init() {

this->_is_present = this->spi ? true : false;

this->tx_ring_buffer = new lwRingBuffer(SPI_WRITE_PL_LEN * 12);
this->tx_ring_buffer = new lwRingBuffer(SPI_WRITE_PL_LEN * 16);
this->rx_ring_buffer = new lwRingBuffer(SPI_READ_PL_LEN * 4);

this->sspi_read_enable(sizeof(this->rx_buffer));
Expand Down
7 changes: 4 additions & 3 deletions sscma/main_task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ using namespace sscma::hooks;

void init_static_resource();
void register_commands();
void wait_for_inputs();
void wait_for_inputs(void*);

void run() {
init_static_resource();
register_commands();
wait_for_inputs();
xTaskCreate(wait_for_inputs, "listener", 4096, nullptr, 3, nullptr);
vTaskDelete(nullptr);
}

void init_static_resource() {
Expand Down Expand Up @@ -418,7 +419,7 @@ void register_commands() {
});
}

void wait_for_inputs() {
void wait_for_inputs(void*) {
// mark the system status as ready
static_resource->executor->add_task([](const std::atomic<bool>&) { static_resource->is_ready.store(true); });

Expand Down

0 comments on commit f3346be

Please sign in to comment.