mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-09 21:45:54 +00:00
test/embedded: draft test
This commit is contained in:
parent
defbf20033
commit
516e2db7a9
@ -29,6 +29,7 @@ SUBDIRS = \
|
|||||||
sdp_client \
|
sdp_client \
|
||||||
security_manager \
|
security_manager \
|
||||||
tlv_posix \
|
tlv_posix \
|
||||||
|
embedded \
|
||||||
|
|
||||||
# not testing anything in source tree
|
# not testing anything in source tree
|
||||||
# maths \
|
# maths \
|
||||||
@ -55,7 +56,7 @@ SUBDIRS_BLE = \
|
|||||||
ring_buffer \
|
ring_buffer \
|
||||||
gatt_server \
|
gatt_server \
|
||||||
security_manager \
|
security_manager \
|
||||||
|
embedded \
|
||||||
# test fails
|
# test fails
|
||||||
|
|
||||||
# not unit-tests
|
# not unit-tests
|
||||||
|
@ -6,7 +6,6 @@ BTSTACK_ROOT = ../..
|
|||||||
|
|
||||||
CFLAGS = -g -Wall \
|
CFLAGS = -g -Wall \
|
||||||
-I. \
|
-I. \
|
||||||
-I.. \
|
|
||||||
-I${BTSTACK_ROOT}/src \
|
-I${BTSTACK_ROOT}/src \
|
||||||
-I${BTSTACK_ROOT}/platform/embedded
|
-I${BTSTACK_ROOT}/platform/embedded
|
||||||
|
|
||||||
@ -23,6 +22,7 @@ VPATH += ${BTSTACK_ROOT}/platform/freertos
|
|||||||
|
|
||||||
COMMON = \
|
COMMON = \
|
||||||
btstack_em9304_spi_embedded.c \
|
btstack_em9304_spi_embedded.c \
|
||||||
|
btstack_memory.c \
|
||||||
btstack_run_loop.c \
|
btstack_run_loop.c \
|
||||||
btstack_run_loop_embedded.c \
|
btstack_run_loop_embedded.c \
|
||||||
btstack_stdin_embedded.c \
|
btstack_stdin_embedded.c \
|
||||||
|
30
test/embedded/btstack_config.h
Normal file
30
test/embedded/btstack_config.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
//
|
||||||
|
// btstack_config.h for most tests
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef BTSTACK_CONFIG_H
|
||||||
|
#define BTSTACK_CONFIG_H
|
||||||
|
|
||||||
|
// Port related features
|
||||||
|
#define HAVE_MALLOC
|
||||||
|
#define HAVE_ASSERT
|
||||||
|
#define HAVE_POSIX_TIME
|
||||||
|
#define HAVE_POSIX_FILE_IO
|
||||||
|
#define HAVE_BTSTACK_STDIN
|
||||||
|
|
||||||
|
// BTstack features that can be enabled
|
||||||
|
#define ENABLE_BLE
|
||||||
|
#define ENABLE_LOG_ERROR
|
||||||
|
#define ENABLE_LOG_INFO
|
||||||
|
#define ENABLE_LE_SIGNED_WRITE
|
||||||
|
#define ENABLE_LE_PERIPHERAL
|
||||||
|
#define ENABLE_LE_CENTRAL
|
||||||
|
#define ENABLE_SOFTWARE_AES128
|
||||||
|
|
||||||
|
// BTstack configuration. buffers, sizes, ...
|
||||||
|
#define HCI_ACL_PAYLOAD_SIZE 1024
|
||||||
|
#define HCI_INCOMING_PRE_BUFFER_SIZE 6
|
||||||
|
#define NVM_NUM_LINK_KEYS 2
|
||||||
|
#define NVM_NUM_DEVICE_DB_ENTRIES 4
|
||||||
|
|
||||||
|
#endif
|
@ -23,6 +23,9 @@
|
|||||||
#include "hal_time_ms.h"
|
#include "hal_time_ms.h"
|
||||||
#include "hal_uart_dma.h"
|
#include "hal_uart_dma.h"
|
||||||
|
|
||||||
|
#include "btstack_run_loop.h"
|
||||||
|
#include "btstack_run_loop_embedded.h"
|
||||||
|
#include "btstack_memory.h"
|
||||||
// quick mock
|
// quick mock
|
||||||
|
|
||||||
// hal_cpu
|
// hal_cpu
|
||||||
@ -73,11 +76,37 @@ void hal_audio_source_start(void){}
|
|||||||
void hal_audio_source_stop(void){}
|
void hal_audio_source_stop(void){}
|
||||||
void hal_audio_source_close(void){}
|
void hal_audio_source_close(void){}
|
||||||
|
|
||||||
|
|
||||||
|
#define HEARTBEAT_PERIOD_MS 1000
|
||||||
|
|
||||||
|
static btstack_timer_source_t heartbeat;
|
||||||
|
|
||||||
|
static void heartbeat_timeout_handler(btstack_timer_source_t * timer){
|
||||||
|
UNUSED(timer);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_GROUP(Embedded){
|
TEST_GROUP(Embedded){
|
||||||
|
|
||||||
void setup(void){
|
void setup(void){
|
||||||
|
// start with BTstack init - especially configure HCI Transport
|
||||||
|
btstack_memory_init();
|
||||||
|
btstack_run_loop_init(btstack_run_loop_embedded_get_instance());
|
||||||
|
btstack_run_loop_set_timer_handler(&heartbeat, heartbeat_timeout_handler);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TEST(Embedded, Init){
|
||||||
|
btstack_run_loop_set_timer(&heartbeat, HEARTBEAT_PERIOD_MS);
|
||||||
|
btstack_run_loop_add_timer(&heartbeat);
|
||||||
|
|
||||||
|
btstack_run_loop_embedded_execute_once();
|
||||||
|
btstack_run_loop_embedded_trigger();
|
||||||
|
btstack_run_loop_embedded_execute_once();
|
||||||
|
btstack_run_loop_get_time_ms();
|
||||||
|
|
||||||
|
btstack_run_loop_remove_timer(&heartbeat);
|
||||||
|
}
|
||||||
|
|
||||||
int main (int argc, const char * argv[]){
|
int main (int argc, const char * argv[]){
|
||||||
return CommandLineTestRunner::RunAllTests(argc, argv);
|
return CommandLineTestRunner::RunAllTests(argc, argv);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user