[FL-85][FL-446][FL-720] Dallas key blanks and OneWire lib rework (#313)
* sepate one wire class * TM2004 writer * app mode write ds1990 * test another blanks protocol * new ibutton slave * one wire states * tim1 capture compare and update interrupts * interrupt mgr, new timers IRQ * discard HAL_TIM_PeriodElapsedCallback from main * add exti_14 line * add external interrupt callback * use int mgr in input * better interrupt managment * add interrupt callback enable and disable fns * properly init app * changed timings * rename one wire classes * use new owb classes * properly remove interrupts * new blanks writer * remove unused tests * new core includes * extern c guard * fix api_interrupt_remove usage * remove debug info, new way to detect blanks writing * remove copy constructor * change keys template * fix app sources recipe
This commit is contained in:
@@ -1,97 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <furi.h>
|
||||
#include "minunit.h"
|
||||
#include "furi-new.h"
|
||||
|
||||
const int int_value_init = 0x1234;
|
||||
const int int_value_changed = 0x5678;
|
||||
osMessageQueueId_t test_messages;
|
||||
|
||||
typedef struct {
|
||||
char text[256];
|
||||
bool result;
|
||||
} test_message;
|
||||
|
||||
#define SEND_MESSAGE(value, data) \
|
||||
{ \
|
||||
message.result = value; \
|
||||
snprintf(message.text, 256, "Error at line %d, %s", __LINE__, data); \
|
||||
osMessageQueuePut(test_messages, &message, 0U, 0U); \
|
||||
}
|
||||
|
||||
void _furi_new_wait() {
|
||||
osThreadFlagsWait(0x0001U, osFlagsWaitAny, osWaitForever);
|
||||
}
|
||||
|
||||
void _furi_new_continue(FuriAppId thread_id) {
|
||||
osThreadFlagsSet(thread_id, 0x0001U);
|
||||
}
|
||||
|
||||
void _furi_new_main_app(void* p) {
|
||||
test_message message;
|
||||
|
||||
_furi_new_wait();
|
||||
|
||||
int another_test_value = int_value_init;
|
||||
furi_record_create("test/another_app_record", &another_test_value);
|
||||
|
||||
SEND_MESSAGE(false, "dummy text");
|
||||
|
||||
new_flapp_app_exit();
|
||||
}
|
||||
|
||||
void test_furi_new() {
|
||||
test_message message;
|
||||
test_messages = osMessageQueueNew(1, sizeof(test_message), NULL);
|
||||
|
||||
// init core
|
||||
new_furi_init();
|
||||
|
||||
// launch test thread
|
||||
FuriAppId main_app = new_flapp_app_start(_furi_new_main_app, "main_app", 512, NULL);
|
||||
_furi_new_continue(main_app);
|
||||
|
||||
while(1) {
|
||||
if(osMessageQueueGet(test_messages, &message, NULL, osWaitForever) == osOK) {
|
||||
if(message.result == true) {
|
||||
break;
|
||||
} else {
|
||||
mu_assert(false, message.text);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
// test that "create" wont affect pointer value
|
||||
furi_record_create("test/record", &test_value);
|
||||
mu_assert_int_eq(test_value, int_value_init);
|
||||
|
||||
// test that we get correct pointer
|
||||
int* test_value_pointer = furi_record_open("test/record");
|
||||
mu_assert_pointers_not_eq(test_value_pointer, NULL);
|
||||
mu_assert_pointers_eq(test_value_pointer, &test_value);
|
||||
|
||||
*test_value_pointer = int_value_changed;
|
||||
mu_assert_int_eq(test_value, int_value_changed);
|
||||
|
||||
// start another app
|
||||
new_record_available = osSemaphoreNew(1, 1, NULL);
|
||||
osSemaphoreAcquire(new_record_available, osWaitForever);
|
||||
|
||||
osThreadAttr_t another_app_attr = {.name = "another_app", .stack_size = 512};
|
||||
osThreadId_t player = osThreadNew(another_app, NULL, &another_app_attr);
|
||||
|
||||
// wait until app create record
|
||||
osSemaphoreAcquire(new_record_available, osWaitForever);
|
||||
|
||||
// open record, test that record pointed to int_value_init
|
||||
test_value_pointer = furi_record_open("test/another_app_record");
|
||||
mu_assert_pointers_not_eq(test_value_pointer, NULL);
|
||||
mu_assert_int_eq(*test_value_pointer, int_value_init);
|
||||
|
||||
// test that we can close, (unsubscribe) from record
|
||||
bool close_result = new_furi_close("test/another_app_record");
|
||||
mu_assert(close_result, "cannot close record");
|
||||
*/
|
||||
}
|
@@ -16,7 +16,6 @@ void test_furi_value_manager();
|
||||
void test_furi_event();
|
||||
|
||||
void test_furi_memmgr();
|
||||
void test_furi_new();
|
||||
|
||||
static int foo = 0;
|
||||
|
||||
@@ -63,10 +62,6 @@ MU_TEST(mu_test_furi_memmgr) {
|
||||
test_furi_memmgr();
|
||||
}
|
||||
|
||||
MU_TEST(mu_test_furi_new) {
|
||||
test_furi_new();
|
||||
}
|
||||
|
||||
MU_TEST(mu_test_furi_value_expanders) {
|
||||
test_furi_value_composer();
|
||||
test_furi_value_manager();
|
||||
@@ -92,7 +87,6 @@ MU_TEST_SUITE(test_suite) {
|
||||
MU_RUN_TEST(mu_test_furi_event);
|
||||
|
||||
MU_RUN_TEST(mu_test_furi_memmgr);
|
||||
MU_RUN_TEST(mu_test_furi_new);
|
||||
}
|
||||
|
||||
int run_minunit() {
|
||||
|
Reference in New Issue
Block a user