Skip to content

Commit e737e4c

Browse files
committed
Change to btstack_config headers
Add missing "static" to methods in server
1 parent efd6100 commit e737e4c

File tree

6 files changed

+23
-8
lines changed

6 files changed

+23
-8
lines changed

pico_w/bt/standalone/btstack_config.h renamed to pico_w/bt/standalone/btstack_config_common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef _PICO_BTSTACK_BTSTACK_CONFIG_H
2-
#define _PICO_BTSTACK_BTSTACK_CONFIG_H
1+
#ifndef _PICO_BTSTACK_CONFIG_COMMON_H
2+
#define _PICO_BTSTACK_CONFIG_COMMON_H
33

44
#ifndef ENABLE_BLE
55
#error Please link to pico_btstack_ble

pico_w/bt/standalone/client/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ target_link_libraries(picow_ble_temp_reader
1212
hardware_adc
1313
)
1414
target_include_directories(picow_ble_temp_reader PRIVATE
15-
${CMAKE_CURRENT_LIST_DIR}/.. # For btstack config
15+
${CMAKE_CURRENT_LIST_DIR}
16+
${CMAKE_CURRENT_LIST_DIR}/.. # For our common btstack config
1617
)
1718
target_compile_definitions(picow_ble_temp_reader PRIVATE
1819
RUNNING_AS_CLIENT=1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef _PICO_BTSTACK_CONFIG_H
2+
#define _PICO_BTSTACK_CONFIG_H
3+
4+
#include "btstack_config_common.h"
5+
6+
#endif

pico_w/bt/standalone/server/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ target_link_libraries(picow_ble_temp_sensor
1111
hardware_adc
1212
)
1313
target_include_directories(picow_ble_temp_sensor PRIVATE
14-
${CMAKE_CURRENT_LIST_DIR}/.. # For btstack config
14+
${CMAKE_CURRENT_LIST_DIR}
15+
${CMAKE_CURRENT_LIST_DIR}/.. # For our common btstack config
1516
)
1617
pico_btstack_make_gatt_header(picow_ble_temp_sensor PRIVATE "${CMAKE_CURRENT_LIST_DIR}/temp_sensor.gatt")
1718

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef _PICO_BTSTACK_CONFIG_H
2+
#define _PICO_BTSTACK_CONFIG_H
3+
4+
#include "btstack_config_common.h"
5+
6+
#endif

pico_w/bt/standalone/server/server.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ static btstack_timer_source_t heartbeat;
3333
static btstack_packet_callback_registration_t hci_event_callback_registration;
3434

3535
extern uint8_t const profile_data[];
36+
static void poll_temp(void);
3637

37-
void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
38+
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
3839
UNUSED(size);
3940
UNUSED(channel);
4041
bd_addr_t local_addr;
@@ -72,7 +73,7 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
7273
}
7374
}
7475

75-
uint16_t att_read_callback(hci_con_handle_t connection_handle, uint16_t att_handle, uint16_t offset, uint8_t * buffer, uint16_t buffer_size) {
76+
static uint16_t att_read_callback(hci_con_handle_t connection_handle, uint16_t att_handle, uint16_t offset, uint8_t * buffer, uint16_t buffer_size) {
7677
UNUSED(connection_handle);
7778

7879
if (att_handle == ATT_CHARACTERISTIC_ORG_BLUETOOTH_CHARACTERISTIC_TEMPERATURE_01_VALUE_HANDLE){
@@ -81,7 +82,7 @@ uint16_t att_read_callback(hci_con_handle_t connection_handle, uint16_t att_hand
8182
return 0;
8283
}
8384

84-
int att_write_callback(hci_con_handle_t connection_handle, uint16_t att_handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size) {
85+
static int att_write_callback(hci_con_handle_t connection_handle, uint16_t att_handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size) {
8586
UNUSED(transaction_mode);
8687
UNUSED(offset);
8788
UNUSED(buffer_size);
@@ -95,7 +96,7 @@ int att_write_callback(hci_con_handle_t connection_handle, uint16_t att_handle,
9596
return 0;
9697
}
9798

98-
void poll_temp(void) {
99+
static void poll_temp(void) {
99100
adc_select_input(ADC_CHANNEL_TEMPSENSOR);
100101
uint32_t raw32 = adc_read();
101102
const uint32_t bits = 12;

0 commit comments

Comments
 (0)