[FL-976] Removing lambdas (#1849)
* Removing lambdas... * Wake the fk up, Gordon! We have a citadel to burn! * Here comes the Nihilanth * Lambda documentation Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -48,23 +48,27 @@ static bool gpio_test_input_callback(InputEvent* event, void* context) {
|
||||
|
||||
static bool gpio_test_process_left(GpioTest* gpio_test) {
|
||||
with_view_model(
|
||||
gpio_test->view, (GpioTestModel * model) {
|
||||
gpio_test->view,
|
||||
GpioTestModel * model,
|
||||
{
|
||||
if(model->pin_idx) {
|
||||
model->pin_idx--;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
},
|
||||
true);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool gpio_test_process_right(GpioTest* gpio_test) {
|
||||
with_view_model(
|
||||
gpio_test->view, (GpioTestModel * model) {
|
||||
gpio_test->view,
|
||||
GpioTestModel * model,
|
||||
{
|
||||
if(model->pin_idx < GPIO_ITEM_COUNT) {
|
||||
model->pin_idx++;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
},
|
||||
true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -72,7 +76,9 @@ static bool gpio_test_process_ok(GpioTest* gpio_test, InputEvent* event) {
|
||||
bool consumed = false;
|
||||
|
||||
with_view_model(
|
||||
gpio_test->view, (GpioTestModel * model) {
|
||||
gpio_test->view,
|
||||
GpioTestModel * model,
|
||||
{
|
||||
if(event->type == InputTypePress) {
|
||||
if(model->pin_idx < GPIO_ITEM_COUNT) {
|
||||
gpio_item_set_pin(model->pin_idx, true);
|
||||
@@ -89,8 +95,8 @@ static bool gpio_test_process_ok(GpioTest* gpio_test, InputEvent* event) {
|
||||
consumed = true;
|
||||
}
|
||||
gpio_test->callback(event->type, gpio_test->context);
|
||||
return true;
|
||||
});
|
||||
},
|
||||
true);
|
||||
|
||||
return consumed;
|
||||
}
|
||||
@@ -122,10 +128,12 @@ void gpio_test_set_ok_callback(GpioTest* gpio_test, GpioTestOkCallback callback,
|
||||
furi_assert(gpio_test);
|
||||
furi_assert(callback);
|
||||
with_view_model(
|
||||
gpio_test->view, (GpioTestModel * model) {
|
||||
gpio_test->view,
|
||||
GpioTestModel * model,
|
||||
{
|
||||
UNUSED(model);
|
||||
gpio_test->callback = callback;
|
||||
gpio_test->context = context;
|
||||
return false;
|
||||
});
|
||||
},
|
||||
false);
|
||||
}
|
||||
|
@@ -129,12 +129,14 @@ void gpio_usb_uart_set_callback(GpioUsbUart* usb_uart, GpioUsbUartCallback callb
|
||||
furi_assert(callback);
|
||||
|
||||
with_view_model(
|
||||
usb_uart->view, (GpioUsbUartModel * model) {
|
||||
usb_uart->view,
|
||||
GpioUsbUartModel * model,
|
||||
{
|
||||
UNUSED(model);
|
||||
usb_uart->callback = callback;
|
||||
usb_uart->context = context;
|
||||
return false;
|
||||
});
|
||||
},
|
||||
false);
|
||||
}
|
||||
|
||||
void gpio_usb_uart_update_state(GpioUsbUart* instance, UsbUartConfig* cfg, UsbUartState* st) {
|
||||
@@ -143,7 +145,9 @@ void gpio_usb_uart_update_state(GpioUsbUart* instance, UsbUartConfig* cfg, UsbUa
|
||||
furi_assert(st);
|
||||
|
||||
with_view_model(
|
||||
instance->view, (GpioUsbUartModel * model) {
|
||||
instance->view,
|
||||
GpioUsbUartModel * model,
|
||||
{
|
||||
model->baudrate = st->baudrate_cur;
|
||||
model->vcp_port = cfg->vcp_ch;
|
||||
model->tx_pin = (cfg->uart_ch == 0) ? (13) : (15);
|
||||
@@ -152,6 +156,6 @@ void gpio_usb_uart_update_state(GpioUsbUart* instance, UsbUartConfig* cfg, UsbUa
|
||||
model->rx_active = (model->rx_cnt != st->rx_cnt);
|
||||
model->tx_cnt = st->tx_cnt;
|
||||
model->rx_cnt = st->rx_cnt;
|
||||
return true;
|
||||
});
|
||||
},
|
||||
true);
|
||||
}
|
||||
|
Reference in New Issue
Block a user