UART write example (#53)
* Rename test functions * rewrite furi API, segfault * make fixes in FURI, log through FURI * add uart write example blank * implement fuprintf instead of fopencookie * add gif, blank page * UART write example description Co-authored-by: Vadim Kaushan <admin@disasm.info>
This commit is contained in:
@@ -1,67 +1,67 @@
|
||||
#include <stdio.h>
|
||||
#include "flipper.h"
|
||||
#include "debug.h"
|
||||
#include "log.h"
|
||||
|
||||
#include "flipper-core.h"
|
||||
|
||||
bool test_furi_ac_create_kill(FILE* debug_uart);
|
||||
bool test_furi_ac_switch_exit(FILE* debug_uart);
|
||||
bool test_furi_ac_create_kill(FuriRecordSubscriber* log);
|
||||
bool test_furi_ac_switch_exit(FuriRecordSubscriber* log);
|
||||
|
||||
bool test_furi_pipe_record(FILE* debug_uart);
|
||||
bool test_furi_holding_data(FILE* debug_uart);
|
||||
bool test_furi_concurrent_access(FILE* debug_uart);
|
||||
bool test_furi_nonexistent_data(FILE* debug_uart);
|
||||
bool test_furi_mute_algorithm(FILE* debug_uart);
|
||||
bool test_furi_pipe_record(FuriRecordSubscriber* log);
|
||||
bool test_furi_holding_data(FuriRecordSubscriber* log);
|
||||
bool test_furi_concurrent_access(FuriRecordSubscriber* log);
|
||||
bool test_furi_nonexistent_data(FuriRecordSubscriber* log);
|
||||
bool test_furi_mute_algorithm(FuriRecordSubscriber* log);
|
||||
|
||||
void flipper_test_app(void* p) {
|
||||
FILE* debug_uart = get_debug();
|
||||
|
||||
if(test_furi_ac_create_kill(debug_uart)) {
|
||||
fprintf(debug_uart, "[TEST] test_furi_ac_create_kill PASSED\n");
|
||||
FuriRecordSubscriber* log = get_default_log();
|
||||
|
||||
if(test_furi_ac_create_kill(log)) {
|
||||
fuprintf(log, "[TEST] test_furi_ac_create_kill PASSED\n");
|
||||
} else {
|
||||
fprintf(debug_uart, "[TEST] test_furi_ac_create_kill FAILED\n");
|
||||
fuprintf(log, "[TEST] test_furi_ac_create_kill FAILED\n");
|
||||
}
|
||||
|
||||
if(test_furi_ac_switch_exit(debug_uart)) {
|
||||
fprintf(debug_uart, "[TEST] test_furi_ac_switch_exit PASSED\n");
|
||||
if(test_furi_ac_switch_exit(log)) {
|
||||
fuprintf(log, "[TEST] test_furi_ac_switch_exit PASSED\n");
|
||||
} else {
|
||||
fprintf(debug_uart, "[TEST] test_furi_ac_switch_exit FAILED\n");
|
||||
fuprintf(log, "[TEST] test_furi_ac_switch_exit FAILED\n");
|
||||
}
|
||||
|
||||
if(test_furi_pipe_record(debug_uart)) {
|
||||
fprintf(debug_uart, "[TEST] test_furi_pipe_record PASSED\n");
|
||||
if(test_furi_pipe_record(log)) {
|
||||
fuprintf(log, "[TEST] test_furi_pipe_record PASSED\n");
|
||||
} else {
|
||||
fprintf(debug_uart, "[TEST] test_furi_pipe_record FAILED\n");
|
||||
fuprintf(log, "[TEST] test_furi_pipe_record FAILED\n");
|
||||
}
|
||||
|
||||
if(test_furi_holding_data(debug_uart)) {
|
||||
fprintf(debug_uart, "[TEST] test_furi_holding_data PASSED\n");
|
||||
if(test_furi_holding_data(log)) {
|
||||
fuprintf(log, "[TEST] test_furi_holding_data PASSED\n");
|
||||
} else {
|
||||
fprintf(debug_uart, "[TEST] test_furi_holding_data FAILED\n");
|
||||
fuprintf(log, "[TEST] test_furi_holding_data FAILED\n");
|
||||
}
|
||||
|
||||
if(test_furi_concurrent_access(debug_uart)) {
|
||||
fprintf(debug_uart, "[TEST] test_furi_concurrent_access PASSED\n");
|
||||
if(test_furi_concurrent_access(log)) {
|
||||
fuprintf(log, "[TEST] test_furi_concurrent_access PASSED\n");
|
||||
} else {
|
||||
fprintf(debug_uart, "[TEST] test_furi_concurrent_access FAILED\n");
|
||||
fuprintf(log, "[TEST] test_furi_concurrent_access FAILED\n");
|
||||
}
|
||||
|
||||
if(test_furi_nonexistent_data(debug_uart)) {
|
||||
fprintf(debug_uart, "[TEST] test_furi_nonexistent_data PASSED\n");
|
||||
if(test_furi_nonexistent_data(log)) {
|
||||
fuprintf(log, "[TEST] test_furi_nonexistent_data PASSED\n");
|
||||
} else {
|
||||
fprintf(debug_uart, "[TEST] test_furi_nonexistent_data FAILED\n");
|
||||
fuprintf(log, "[TEST] test_furi_nonexistent_data FAILED\n");
|
||||
}
|
||||
|
||||
if(test_furi_mute_algorithm(debug_uart)) {
|
||||
fprintf(debug_uart, "[TEST] test_furi_mute_algorithm PASSED\n");
|
||||
if(test_furi_mute_algorithm(log)) {
|
||||
fuprintf(log, "[TEST] test_furi_mute_algorithm PASSED\n");
|
||||
} else {
|
||||
fprintf(debug_uart, "[TEST] test_furi_mute_algorithm FAILED\n");
|
||||
fuprintf(log, "[TEST] test_furi_mute_algorithm FAILED\n");
|
||||
}
|
||||
|
||||
if(add(1, 2) == 3) {
|
||||
fprintf(debug_uart, "[TEST] Rust add PASSED\n");
|
||||
fuprintf(log, "[TEST] Rust add PASSED\n");
|
||||
} else {
|
||||
fprintf(debug_uart, "[TEST] Rust add FAILED\n");
|
||||
fuprintf(log, "[TEST] Rust add FAILED\n");
|
||||
}
|
||||
|
||||
furiac_exit(NULL);
|
||||
|
Reference in New Issue
Block a user