新手入门
- 积分
- 11
- 金钱
- 11
- 注册时间
- 2016-4-19
- 在线时间
- 1 小时
|
前面定义
#ifndef DEBUG
#define DEBUG 1
#endif
/* Private macros ------------------------------------------------------------*/
#if DEBUG
#include <stdio.h>
#define PRINTF(...) printf(__VA_ARGS__)
#else
#define PRINTF(...)
#endif
然后再主函数中while(1) {
/* BLE Stack Tick */
BTLE_StackTick();
/* Application Tick */
APP_Tick();
/* Power Save management */
BlueNRG_Sleep(SLEEPMODE_WAKETIMER, 0, 0, 0);
}
然后APP_Tick();调用void Update_Temperature(void)
{
float temperature_data;
uint8_t status = 1;
#ifdef SENSOR_EMULATION /* User Emulated Data */
temperature_data = 26 + ((uint64_t)rand()*15)/RAND_MAX;
#else
/* Use temperature sensor */
status = (xLPS25HBDrv->GetTemperature(&temperature_data) == 0) ? 1: 0;
#endif
if (status) {
HOST_TO_LE_16(adv_data+TEMP_OFFSET, (int16_t)temperature_data);
hci_le_set_advertising_data(sizeof(adv_data),adv_data);
printf("Updated temperature: %.2f 'C\n",temperature_data);
}
}
printf("Updated temperature: %.2f 'C\n",temperature_data);然而调试窗口没有打印任何字符
按理说前面已经定义了DEBUG,输出函数应该至少可以打印出Updated temperature字符啊
|
|