Skip to content

Commit

Permalink
Merge pull request #5 from arag0re/dev
Browse files Browse the repository at this point in the history
fixed dcsd - second interrupt after reset wasnt triggered
  • Loading branch information
arag0re authored Mar 17, 2024
2 parents e2372a0 + 93ca99d commit 8833e34
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
7 changes: 6 additions & 1 deletion lib/sdq/sdq_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static inline bool sdq_device_receive_and_process_command(SDQDevice* bus) {
uint8_t command[4] = {0};
if(sdq_device_receive(bus, command, sizeof(command))) {
if(sdq_device_wait_while_gpio_is(bus, bus->timings.BREAK_meaningful_max, false)) {
furi_hal_gpio_init(bus->gpio_pin, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
furi_hal_gpio_init(bus->gpio_pin, GpioModeOutputPushPull, GpioPullUp, GpioSpeedLow);
switch(command[0]) {
case TRISTAR_POLL:
switch(bus->runCommand) {
Expand Down Expand Up @@ -160,6 +160,9 @@ static void sdq_device_exti_callback(void* context) {
sdq_device_bus_start(bus);
}
}
furi_hal_gpio_remove_int_callback(bus->gpio_pin);
furi_hal_gpio_add_int_callback(bus->gpio_pin, sdq_device_exti_callback, bus);
furi_hal_gpio_write(bus->gpio_pin, true);
furi_hal_gpio_init(bus->gpio_pin, GpioModeInterruptFall, GpioPullUp, GpioSpeedVeryHigh);
FURI_CRITICAL_EXIT();
}
Expand All @@ -174,6 +177,8 @@ void sdq_device_start(SDQDevice* bus) {

void sdq_device_stop(SDQDevice* bus) {
bus->listening = false;
bus->error = SDQDeviceErrorNone;
bus->resetInProgress = false;
furi_hal_gpio_write(bus->gpio_pin, true);
furi_hal_gpio_init(bus->gpio_pin, GpioModeAnalog, GpioPullNo, GpioSpeedVeryHigh);
furi_hal_gpio_remove_int_callback(bus->gpio_pin);
Expand Down
9 changes: 2 additions & 7 deletions lib/uart/usb_uart_bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,14 @@ static void usb_uart_vcp_deinit(UsbUartBridge* usb_uart, uint8_t vcp_ch) {

static void usb_uart_serial_init(UsbUartBridge* usb_uart, uint8_t uart_ch) {
furi_assert(!usb_uart->serial_handle);

usb_uart->serial_handle = furi_hal_serial_control_acquire(uart_ch);
furi_assert(usb_uart->serial_handle);

furi_hal_serial_init(usb_uart->serial_handle, 115200);
furi_hal_serial_dma_rx_start(
usb_uart->serial_handle, usb_uart_on_irq_rx_dma_cb, usb_uart, false);
furi_hal_serial_dma_rx_start( usb_uart->serial_handle, usb_uart_on_irq_rx_dma_cb, usb_uart, false);
}

static void usb_uart_serial_deinit(UsbUartBridge* usb_uart) {
furi_assert(usb_uart->serial_handle);

furi_hal_serial_deinit(usb_uart->serial_handle);
furi_hal_serial_control_release(usb_uart->serial_handle);
usb_uart->serial_handle = NULL;
Expand Down Expand Up @@ -229,8 +225,7 @@ static int32_t usb_uart_worker(void* context) {
if(len > 0) {
if(furi_semaphore_acquire(usb_uart->tx_sem, 100) == FuriStatusOk) {
usb_uart->st.rx_cnt += len;
furi_check(
furi_mutex_acquire(usb_uart->usb_mutex, FuriWaitForever) == FuriStatusOk);
furi_check(furi_mutex_acquire(usb_uart->usb_mutex, FuriWaitForever) == FuriStatusOk);
furi_hal_cdc_send(usb_uart->cfg.vcp_ch, usb_uart->rx_buf, len);
save_log_and_write((char*)usb_uart->rx_buf, len);
furi_check(furi_mutex_release(usb_uart->usb_mutex) == FuriStatusOk);
Expand Down
2 changes: 1 addition & 1 deletion log_saver.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define TAG "YuriStorage"
#define STORAGE_FILE_BUF_LEN 5
#define END_MARKER "======== End of iBoot serial output. ========"
#define MAX_BUFFER_SIZE 102400
#define MAX_BUFFER_SIZE 106000

static char aggregate_buffer[MAX_BUFFER_SIZE];
static size_t aggregate_buffer_len = 0;
Expand Down

0 comments on commit 8833e34

Please sign in to comment.