From 173fff9bf31f49f2400ccd814f67b37fe10e0e68 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Fri, 12 Jan 2018 15:54:03 +0100 Subject: [PATCH] example: fix warnings for printf of uint32_t values --- example/a2dp_sink_demo.c | 9 +++++---- example/ancs_client_demo.c | 3 ++- example/hid_host_demo.c | 3 ++- example/hid_mouse_demo.c | 6 +++--- example/le_streamer.c | 3 ++- example/le_streamer_client.c | 5 +++-- example/sdp_bnep_query.c | 4 ++-- 7 files changed, 19 insertions(+), 14 deletions(-) diff --git a/example/a2dp_sink_demo.c b/example/a2dp_sink_demo.c index 9e0813d82..f21aa4ba5 100644 --- a/example/a2dp_sink_demo.c +++ b/example/a2dp_sink_demo.c @@ -60,6 +60,7 @@ */ // ***************************************************************************** +#include #include #include #include @@ -118,7 +119,7 @@ static btstack_ring_buffer_t ring_buffer; #define DMA_AUDIO_FRAMES 128 #define DMA_MAX_FILL_FRAMES 1 #define NUM_AUDIO_BUFFERS 2 - +static void hal_audio_dma_process(btstack_data_source_t * ds, btstack_data_source_callback_type_t callback_type); static uint16_t audio_samples[(DMA_AUDIO_FRAMES + DMA_MAX_FILL_FRAMES)*2*NUM_AUDIO_BUFFERS]; static uint16_t audio_samples_len[NUM_AUDIO_BUFFERS]; static uint8_t ring_buffer_storage[(OPTIMAL_FRAMES_MAX + ADDITIONAL_FRAMES) * MAX_SBC_FRAME_SIZE]; @@ -243,7 +244,7 @@ static void handle_l2cap_media_data_packet(uint8_t seid, uint8_t *packet, uint16 #ifdef HAVE_BTSTACK_STDIN static void stdin_process(char cmd); #endif -#if defined(HAVE_PORTAUDIO) || defined(STORE_SBC_TO_WAV_FILE) +#if defined(HAVE_PORTAUDIO) || defined(STORE_SBC_TO_WAV_FILE) || defined(HAVE_AUDIO_DMA) static void handle_pcm_data(int16_t * data, int num_samples, int num_channels, int sample_rate, void * context); #endif @@ -375,7 +376,7 @@ void hal_audio_dma_done(void){ // start playing silence audio_stream_paused = 1; hal_audio_dma_play((const uint8_t *) silent_buffer, DMA_AUDIO_FRAMES*4); - printf("%6u - paused - bytes in buffer %u\n", (int) btstack_run_loop_get_time_ms(), btstack_ring_buffer_bytes_available(&ring_buffer)); + printf("%6u - paused - bytes in buffer %"PRIu32"\n", (int) btstack_run_loop_get_time_ms(), btstack_ring_buffer_bytes_available(&ring_buffer)); return; } playback_buffer = next_playback_buffer; @@ -818,7 +819,7 @@ static void avrcp_controller_packet_handler(uint8_t packet_type, uint16_t channe break; case AVRCP_SUBEVENT_PLAY_STATUS: - printf("song length: %d ms, song position: %d ms, play status: %s\n", + printf("song length: %"PRIu32" ms, song position: %"PRIu32" ms, play status: %s\n", avrcp_subevent_play_status_get_song_length(packet), avrcp_subevent_play_status_get_song_position(packet), avrcp_play_status2str(avrcp_subevent_play_status_get_play_status(packet))); diff --git a/example/ancs_client_demo.c b/example/ancs_client_demo.c index 91e6b0061..eae2d1c34 100644 --- a/example/ancs_client_demo.c +++ b/example/ancs_client_demo.c @@ -50,6 +50,7 @@ #include #include #include +#include #include "btstack_config.h" @@ -97,7 +98,7 @@ static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t * printf("Just Works Confirmed.\n"); break; case SM_EVENT_PASSKEY_DISPLAY_NUMBER: - printf("Passkey display: %06u.\n", sm_event_passkey_display_number_get_passkey(packet)); + printf("Passkey display: %"PRIu32"\n", sm_event_passkey_display_number_get_passkey(packet)); break; } break; diff --git a/example/hid_host_demo.c b/example/hid_host_demo.c index 17f1ba4b2..bfc81b193 100644 --- a/example/hid_host_demo.c +++ b/example/hid_host_demo.c @@ -47,6 +47,7 @@ * record and opens the HID Control + Interrupt channels */ +#include #include #include "btstack_config.h" @@ -371,7 +372,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack case HCI_EVENT_USER_CONFIRMATION_REQUEST: // inform about user confirmation request - printf("SSP User Confirmation Request with numeric value '%06u'\n", little_endian_read_32(packet, 8)); + printf("SSP User Confirmation Request with numeric value '%"PRIu32"'\n", little_endian_read_32(packet, 8)); printf("SSP User Confirmation Auto accept\n"); break; diff --git a/example/hid_mouse_demo.c b/example/hid_mouse_demo.c index 7e849e0d3..d3f5bd39a 100644 --- a/example/hid_mouse_demo.c +++ b/example/hid_mouse_demo.c @@ -189,7 +189,7 @@ static btstack_timer_source_t mousing_timer; static void mousing_timer_handler(btstack_timer_source_t * ts){ - if (con_handle == HCI_CON_HANDLE_INVALID) return; + if (!hid_cid) return; // simulate left click when corner reached if (step % STEPS_PER_DIRECTION == 0){ @@ -207,7 +207,7 @@ static void mousing_timer_handler(btstack_timer_source_t * ts){ } // trigger send - hids_device_request_can_send_now_event(con_handle); + hid_device_request_can_send_now_event(hid_cid); // set next timer btstack_run_loop_set_timer(ts, MOUSE_PERIOD_MS); @@ -247,7 +247,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack printf("HID Connected, control mouse using 'a','s',''d', 'w' keys for movement and 'l' and 'r' for buttons...\n"); #else printf("HID Connected, simulating mouse movements...\n"); - hid_embedded_start_typing(); + hid_embedded_start_mousing(); #endif break; case HID_SUBEVENT_CONNECTION_CLOSED: diff --git a/example/le_streamer.c b/example/le_streamer.c index a1782c8f1..0a4c74efd 100644 --- a/example/le_streamer.c +++ b/example/le_streamer.c @@ -54,6 +54,7 @@ */ // ***************************************************************************** +#include #include #include #include @@ -184,7 +185,7 @@ static void test_track_sent(le_streamer_connection_t * context, int bytes_sent){ if (time_passed < REPORT_INTERVAL_MS) return; // print speed int bytes_per_second = context->test_data_sent * 1000 / time_passed; - printf("%c: %u bytes sent-> %u.%03u kB/s\n", context->name, context->test_data_sent, bytes_per_second / 1000, bytes_per_second % 1000); + printf("%c: %"PRIu32" bytes sent-> %u.%03u kB/s\n", context->name, context->test_data_sent, bytes_per_second / 1000, bytes_per_second % 1000); // restart context->test_data_start = now; diff --git a/example/le_streamer_client.c b/example/le_streamer_client.c index e8cd0177b..14b0f11a1 100644 --- a/example/le_streamer_client.c +++ b/example/le_streamer_client.c @@ -46,6 +46,7 @@ */ // ***************************************************************************** +#include #include #include #include @@ -121,7 +122,7 @@ static void test_track_data(le_streamer_connection_t * context, int bytes_sent){ if (time_passed < REPORT_INTERVAL_MS) return; // print speed int bytes_per_second = context->test_data_sent * 1000 / time_passed; - printf("%c: %u bytes -> %u.%03u kB/s\n", context->name, context->test_data_sent, bytes_per_second / 1000, bytes_per_second % 1000); + printf("%c: %"PRIu32" bytes -> %u.%03u kB/s\n", context->name, context->test_data_sent, bytes_per_second / 1000, bytes_per_second % 1000); // restart context->test_data_start = now; @@ -367,4 +368,4 @@ int btstack_main(int argc, const char * argv[]){ return 0; } -/* EXAMPLE_END */ \ No newline at end of file +/* EXAMPLE_END */ diff --git a/example/sdp_bnep_query.c b/example/sdp_bnep_query.c index 50d532175..6c5fa6af7 100644 --- a/example/sdp_bnep_query.c +++ b/example/sdp_bnep_query.c @@ -196,7 +196,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint16_t channel case BLUETOOTH_SERVICE_CLASS_PANU: case BLUETOOTH_SERVICE_CLASS_NAP: case BLUETOOTH_SERVICE_CLASS_GN: - printf(" ** Attribute 0x%04x: BNEP PAN protocol UUID: %04x\n", sdp_event_query_attribute_byte_get_attribute_id(packet), uuid); + printf(" ** Attribute 0x%04x: BNEP PAN protocol UUID: %04x\n", sdp_event_query_attribute_byte_get_attribute_id(packet), (int) uuid); break; default: break; @@ -283,4 +283,4 @@ int btstack_main(int argc, const char * argv[]){ return 0; } -/* EXAMPLE_END */ \ No newline at end of file +/* EXAMPLE_END */