Handling custom events - possible?

Assume I define custom events

is there a way to add such a custom event name to an event handler?

Michael

In actual Squareline no, but you have user 1…4 states and styles here
image

your custom event require only in your code handlers.

I have a custom event source (NFC read events) and I want to cause a custom function to be called when that happens

not sure I understand what you are proposing?

Michael

Then you ask bad question. LVGL custom events is designed for send to lv objects nothing more. When you require only reaction to slow events use loop or lv_timer pooling . But this isnt squareline job.

fair enough - then: how would you do this?

I already translate the NFC events into key events through a pseudo keypad indev, and that works fine for instance if a text area with focus is active

I’d rather have a custom handler be called on the current screen though

happy to take suggestions

Michael

You lack info then hard to suggest, but simple any indev is handled in lv loop timed handler. Then create keypad is little hardcore, when your NFC isnt keypad.

For example NFC create max two events per second.
You create hw based func or task for read data and store in memory.

void NFCreader()
{
store data ...
set newdatareaded=true;
void NFCguiupdate(lv_timer_t * timer)
{
if(newdatareaded && lv_scr_act()==...) {
show what required
newdatareaded=false;
}
}

in screen or app load
lv_timer_t * timer = lv_timer_create(NFCguiupdate, 500,  NULL);