[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:
Sergey Gavrilov
2022-10-09 03:38:29 +10:00
committed by GitHub
parent 981f7ff8b0
commit 31c0346adc
43 changed files with 1193 additions and 1007 deletions

View File

@@ -44,12 +44,14 @@ static void pwm_set_config(SignalGenPwm* pwm) {
uint8_t duty;
with_view_model(
pwm->view, (SignalGenPwmViewModel * model) {
pwm->view,
SignalGenPwmViewModel * model,
{
channel = model->channel_id;
freq = model->freq;
duty = model->duty;
return false;
});
},
false);
furi_assert(pwm->callback);
pwm->callback(channel, freq, duty, pwm->context);
@@ -188,7 +190,9 @@ static bool signal_gen_pwm_input_callback(InputEvent* event, void* context) {
bool need_update = false;
with_view_model(
pwm->view, (SignalGenPwmViewModel * model) {
pwm->view,
SignalGenPwmViewModel * model,
{
if(model->edit_mode == false) {
if((event->type == InputTypeShort) || (event->type == InputTypeRepeat)) {
if(event->key == InputKeyUp) {
@@ -238,8 +242,8 @@ static bool signal_gen_pwm_input_callback(InputEvent* event, void* context) {
}
}
}
return true;
});
},
true);
if(need_update) {
pwm_set_config(pwm);
@@ -279,22 +283,26 @@ void signal_gen_pwm_set_callback(
furi_assert(callback);
with_view_model(
pwm->view, (SignalGenPwmViewModel * model) {
pwm->view,
SignalGenPwmViewModel * model,
{
UNUSED(model);
pwm->callback = callback;
pwm->context = context;
return false;
});
},
false);
}
void signal_gen_pwm_set_params(SignalGenPwm* pwm, uint8_t channel_id, uint32_t freq, uint8_t duty) {
with_view_model(
pwm->view, (SignalGenPwmViewModel * model) {
pwm->view,
SignalGenPwmViewModel * model,
{
model->channel_id = channel_id;
model->freq = freq;
model->duty = duty;
return true;
});
},
true);
furi_assert(pwm->callback);
pwm->callback(channel_id, freq, duty, pwm->context);