File tree 4 files changed +62
-2
lines changed
4 files changed +62
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ SUBDIRS = \
29
29
sdp_client \
30
30
security_manager \
31
31
tlv_posix \
32
+ embedded \
32
33
33
34
# not testing anything in source tree
34
35
# maths \
@@ -55,7 +56,7 @@ SUBDIRS_BLE = \
55
56
ring_buffer \
56
57
gatt_server \
57
58
security_manager \
58
-
59
+ embedded \
59
60
# test fails
60
61
61
62
# not unit-tests
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ BTSTACK_ROOT = ../..
6
6
7
7
CFLAGS = -g -Wall \
8
8
-I. \
9
- -I.. \
10
9
-I${BTSTACK_ROOT}/src \
11
10
-I${BTSTACK_ROOT}/platform/embedded
12
11
@@ -23,6 +22,7 @@ VPATH += ${BTSTACK_ROOT}/platform/freertos
23
22
24
23
COMMON = \
25
24
btstack_em9304_spi_embedded.c \
25
+ btstack_memory.c \
26
26
btstack_run_loop.c \
27
27
btstack_run_loop_embedded.c \
28
28
btstack_stdin_embedded.c \
Original file line number Diff line number Diff line change
1
+ //
2
+ // btstack_config.h for most tests
3
+ //
4
+
5
+ #ifndef BTSTACK_CONFIG_H
6
+ #define BTSTACK_CONFIG_H
7
+
8
+ // Port related features
9
+ #define HAVE_MALLOC
10
+ #define HAVE_ASSERT
11
+ #define HAVE_POSIX_TIME
12
+ #define HAVE_POSIX_FILE_IO
13
+ #define HAVE_BTSTACK_STDIN
14
+
15
+ // BTstack features that can be enabled
16
+ #define ENABLE_BLE
17
+ #define ENABLE_LOG_ERROR
18
+ #define ENABLE_LOG_INFO
19
+ #define ENABLE_LE_SIGNED_WRITE
20
+ #define ENABLE_LE_PERIPHERAL
21
+ #define ENABLE_LE_CENTRAL
22
+ #define ENABLE_SOFTWARE_AES128
23
+
24
+ // BTstack configuration. buffers, sizes, ...
25
+ #define HCI_ACL_PAYLOAD_SIZE 1024
26
+ #define HCI_INCOMING_PRE_BUFFER_SIZE 6
27
+ #define NVM_NUM_LINK_KEYS 2
28
+ #define NVM_NUM_DEVICE_DB_ENTRIES 4
29
+
30
+ #endif
Original file line number Diff line number Diff line change 23
23
#include "hal_time_ms.h"
24
24
#include "hal_uart_dma.h"
25
25
26
+ #include "btstack_run_loop.h"
27
+ #include "btstack_run_loop_embedded.h"
28
+ #include "btstack_memory.h"
26
29
// quick mock
27
30
28
31
// hal_cpu
@@ -73,11 +76,37 @@ void hal_audio_source_start(void){}
73
76
void hal_audio_source_stop (void ){}
74
77
void hal_audio_source_close (void ){}
75
78
79
+
80
+ #define HEARTBEAT_PERIOD_MS 1000
81
+
82
+ static btstack_timer_source_t heartbeat ;
83
+
84
+ static void heartbeat_timeout_handler (btstack_timer_source_t * timer ){
85
+ UNUSED (timer );
86
+ }
87
+
76
88
TEST_GROUP (Embedded ){
89
+
77
90
void setup (void ){
91
+ // start with BTstack init - especially configure HCI Transport
92
+ btstack_memory_init ();
93
+ btstack_run_loop_init (btstack_run_loop_embedded_get_instance ());
94
+ btstack_run_loop_set_timer_handler (& heartbeat , heartbeat_timeout_handler );
78
95
}
79
96
};
80
97
98
+ TEST (Embedded , Init ){
99
+ btstack_run_loop_set_timer (& heartbeat , HEARTBEAT_PERIOD_MS );
100
+ btstack_run_loop_add_timer (& heartbeat );
101
+
102
+ btstack_run_loop_embedded_execute_once ();
103
+ btstack_run_loop_embedded_trigger ();
104
+ btstack_run_loop_embedded_execute_once ();
105
+ btstack_run_loop_get_time_ms ();
106
+
107
+ btstack_run_loop_remove_timer (& heartbeat );
108
+ }
109
+
81
110
int main (int argc , const char * argv []){
82
111
return CommandLineTestRunner ::RunAllTests (argc , argv );
83
112
}
You can’t perform that action at this time.
0 commit comments