use PRIu32 for printf of 32-bit integers

This commit is contained in:
Matthias Ringwald 2015-09-21 18:10:47 +02:00
parent 5ee1c190aa
commit 5838a2ed38
5 changed files with 9 additions and 6 deletions

View File

@ -293,7 +293,7 @@ static void handle_gatt_client_event(le_event_t * event){
} else if (value_event->value_handle == ancs_notification_source_characteristic.value_handle){ } else if (value_event->value_handle == ancs_notification_source_characteristic.value_handle){
ancs_notification_uid = READ_BT_32(value_event->blob, 4); ancs_notification_uid = READ_BT_32(value_event->blob, 4);
printf("Notification received: EventID %02x, EventFlags %02x, CategoryID %02x, CategoryCount %u, UID %04x\n", printf("Notification received: EventID %02x, EventFlags %02x, CategoryID %02x, CategoryCount %u, UID %04x\n",
value_event->blob[0], value_event->blob[1], value_event->blob[2], value_event->blob[3], ancs_notification_uid); value_event->blob[0], value_event->blob[1], value_event->blob[2], value_event->blob[3], (int) ancs_notification_uid);
static uint8_t get_notification_attributes[] = {0, 0,0,0,0, 0, 1,32,0, 2,32,0, 3,32,0, 4, 5}; static uint8_t get_notification_attributes[] = {0, 0,0,0,0, 0, 1,32,0, 2,32,0, 3,32,0, 4, 5};
bt_store_32(get_notification_attributes, 1, ancs_notification_uid); bt_store_32(get_notification_attributes, 1, ancs_notification_uid);
ancs_notification_uid = 0; ancs_notification_uid = 0;

View File

@ -44,6 +44,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <inttypes.h>
#include "btstack-config.h" #include "btstack-config.h"
@ -257,7 +258,7 @@ static void att_run(void){
// check counter // check counter
uint32_t counter_packet = READ_BT_32(att_request_buffer, att_request_size-12); uint32_t counter_packet = READ_BT_32(att_request_buffer, att_request_size-12);
uint32_t counter_db = le_device_db_remote_counter_get(att_ir_le_device_db_index); uint32_t counter_db = le_device_db_remote_counter_get(att_ir_le_device_db_index);
log_info("ATT Signed Write, DB counter %u, packet counter %u", counter_db, counter_packet); log_info("ATT Signed Write, DB counter %"PRIu32", packet counter %"PRIu32, counter_db, counter_packet);
if (counter_packet < counter_db){ if (counter_packet < counter_db){
log_info("ATT Signed Write, db reports higher counter, abort"); log_info("ATT Signed Write, db reports higher counter, abort");
att_server_state = ATT_SERVER_IDLE; att_server_state = ATT_SERVER_IDLE;

View File

@ -37,6 +37,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <inttypes.h>
#include <btstack/linked_list.h> #include <btstack/linked_list.h>
@ -470,7 +471,7 @@ static void sm_notify_client(uint8_t type, uint8_t addr_type, bd_addr_t address,
event.passkey = passkey; event.passkey = passkey;
event.le_device_db_index = index; event.le_device_db_index = index;
log_info("sm_notify_client %02x, addres_type %u, address %s, num '%06u', index %u", event.type, event.addr_type, bd_addr_to_str(event.address), event.passkey, event.le_device_db_index); log_info("sm_notify_client %02x, addres_type %u, address %s, num '%06"PRIu32"', index %u", event.type, event.addr_type, bd_addr_to_str(event.address), event.passkey, event.le_device_db_index);
if (!sm_client_packet_handler) return; if (!sm_client_packet_handler) return;
sm_client_packet_handler(HCI_EVENT_PACKET, 0, (uint8_t*) &event, sizeof(event)); sm_client_packet_handler(HCI_EVENT_PACKET, 0, (uint8_t*) &event, sizeof(event));

View File

@ -54,6 +54,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <inttypes.h>
#ifndef EMBEDDED #ifndef EMBEDDED
#ifdef _WIN32 #ifdef _WIN32
@ -829,7 +830,7 @@ static void hci_initialization_timeout_handler(timer_source_t * ds){
hci_stack->num_cmd_packets = 1; hci_stack->num_cmd_packets = 1;
hci_run(); hci_run();
case HCI_INIT_W4_SEND_BAUD_CHANGE: case HCI_INIT_W4_SEND_BAUD_CHANGE:
log_info("Local baud rate change to %u", ((hci_uart_config_t *)hci_stack->config)->baudrate_main); log_info("Local baud rate change to %"PRIu32, ((hci_uart_config_t *)hci_stack->config)->baudrate_main);
hci_stack->hci_transport->set_baudrate(((hci_uart_config_t *)hci_stack->config)->baudrate_main); hci_stack->hci_transport->set_baudrate(((hci_uart_config_t *)hci_stack->config)->baudrate_main);
break; break;
default: default:
@ -1103,7 +1104,7 @@ static void hci_initializing_event_handler(uint8_t * packet, uint16_t size){
// for CC256x, baud rate gets changed now // for CC256x, baud rate gets changed now
if (hci_stack->manufacturer != 0x0030){ if (hci_stack->manufacturer != 0x0030){
uint32_t new_baud = ((hci_uart_config_t *)hci_stack->config)->baudrate_main; uint32_t new_baud = ((hci_uart_config_t *)hci_stack->config)->baudrate_main;
log_info("Local baud rate change to %u", new_baud); log_info("Local baud rate change to %"PRIu32, new_baud);
hci_stack->hci_transport->set_baudrate(new_baud); hci_stack->hci_transport->set_baudrate(new_baud);
} }
hci_stack->substate = HCI_INIT_CUSTOM_INIT; hci_stack->substate = HCI_INIT_CUSTOM_INIT;

View File

@ -145,7 +145,7 @@ void parse(uint8_t eventByte){
case GET_ATTRIBUTE_ID_HEADER_LENGTH: case GET_ATTRIBUTE_ID_HEADER_LENGTH:
if (!de_state_size(eventByte, &de_header_state)) break; if (!de_state_size(eventByte, &de_header_state)) break;
attribute_id = 0; attribute_id = 0;
log_info("ID data is stored in %d bytes.", de_header_state.de_size); log_info("ID data is stored in %d bytes.", (int) de_header_state.de_size);
state = GET_ATTRIBUTE_ID; state = GET_ATTRIBUTE_ID;
break; break;