mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-28 19:20:54 +00:00
example: fix warnings for printf of uint32_t values
This commit is contained in:
parent
367554ea4a
commit
173fff9bf3
@ -60,6 +60,7 @@
|
||||
*/
|
||||
// *****************************************************************************
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -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)));
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#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;
|
||||
|
@ -47,6 +47,7 @@
|
||||
* record and opens the HID Control + Interrupt channels
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#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;
|
||||
|
||||
|
@ -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:
|
||||
|
@ -54,6 +54,7 @@
|
||||
*/
|
||||
// *****************************************************************************
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -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;
|
||||
|
@ -46,6 +46,7 @@
|
||||
*/
|
||||
// *****************************************************************************
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -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 */
|
||||
/* EXAMPLE_END */
|
||||
|
@ -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 */
|
||||
/* EXAMPLE_END */
|
||||
|
Loading…
x
Reference in New Issue
Block a user