* hal-related task_is_isr_context function * furi_check implementation * change application to use furi_check * add second level of assertion * add TODO about ISR context * Applications: refactor furi_check and furi_assert. * Apploader: propwer widget usage. Menu: check on furi resource request. * refactor furi_check Co-authored-by: Aleksandr Kutuzov <aku@plooks.com> Co-authored-by: coreglitch <mail@s3f.ru>
		
			
				
	
	
		
			30 lines
		
	
	
		
			742 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			742 B
		
	
	
	
		
			C
		
	
	
	
	
	
#include "flipper_v2.h"
 | 
						|
#include <stdio.h>
 | 
						|
 | 
						|
static void state_cb(const void* value, void* ctx) {
 | 
						|
    const InputState* state = value;
 | 
						|
 | 
						|
    printf("state: %02x\n", *state);
 | 
						|
}
 | 
						|
 | 
						|
static void event_cb(const void* value, void* ctx) {
 | 
						|
    const InputEvent* event = value;
 | 
						|
 | 
						|
    printf("event: %02x %s\n", event->input, event->state ? "pressed" : "released");
 | 
						|
}
 | 
						|
 | 
						|
void application_input_dump(void* p) {
 | 
						|
    // open record
 | 
						|
    ValueManager* state_record = furi_open("input_state");
 | 
						|
    furi_check(state_record);
 | 
						|
    subscribe_pubsub(&state_record->pubsub, state_cb, NULL);
 | 
						|
 | 
						|
    PubSub* event_record = furi_open("input_events");
 | 
						|
    furi_check(event_record);
 | 
						|
    subscribe_pubsub(event_record, event_cb, NULL);
 | 
						|
 | 
						|
    for(;;) {
 | 
						|
        delay(100);
 | 
						|
    }
 | 
						|
}
 |