Compare commits

...

25 Commits

Author SHA1 Message Date
chain40 4c615f0b3b create dfu service 2023-09-27 07:17:40 +08:00
chain40 a8d9400624 use nrfutil create OTA file 2023-09-26 22:00:36 +08:00
chain40 6b4d87232a gcc compiler 12.3.1 2023-09-19 20:35:46 +08:00
chain40 06a1b0d036 clrea regular data queue when connected 2023-06-07 23:13:04 +08:00
chain40 c8a4a15b3d remove PHY request when connected event.
1. 2M PHY can be requested from either slave or master device.

2. In Elite device, the 2M PHY be requested from master device.
2023-06-07 23:12:29 +08:00
chain40 2f1a013dd4 reset eis char notify enable status 2023-06-07 23:05:00 +08:00
chain40 4f0a383880 bugfix: fix BLE_UUID_EIS_EVENT_CHAR error 2023-06-07 23:04:11 +08:00
charles a2653f7919 To achieve maximum throughput for the BLE dongle.
1. Set the maximum connection interval to 20ms.
2. Refactory pseudo_data_task()
3. Decrease size of regular_data_q
2023-05-25 15:24:22 +08:00
charles 066b436762 bugfix: increase hvn_tx_queue_size for high freq notify 2023-05-25 13:41:58 +08:00
charles fdab23e151 bugfix: fix channel_len (group_length) field miss 2023-05-25 13:08:51 +08:00
charles 386bc17007 bugfix: fix wrong offset for checksum 2023-05-25 11:29:34 +08:00
charles 8ed0921284 regular_data_notify_demo.py bugfix 2023-05-25 11:25:03 +08:00
chain40 3e1d8bfedc implenmet eis_regular_data feature
1. create 2 pseudo task, update freq = 1KHz
2. add regular_data_notify_demo.py for validation
2023-05-25 10:27:17 +08:00
chain40 bb5bf77aa1 update gap/gatt configurtion 2023-05-25 00:15:53 +08:00
chain40 99482ff463 update GAP/GATT configure for ATT MTU
1. set gap data length = 251
2. set gatt mtu = 247
3. increase gap event length (events per connection interval)
4. increase ram usage for softdevice
2023-05-25 00:15:35 +08:00
chain40 adc92b10ac main.c code refactoring
1. remove led1_task, led1_task.
2. send phy update request when conncted.
3. le_evt_handler() ouput more ble event information
2023-05-25 00:08:50 +08:00
chain40 d0d915d69e update freertos configuration
1. remove unused functions
2. increase freertos heap size to 32KB
3. increase max of priorities
2023-05-25 00:06:12 +08:00
chain40 4894838edf Revert "create EIS battery volt update interval characteristic (uint: ms)"
This reverts commit 811bcae588.
2023-05-11 20:34:06 +08:00
charles 811bcae588 create EIS battery volt update interval characteristic (uint: ms)
1.  if battery volt update interval < 100ms, set interval = 100ms
2023-05-11 17:05:28 +08:00
charles 6162d15791 define le_eis_bat_volt_update(). sending notification with the battery volt characteristic , if notification is enable,
1. define on_connect()
2. define on_disconnect()
2023-05-11 14:27:51 +08:00
charles c358f20a8a create battery task 2023-05-11 14:14:30 +08:00
chain40 60fb26518a fix BLE_GATTS_EVT_SYS_ATTR_MISSING issue 2023-05-11 08:12:20 +08:00
chain40 672ccaaa02 set the battery voltage characteristic as a notification characteristic Part 1.
1. register handler for ble events
2. add eis_ccc_update() for CCCD (client characteristic configuration descriptor)
2023-05-11 08:12:14 +08:00
chain40 2f708e0113 create EIS battery volt characteristic, and support read only 2023-05-10 23:19:31 +08:00
chain40 10aed00a1c create EIS service 2023-05-10 23:00:25 +08:00
19 changed files with 915 additions and 136 deletions
+19 -19
View File
@@ -56,25 +56,25 @@
#define configTICK_SOURCE FREERTOS_USE_RTC #define configTICK_SOURCE FREERTOS_USE_RTC
#define configUSE_PREEMPTION 1 #define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
#define configUSE_TICKLESS_IDLE 0 #define configUSE_TICKLESS_IDLE 0
#define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG 1 /* See into vPortSuppressTicksAndSleep source code for explanation */ #define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG 1 /* See into vPortSuppressTicksAndSleep source code for explanation */
#define configCPU_CLOCK_HZ ( SystemCoreClock ) #define configCPU_CLOCK_HZ ( SystemCoreClock )
#define configTICK_RATE_HZ 1024 #define configTICK_RATE_HZ 1024
#define configMAX_PRIORITIES ( 5 ) #define configMAX_PRIORITIES ( 6 )
#define configMINIMAL_STACK_SIZE ( 160 ) #define configMINIMAL_STACK_SIZE ( 192 )
#define configTOTAL_HEAP_SIZE ( 8192 ) #define configTOTAL_HEAP_SIZE ( 32 * 1024 )
#define configMAX_TASK_NAME_LEN ( 12 ) #define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_16_BIT_TICKS 0 #define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1 #define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1 #define configUSE_MUTEXES 1
#define configUSE_RECURSIVE_MUTEXES 1 #define configUSE_RECURSIVE_MUTEXES 0
#define configUSE_COUNTING_SEMAPHORES 1 #define configUSE_COUNTING_SEMAPHORES 0
#define configUSE_ALTERNATIVE_API 0 /* Deprecated! */ #define configUSE_ALTERNATIVE_API 0 /* Deprecated! */
#define configQUEUE_REGISTRY_SIZE 2 #define configQUEUE_REGISTRY_SIZE 2
#define configUSE_QUEUE_SETS 0 #define configUSE_QUEUE_SETS 0
#define configUSE_TIME_SLICING 0 #define configUSE_TIME_SLICING 0
#define configUSE_NEWLIB_REENTRANT 0 #define configUSE_NEWLIB_REENTRANT 1
#define configENABLE_BACKWARD_COMPATIBILITY 1 #define configENABLE_BACKWARD_COMPATIBILITY 1
/* Hook function related definitions. */ /* Hook function related definitions. */
@@ -113,22 +113,22 @@
#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 1 #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 1
/* Optional functions - most linkers will remove unused functions anyway. */ /* Optional functions - most linkers will remove unused functions anyway. */
#define INCLUDE_vTaskPrioritySet 1 #define INCLUDE_vTaskPrioritySet 0
#define INCLUDE_uxTaskPriorityGet 1 #define INCLUDE_uxTaskPriorityGet 0
#define INCLUDE_vTaskDelete 1 #define INCLUDE_vTaskDelete 0
#define INCLUDE_vTaskSuspend 1 #define INCLUDE_vTaskSuspend 1
#define INCLUDE_xResumeFromISR 1 #define INCLUDE_xResumeFromISR 0
#define INCLUDE_vTaskDelayUntil 1 #define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1 #define INCLUDE_vTaskDelay 1
#define INCLUDE_xTaskGetSchedulerState 1 #define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_xTaskGetCurrentTaskHandle 1 #define INCLUDE_xTaskGetCurrentTaskHandle 0
#define INCLUDE_uxTaskGetStackHighWaterMark 1 #define INCLUDE_uxTaskGetStackHighWaterMark 0
#define INCLUDE_xTaskGetIdleTaskHandle 1 #define INCLUDE_xTaskGetIdleTaskHandle 0
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1 #define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
#define INCLUDE_pcTaskGetTaskName 1 #define INCLUDE_pcTaskGetTaskName 0
#define INCLUDE_eTaskGetState 1 #define INCLUDE_eTaskGetState 0
#define INCLUDE_xEventGroupSetBitFromISR 1 #define INCLUDE_xEventGroupSetBitFromISR 1
#define INCLUDE_xTimerPendFunctionCall 1 #define INCLUDE_xTimerPendFunctionCall 0
/* The lowest interrupt priority that can be used in a call to a "set priority" /* The lowest interrupt priority that can be used in a call to a "set priority"
function. */ function. */
+23 -14
View File
@@ -83,7 +83,7 @@ extern "C"
// SoftDevice BLE event handler // SoftDevice BLE event handler
#define NRF_SDH_BLE_ENABLED 1 #define NRF_SDH_BLE_ENABLED 1
// The number of vendor-specific UUIDs. // The number of vendor-specific UUIDs.
#define NRF_SDH_BLE_VS_UUID_COUNT 0 #define NRF_SDH_BLE_VS_UUID_COUNT 2
// Attribute Table size in bytes. The size must be a multiple of 4. // Attribute Table size in bytes. The size must be a multiple of 4.
#define NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE 1408 #define NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE 1408
// BLE Observers - Observers and priority levels // BLE Observers - Observers and priority levels
@@ -123,17 +123,21 @@ extern "C"
#define MAJOR_VERSION_NUMBER 1 #define MAJOR_VERSION_NUMBER 1
#define MINOR_VERSION_NUMBER 8 #define MINOR_VERSION_NUMBER 8
#elif (DEF_ELITE_MODEL == DEF_ELITE_EIS_10) #elif (DEF_ELITE_MODEL == DEF_ELITE_EIS_10)
#define ELITE_DEVICE_NAME "EIS" #define ELITE_DEVICE_NAME "EIS"
#define MAJOR_PRODUCT_NUMBER 0 #define MAJOR_PRODUCT_NUMBER 0
#define MINOR_PRODUCT_NUMBER 4 #define MINOR_PRODUCT_NUMBER 4
#define MAJOR_VERSION_NUMBER 1 #define MAJOR_VERSION_NUMBER 1
#define MINOR_VERSION_NUMBER 0 #define MINOR_VERSION_NUMBER 0
#define BLE_EIS_ENABLED 1
#define EIS_BLE_OBSERVER_PRIO 3
#elif (DEF_ELITE_MODEL == DEF_ELITE_EIS_11) #elif (DEF_ELITE_MODEL == DEF_ELITE_EIS_11)
#define ELITE_DEVICE_NAME "EIS" #define ELITE_DEVICE_NAME "EIS"
#define MAJOR_PRODUCT_NUMBER 0 #define MAJOR_PRODUCT_NUMBER 0
#define MINOR_PRODUCT_NUMBER 4 #define MINOR_PRODUCT_NUMBER 4
#define MAJOR_VERSION_NUMBER 1 #define MAJOR_VERSION_NUMBER 1
#define MINOR_VERSION_NUMBER 1 #define MINOR_VERSION_NUMBER 1
#define BLE_EIS_ENABLED 1
#define EIS_BLE_OBSERVER_PRIO 3
#elif (DEF_ELITE_MODEL == DEF_ELITE_EIS_MINI_10) #elif (DEF_ELITE_MODEL == DEF_ELITE_EIS_MINI_10)
#define ELITE_DEVICE_NAME "EIS" #define ELITE_DEVICE_NAME "EIS"
#define MAJOR_PRODUCT_NUMBER 0 #define MAJOR_PRODUCT_NUMBER 0
@@ -160,15 +164,20 @@ extern "C"
// Priority with which BLE events are dispatched to the GATT module. // Priority with which BLE events are dispatched to the GATT module.
#define NRF_BLE_GATT_BLE_OBSERVER_PRIO 1 #define NRF_BLE_GATT_BLE_OBSERVER_PRIO 1
// Requested BLE GAP data length to be negotiated. // Requested BLE GAP data length to be negotiated.
#define NRF_SDH_BLE_GAP_DATA_LENGTH 27 #define NRF_SDH_BLE_GAP_DATA_LENGTH 251
// GAP event length. The time set aside for this connection on every connection interval in 1.25 ms units. // GAP event length. The time set aside for this connection on every connection interval in 1.25 ms units.
#define NRF_SDH_BLE_GAP_EVENT_LENGTH 6 #define NRF_SDH_BLE_GAP_EVENT_LENGTH (0xFFFF)
// Static maximum MTU size. // Static maximum MTU size.
#define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 23 #define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 247
// Enable ble device info module // Enable ble device info module
#define BLE_DIS_ENABLED 1 #define BLE_DIS_ENABLED 1
// DFU
#define NRF_DFU_TRANSPORT_BLE 1
#define BLE_DFU_BLE_OBSERVER_PRIO 2
#define NRF_PWR_MGMT_ENABLED 1
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
+14 -1
View File
@@ -25,6 +25,7 @@
<ProjectFile>bmd380_peripheral.vcxproj</ProjectFile> <ProjectFile>bmd380_peripheral.vcxproj</ProjectFile>
<RemoteBuildEnvironment> <RemoteBuildEnvironment>
<Records /> <Records />
<EnvironmentSetupFiles />
</RemoteBuildEnvironment> </RemoteBuildEnvironment>
<ParallelJobCount>1</ParallelJobCount> <ParallelJobCount>1</ParallelJobCount>
<SuppressDirectoryChangeMessages>true</SuppressDirectoryChangeMessages> <SuppressDirectoryChangeMessages>true</SuppressDirectoryChangeMessages>
@@ -33,7 +34,19 @@
<CustomBuild> <CustomBuild>
<PreSyncActions /> <PreSyncActions />
<PreBuildActions /> <PreBuildActions />
<PostBuildActions /> <PostBuildActions>
<CustomActionBase xsi:type="CommandLineAction">
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
<RemoteHost>
<HostName>BuildMachine</HostName>
<Transport>BuiltinShortcut</Transport>
</RemoteHost>
<Command>nrfutil</Command>
<Arguments>pkg generate --hw-version 52 --sd-req 0x100 --application-version 0 --application $(TargetPath).hex --key-file $(BuildDir)\private.pem $(BuildDir)\OTA_$(TargetFileName).zip"</Arguments>
<WorkingDirectory>$(BuildDir)</WorkingDirectory>
<BackgroundMode>false</BackgroundMode>
</CustomActionBase>
</PostBuildActions>
<PreCleanActions /> <PreCleanActions />
<PostCleanActions /> <PostCleanActions />
</CustomBuild> </CustomBuild>
+26 -5
View File
@@ -32,20 +32,20 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">
<GNUConfigurationType>Debug</GNUConfigurationType> <GNUConfigurationType>Debug</GNUConfigurationType>
<ToolchainID>com.visualgdb.arm-eabi</ToolchainID> <ToolchainID>com.visualgdb.arm-eabi</ToolchainID>
<ToolchainVersion>10.3.1/10.2.90/r1</ToolchainVersion> <ToolchainVersion>12.3.1/13.2/r1</ToolchainVersion>
<GenerateHexFile>true</GenerateHexFile> <GenerateHexFile>true</GenerateHexFile>
<MCUPropertyListFile>$(ProjectDir)nrf5x.props</MCUPropertyListFile> <MCUPropertyListFile>$(ProjectDir)nrf5x.props</MCUPropertyListFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|VisualGDB'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|VisualGDB'">
<ToolchainID>com.visualgdb.arm-eabi</ToolchainID> <ToolchainID>com.visualgdb.arm-eabi</ToolchainID>
<ToolchainVersion>10.3.1/10.2.90/r1</ToolchainVersion> <ToolchainVersion>12.3.1/13.2/r1</ToolchainVersion>
<GenerateHexFile>true</GenerateHexFile> <GenerateHexFile>true</GenerateHexFile>
<MCUPropertyListFile>$(ProjectDir)nrf5x.props</MCUPropertyListFile> <MCUPropertyListFile>$(ProjectDir)nrf5x.props</MCUPropertyListFile>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">
<ClCompile> <ClCompile>
<CLanguageStandard>GNU99</CLanguageStandard> <CLanguageStandard>GNU99</CLanguageStandard>
<AdditionalIncludeDirectories>.;../bmd380_sdk/components/softdevice/s140/headers;../bmd380_sdk/components/softdevice/s140/headers/nrf52;../bmd380_sdk/external/segger_rtt;../bmd380_sdk/components/libraries/log;../bmd380_sdk/components/libraries/log/src;../bmd380_sdk/components/libraries/memobj;../bmd380_sdk/components/libraries/ringbuf;../bmd380_sdk/components/libraries/atomic;../bmd380_sdk/components/libraries/balloc;../bmd380_sdk/external/freertos/portable/CMSIS/nrf52;../bmd380_sdk/external/freertos/portable/GCC/nrf52;../bmd380_sdk/integration/nrfx;../bmd380_sdk/integration/nrfx/legacy;../bmd380_sdk/components/libraries/experimental_section_vars;../bmd380_sdk/components/libraries/strerror;../bmd380_sdk/external/freertos/source/include;../bmd380_sdk/components/softdevice/common;../bmd380_sdk/components/ble/common;../bmd380_sdk/components/ble/ble_advertising;../bmd380_sdk/components/libraries/atomic_flags;../bmd380_sdk/components/ble/ble_db_discovery;../bmd380_sdk/components/ble/ble_dtm;../bmd380_sdk/components/ble/ble_link_ctx_manager;../bmd380_sdk/components/ble/ble_racp;../bmd380_sdk/components/ble/ble_radio_notification;../bmd380_sdk/components/ble/ble_services/ble_ancs_c;../bmd380_sdk/components/ble/ble_services/ble_ans_c;../bmd380_sdk/components/ble/ble_services/ble_bas;../bmd380_sdk/components/ble/ble_services/ble_bas_c;../bmd380_sdk/components/ble/ble_services/ble_bps;../bmd380_sdk/components/ble/ble_services/ble_cscs;../bmd380_sdk/components/ble/ble_services/ble_cts_c;../bmd380_sdk/components/ble/ble_services/ble_dfu;../bmd380_sdk/components/ble/ble_services/ble_dis;../bmd380_sdk/components/ble/ble_services/ble_dis_c;../bmd380_sdk/components/ble/ble_services/ble_escs;../bmd380_sdk/components/ble/ble_services/ble_gls;../bmd380_sdk/components/ble/ble_services/ble_hids;../bmd380_sdk/components/ble/ble_services/ble_hrs;../bmd380_sdk/components/ble/ble_services/ble_hrs_c;../bmd380_sdk/components/ble/ble_services/ble_hts;../bmd380_sdk/components/ble/ble_services/ble_ias;../bmd380_sdk/components/ble/ble_services/ble_ias_c;../bmd380_sdk/components/ble/ble_services/ble_ipsp;../bmd380_sdk/components/ble/ble_services/ble_lbs;../bmd380_sdk/components/ble/ble_services/ble_lbs_c;../bmd380_sdk/components/ble/ble_services/ble_lls;../bmd380_sdk/components/ble/ble_services/ble_nus;../bmd380_sdk/components/ble/ble_services/ble_nus_c;../bmd380_sdk/components/ble/ble_services/ble_rscs;../bmd380_sdk/components/ble/ble_services/ble_rscs_c;../bmd380_sdk/components/ble/ble_services/ble_tps;../bmd380_sdk/components/ble/ble_services/eddystone;../bmd380_sdk/components/ble/ble_services/experimental_ble_lns;../bmd380_sdk/components/ble/ble_services/experimental_ble_ots;../bmd380_sdk/components/ble/ble_services/experimental_gatts_c;../bmd380_sdk/components/ble/ble_services/experimental_nrf_ble_cgms;../bmd380_sdk/components/ble/ble_services/experimental_nrf_ble_ots_c;../bmd380_sdk/components/ble/ble_services/nrf_ble_bms;../bmd380_sdk/components/ble/nrf_ble_gatt;../bmd380_sdk/components/ble/nrf_ble_gq;../bmd380_sdk/components/ble/nrf_ble_qwr;../bmd380_sdk/components/ble/nrf_ble_scan;../bmd380_sdk/components/ble/peer_manager;%(ClCompile.AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>.;../bmd380_sdk/components/softdevice/s140/headers;../bmd380_sdk/components/softdevice/s140/headers/nrf52;../bmd380_sdk/external/segger_rtt;../bmd380_sdk/components/libraries/log;../bmd380_sdk/components/libraries/log/src;../bmd380_sdk/components/libraries/memobj;../bmd380_sdk/components/libraries/ringbuf;../bmd380_sdk/components/libraries/atomic;../bmd380_sdk/components/libraries/balloc;../bmd380_sdk/external/freertos/portable/CMSIS/nrf52;../bmd380_sdk/external/freertos/portable/GCC/nrf52;../bmd380_sdk/integration/nrfx;../bmd380_sdk/integration/nrfx/legacy;../bmd380_sdk/components/libraries/experimental_section_vars;../bmd380_sdk/components/libraries/strerror;../bmd380_sdk/external/freertos/source/include;../bmd380_sdk/components/softdevice/common;../bmd380_sdk/components/ble/common;../bmd380_sdk/components/ble/ble_advertising;../bmd380_sdk/components/libraries/atomic_flags;../bmd380_sdk/components/ble/ble_db_discovery;../bmd380_sdk/components/ble/ble_dtm;../bmd380_sdk/components/ble/ble_link_ctx_manager;../bmd380_sdk/components/ble/ble_racp;../bmd380_sdk/components/ble/ble_radio_notification;../bmd380_sdk/components/ble/ble_services/ble_ancs_c;../bmd380_sdk/components/ble/ble_services/ble_ans_c;../bmd380_sdk/components/ble/ble_services/ble_bas;../bmd380_sdk/components/ble/ble_services/ble_bas_c;../bmd380_sdk/components/ble/ble_services/ble_bps;../bmd380_sdk/components/ble/ble_services/ble_cscs;../bmd380_sdk/components/ble/ble_services/ble_cts_c;../bmd380_sdk/components/ble/ble_services/ble_dfu;../bmd380_sdk/components/ble/ble_services/ble_dis;../bmd380_sdk/components/ble/ble_services/ble_dis_c;../bmd380_sdk/components/ble/ble_services/ble_escs;../bmd380_sdk/components/ble/ble_services/ble_gls;../bmd380_sdk/components/ble/ble_services/ble_hids;../bmd380_sdk/components/ble/ble_services/ble_hrs;../bmd380_sdk/components/ble/ble_services/ble_hrs_c;../bmd380_sdk/components/ble/ble_services/ble_hts;../bmd380_sdk/components/ble/ble_services/ble_ias;../bmd380_sdk/components/ble/ble_services/ble_ias_c;../bmd380_sdk/components/ble/ble_services/ble_ipsp;../bmd380_sdk/components/ble/ble_services/ble_lbs;../bmd380_sdk/components/ble/ble_services/ble_lbs_c;../bmd380_sdk/components/ble/ble_services/ble_lls;../bmd380_sdk/components/ble/ble_services/ble_nus;../bmd380_sdk/components/ble/ble_services/ble_nus_c;../bmd380_sdk/components/ble/ble_services/ble_rscs;../bmd380_sdk/components/ble/ble_services/ble_rscs_c;../bmd380_sdk/components/ble/ble_services/ble_tps;../bmd380_sdk/components/ble/ble_services/eddystone;../bmd380_sdk/components/ble/ble_services/experimental_ble_lns;../bmd380_sdk/components/ble/ble_services/experimental_ble_ots;../bmd380_sdk/components/ble/ble_services/experimental_gatts_c;../bmd380_sdk/components/ble/ble_services/experimental_nrf_ble_cgms;../bmd380_sdk/components/ble/ble_services/experimental_nrf_ble_ots_c;../bmd380_sdk/components/ble/ble_services/nrf_ble_bms;../bmd380_sdk/components/ble/nrf_ble_gatt;../bmd380_sdk/components/ble/nrf_ble_gq;../bmd380_sdk/components/ble/nrf_ble_qwr;../bmd380_sdk/components/ble/nrf_ble_scan;../bmd380_sdk/components/ble/peer_manager;../bmd380_sdk/components/libraries/pwr_mgmt;%(ClCompile.AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>DEBUG=1;USE_APP_CONFIG=1;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>DEBUG=1;USE_APP_CONFIG=1;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalOptions /> <AdditionalOptions />
<CPPLanguageStandard /> <CPPLanguageStandard />
@@ -54,14 +54,22 @@
<AdditionalLinkerInputs>%(Link.AdditionalLinkerInputs)</AdditionalLinkerInputs> <AdditionalLinkerInputs>%(Link.AdditionalLinkerInputs)</AdditionalLinkerInputs>
<LibrarySearchDirectories>%(Link.LibrarySearchDirectories)</LibrarySearchDirectories> <LibrarySearchDirectories>%(Link.LibrarySearchDirectories)</LibrarySearchDirectories>
<AdditionalLibraryNames>%(Link.AdditionalLibraryNames)</AdditionalLibraryNames> <AdditionalLibraryNames>%(Link.AdditionalLibraryNames)</AdditionalLibraryNames>
<LinkerScript>nRF52811_XXAA_s140.lds</LinkerScript> <LinkerScript>nRF52840_XXAA_S140_reserve.lds</LinkerScript>
<AdditionalOptions /> <AdditionalOptions />
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|VisualGDB'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|VisualGDB'">
<ClCompile> <ClCompile>
<CLanguageStandard>GNU99</CLanguageStandard> <CLanguageStandard>GNU99</CLanguageStandard>
<AdditionalIncludeDirectories>.;../bmd380_sdk/components/softdevice/s140/headers;../bmd380_sdk/components/softdevice/s140/headers/nrf52;../bmd380_sdk/external/segger_rtt;../bmd380_sdk/components/libraries/log;../bmd380_sdk/components/libraries/log/src;../bmd380_sdk/components/libraries/memobj;../bmd380_sdk/components/libraries/ringbuf;../bmd380_sdk/components/libraries/atomic;../bmd380_sdk/components/libraries/balloc;../bmd380_sdk/external/freertos/portable/CMSIS/nrf52;../bmd380_sdk/external/freertos/portable/GCC/nrf52;../bmd380_sdk/integration/nrfx;../bmd380_sdk/integration/nrfx/legacy;../bmd380_sdk/components/libraries/experimental_section_vars;../bmd380_sdk/components/libraries/strerror;../bmd380_sdk/external/freertos/source/include;../bmd380_sdk/components/softdevice/common;../bmd380_sdk/components/ble/common;../bmd380_sdk/components/ble/ble_advertising;../bmd380_sdk/components/libraries/atomic_flags;../bmd380_sdk/components/ble/ble_db_discovery;../bmd380_sdk/components/ble/ble_dtm;../bmd380_sdk/components/ble/ble_link_ctx_manager;../bmd380_sdk/components/ble/ble_racp;../bmd380_sdk/components/ble/ble_radio_notification;../bmd380_sdk/components/ble/ble_services/ble_ancs_c;../bmd380_sdk/components/ble/ble_services/ble_ans_c;../bmd380_sdk/components/ble/ble_services/ble_bas;../bmd380_sdk/components/ble/ble_services/ble_bas_c;../bmd380_sdk/components/ble/ble_services/ble_bps;../bmd380_sdk/components/ble/ble_services/ble_cscs;../bmd380_sdk/components/ble/ble_services/ble_cts_c;../bmd380_sdk/components/ble/ble_services/ble_dfu;../bmd380_sdk/components/ble/ble_services/ble_dis;../bmd380_sdk/components/ble/ble_services/ble_dis_c;../bmd380_sdk/components/ble/ble_services/ble_escs;../bmd380_sdk/components/ble/ble_services/ble_gls;../bmd380_sdk/components/ble/ble_services/ble_hids;../bmd380_sdk/components/ble/ble_services/ble_hrs;../bmd380_sdk/components/ble/ble_services/ble_hrs_c;../bmd380_sdk/components/ble/ble_services/ble_hts;../bmd380_sdk/components/ble/ble_services/ble_ias;../bmd380_sdk/components/ble/ble_services/ble_ias_c;../bmd380_sdk/components/ble/ble_services/ble_ipsp;../bmd380_sdk/components/ble/ble_services/ble_lbs;../bmd380_sdk/components/ble/ble_services/ble_lbs_c;../bmd380_sdk/components/ble/ble_services/ble_lls;../bmd380_sdk/components/ble/ble_services/ble_nus;../bmd380_sdk/components/ble/ble_services/ble_nus_c;../bmd380_sdk/components/ble/ble_services/ble_rscs;../bmd380_sdk/components/ble/ble_services/ble_rscs_c;../bmd380_sdk/components/ble/ble_services/ble_tps;../bmd380_sdk/components/ble/ble_services/eddystone;../bmd380_sdk/components/ble/ble_services/experimental_ble_lns;../bmd380_sdk/components/ble/ble_services/experimental_ble_ots;../bmd380_sdk/components/ble/ble_services/experimental_gatts_c;../bmd380_sdk/components/ble/ble_services/experimental_nrf_ble_cgms;../bmd380_sdk/components/ble/ble_services/experimental_nrf_ble_ots_c;../bmd380_sdk/components/ble/ble_services/nrf_ble_bms;../bmd380_sdk/components/ble/nrf_ble_gatt;../bmd380_sdk/components/ble/nrf_ble_gq;../bmd380_sdk/components/ble/nrf_ble_qwr;../bmd380_sdk/components/ble/nrf_ble_scan;../bmd380_sdk/components/ble/peer_manager;%(ClCompile.AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG=1;RELEASE=1;USE_APP_CONFIG=1;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link>
<AdditionalLinkerInputs>;%(Link.AdditionalLinkerInputs)</AdditionalLinkerInputs>
<LibrarySearchDirectories>;%(Link.LibrarySearchDirectories)</LibrarySearchDirectories>
<AdditionalLibraryNames>;%(Link.AdditionalLibraryNames)</AdditionalLibraryNames>
<LinkerScript>nRF52840_XXAA_S140_reserve.lds</LinkerScript>
</Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<Text Include="..\bmd380_sdk\external\freertos\license\license.txt" /> <Text Include="..\bmd380_sdk\external\freertos\license\license.txt" />
@@ -74,6 +82,8 @@
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\bmd380_sdk\components\ble\ble_services\ble_dfu\ble_dfu.c" />
<ClCompile Include="..\bmd380_sdk\components\ble\ble_services\ble_dfu\ble_dfu_unbonded.c" />
<ClCompile Include="..\bmd380_sdk\components\ble\ble_services\ble_dis\ble_dis.c" /> <ClCompile Include="..\bmd380_sdk\components\ble\ble_services\ble_dis\ble_dis.c" />
<ClCompile Include="..\bmd380_sdk\components\ble\nrf_ble_gatt\nrf_ble_gatt.c" /> <ClCompile Include="..\bmd380_sdk\components\ble\nrf_ble_gatt\nrf_ble_gatt.c" />
<ClCompile Include="..\bmd380_sdk\components\libraries\atomic\nrf_atomic.c" /> <ClCompile Include="..\bmd380_sdk\components\libraries\atomic\nrf_atomic.c" />
@@ -88,6 +98,7 @@
<ClCompile Include="..\bmd380_sdk\components\libraries\log\src\nrf_log_frontend.c" /> <ClCompile Include="..\bmd380_sdk\components\libraries\log\src\nrf_log_frontend.c" />
<ClCompile Include="..\bmd380_sdk\components\libraries\log\src\nrf_log_str_formatter.c" /> <ClCompile Include="..\bmd380_sdk\components\libraries\log\src\nrf_log_str_formatter.c" />
<ClCompile Include="..\bmd380_sdk\components\libraries\memobj\nrf_memobj.c" /> <ClCompile Include="..\bmd380_sdk\components\libraries\memobj\nrf_memobj.c" />
<ClCompile Include="..\bmd380_sdk\components\libraries\pwr_mgmt\nrf_pwr_mgmt.c" />
<ClCompile Include="..\bmd380_sdk\components\libraries\ringbuf\nrf_ringbuf.c" /> <ClCompile Include="..\bmd380_sdk\components\libraries\ringbuf\nrf_ringbuf.c" />
<ClCompile Include="..\bmd380_sdk\components\libraries\strerror\nrf_strerror.c" /> <ClCompile Include="..\bmd380_sdk\components\libraries\strerror\nrf_strerror.c" />
<ClCompile Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh.c"> <ClCompile Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh.c">
@@ -113,21 +124,27 @@
<ClCompile Include="..\bmd380_sdk\external\freertos\source\list.c" /> <ClCompile Include="..\bmd380_sdk\external\freertos\source\list.c" />
<ClCompile Include="..\bmd380_sdk\external\freertos\source\portable\Common\mpu_wrappers.c"> <ClCompile Include="..\bmd380_sdk\external\freertos\source\portable\Common\mpu_wrappers.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|VisualGDB'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="..\bmd380_sdk\external\freertos\source\portable\MemMang\heap_1.c"> <ClCompile Include="..\bmd380_sdk\external\freertos\source\portable\MemMang\heap_1.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|VisualGDB'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="..\bmd380_sdk\external\freertos\source\portable\MemMang\heap_2.c"> <ClCompile Include="..\bmd380_sdk\external\freertos\source\portable\MemMang\heap_2.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|VisualGDB'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="..\bmd380_sdk\external\freertos\source\portable\MemMang\heap_3.c"> <ClCompile Include="..\bmd380_sdk\external\freertos\source\portable\MemMang\heap_3.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|VisualGDB'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="..\bmd380_sdk\external\freertos\source\portable\MemMang\heap_4.c"> <ClCompile Include="..\bmd380_sdk\external\freertos\source\portable\MemMang\heap_4.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">false</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|VisualGDB'">false</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="..\bmd380_sdk\external\freertos\source\portable\MemMang\heap_5.c"> <ClCompile Include="..\bmd380_sdk\external\freertos\source\portable\MemMang\heap_5.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|VisualGDB'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="..\bmd380_sdk\external\freertos\source\queue.c" /> <ClCompile Include="..\bmd380_sdk\external\freertos\source\queue.c" />
<ClCompile Include="..\bmd380_sdk\external\freertos\source\stream_buffer.c" /> <ClCompile Include="..\bmd380_sdk\external\freertos\source\stream_buffer.c" />
@@ -161,8 +178,10 @@
<ClCompile Include="..\bmd380_sdk\integration\nrfx\legacy\nrf_drv_uart.c"> <ClCompile Include="..\bmd380_sdk\integration\nrfx\legacy\nrf_drv_uart.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="eis_regular_data.c" />
<ClCompile Include="le_adv.c" /> <ClCompile Include="le_adv.c" />
<ClCompile Include="le_bas.c" /> <ClCompile Include="le_dfu.c" />
<ClCompile Include="le_eis_srv.c" />
<ClCompile Include="le_gap.c" /> <ClCompile Include="le_gap.c" />
<ClCompile Include="le_gatt.c" /> <ClCompile Include="le_gatt.c" />
<ClCompile Include="le_srv.c" /> <ClCompile Include="le_srv.c" />
@@ -226,6 +245,7 @@
<ClCompile Include="$(BSP_ROOT)\nRF5x\modules\nrfx\hal\nrf_ecb.c" /> <ClCompile Include="$(BSP_ROOT)\nRF5x\modules\nrfx\hal\nrf_ecb.c" />
<ClCompile Include="$(BSP_ROOT)\nRF5x\modules\nrfx\hal\nrf_nvmc.c" /> <ClCompile Include="$(BSP_ROOT)\nRF5x\modules\nrfx\hal\nrf_nvmc.c" />
<ClCompile Include="$(BSP_ROOT)\nRF5x\modules\nrfx\soc\nrfx_atomic.c" /> <ClCompile Include="$(BSP_ROOT)\nRF5x\modules\nrfx\soc\nrfx_atomic.c" />
<ClInclude Include="..\bmd380_sdk\components\ble\ble_services\ble_dfu\ble_dfu.h" />
<ClInclude Include="..\bmd380_sdk\components\ble\ble_services\ble_dis\ble_dis.h" /> <ClInclude Include="..\bmd380_sdk\components\ble\ble_services\ble_dis\ble_dis.h" />
<ClInclude Include="..\bmd380_sdk\components\ble\nrf_ble_gatt\nrf_ble_gatt.h" /> <ClInclude Include="..\bmd380_sdk\components\ble\nrf_ble_gatt\nrf_ble_gatt.h" />
<ClInclude Include="..\bmd380_sdk\components\libraries\atomic\nrf_atomic.h" /> <ClInclude Include="..\bmd380_sdk\components\libraries\atomic\nrf_atomic.h" />
@@ -249,6 +269,7 @@
<ClInclude Include="..\bmd380_sdk\components\libraries\log\src\nrf_log_ctrl_internal.h" /> <ClInclude Include="..\bmd380_sdk\components\libraries\log\src\nrf_log_ctrl_internal.h" />
<ClInclude Include="..\bmd380_sdk\components\libraries\log\src\nrf_log_internal.h" /> <ClInclude Include="..\bmd380_sdk\components\libraries\log\src\nrf_log_internal.h" />
<ClInclude Include="..\bmd380_sdk\components\libraries\memobj\nrf_memobj.h" /> <ClInclude Include="..\bmd380_sdk\components\libraries\memobj\nrf_memobj.h" />
<ClInclude Include="..\bmd380_sdk\components\libraries\pwr_mgmt\nrf_pwr_mgmt.h" />
<ClInclude Include="..\bmd380_sdk\components\libraries\ringbuf\nrf_ringbuf.h" /> <ClInclude Include="..\bmd380_sdk\components\libraries\ringbuf\nrf_ringbuf.h" />
<ClInclude Include="..\bmd380_sdk\components\libraries\strerror\nrf_strerror.h" /> <ClInclude Include="..\bmd380_sdk\components\libraries\strerror\nrf_strerror.h" />
<ClInclude Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh.h" /> <ClInclude Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh.h" />
+48 -9
View File
@@ -250,6 +250,24 @@
<Filter Include="Header files\ble\ble_services\ble_dis"> <Filter Include="Header files\ble\ble_services\ble_dis">
<UniqueIdentifier>{e8688895-c809-46b5-a2ab-2bd49da33d45}</UniqueIdentifier> <UniqueIdentifier>{e8688895-c809-46b5-a2ab-2bd49da33d45}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Header files\atomic_flags">
<UniqueIdentifier>{104f5151-8aba-4322-889f-18db11a159d5}</UniqueIdentifier>
</Filter>
<Filter Include="Source files\atomic_flags">
<UniqueIdentifier>{8d9d4979-4f73-44d8-a1a3-2ffab500203f}</UniqueIdentifier>
</Filter>
<Filter Include="Header files\ble\ble_services\ble_dfu">
<UniqueIdentifier>{66efbcba-2f2c-4f6b-88b7-373adf4cac3c}</UniqueIdentifier>
</Filter>
<Filter Include="Source files\ble\ble_services\ble_dfu">
<UniqueIdentifier>{67ca4d15-7a65-482f-a7eb-a6f92d2e1bb4}</UniqueIdentifier>
</Filter>
<Filter Include="Source files\pwr_mgmt">
<UniqueIdentifier>{0dee1448-4304-4fc9-ae41-f733003a27bf}</UniqueIdentifier>
</Filter>
<Filter Include="Header files\pwr_mgmt">
<UniqueIdentifier>{9d008a9d-bd88-4a95-8bda-04ef32a7ce4b}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="main.c"> <ClCompile Include="main.c">
@@ -1338,12 +1356,6 @@
<ClInclude Include="..\bmd380_sdk\components\ble\common\ble_srv_common.h"> <ClInclude Include="..\bmd380_sdk\components\ble\common\ble_srv_common.h">
<Filter>Header files\ble\common</Filter> <Filter>Header files\ble\common</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\bmd380_sdk\components\libraries\atomic_flags\nrf_atflags.c">
<Filter>Source files</Filter>
</ClCompile>
<ClCompile Include="le_bas.c">
<Filter>Source files</Filter>
</ClCompile>
<ClCompile Include="le_gatt.c"> <ClCompile Include="le_gatt.c">
<Filter>Source files</Filter> <Filter>Source files</Filter>
</ClCompile> </ClCompile>
@@ -1356,6 +1368,27 @@
<ClCompile Include="le_srv.c"> <ClCompile Include="le_srv.c">
<Filter>Source files</Filter> <Filter>Source files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="le_eis_srv.c">
<Filter>Source files</Filter>
</ClCompile>
<ClCompile Include="..\bmd380_sdk\components\libraries\atomic_flags\nrf_atflags.c">
<Filter>Source files\atomic_flags</Filter>
</ClCompile>
<ClCompile Include="eis_regular_data.c">
<Filter>Source files</Filter>
</ClCompile>
<ClCompile Include="..\bmd380_sdk\components\ble\ble_services\ble_dfu\ble_dfu_unbonded.c">
<Filter>Source files\ble\ble_services\ble_dfu</Filter>
</ClCompile>
<ClCompile Include="..\bmd380_sdk\components\ble\ble_services\ble_dfu\ble_dfu.c">
<Filter>Source files\ble\ble_services\ble_dfu</Filter>
</ClCompile>
<ClCompile Include="..\bmd380_sdk\components\libraries\pwr_mgmt\nrf_pwr_mgmt.c">
<Filter>Source files\pwr_mgmt</Filter>
</ClCompile>
<ClCompile Include="le_dfu.c">
<Filter>Source files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="nRF52840_XXAA_S140_reserve.lds"> <None Include="nRF52840_XXAA_S140_reserve.lds">
@@ -1606,15 +1639,21 @@
<ClInclude Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh_soc.h"> <ClInclude Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh_soc.h">
<Filter>Header files\softdevice\common</Filter> <Filter>Header files\softdevice\common</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\bmd380_sdk\components\libraries\atomic_flags\nrf_atflags.h">
<Filter>Header files</Filter>
</ClInclude>
<ClInclude Include="..\bmd380_sdk\components\ble\nrf_ble_gatt\nrf_ble_gatt.h"> <ClInclude Include="..\bmd380_sdk\components\ble\nrf_ble_gatt\nrf_ble_gatt.h">
<Filter>Header files\ble\nrf_ble_gatt</Filter> <Filter>Header files\ble\nrf_ble_gatt</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\bmd380_sdk\components\ble\ble_services\ble_dis\ble_dis.h"> <ClInclude Include="..\bmd380_sdk\components\ble\ble_services\ble_dis\ble_dis.h">
<Filter>Header files\ble\ble_services\ble_dis</Filter> <Filter>Header files\ble\ble_services\ble_dis</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\bmd380_sdk\components\libraries\atomic_flags\nrf_atflags.h">
<Filter>Header files\atomic_flags</Filter>
</ClInclude>
<ClInclude Include="..\bmd380_sdk\components\ble\ble_services\ble_dfu\ble_dfu.h">
<Filter>Header files\ble\ble_services\ble_dfu</Filter>
</ClInclude>
<ClInclude Include="..\bmd380_sdk\components\libraries\pwr_mgmt\nrf_pwr_mgmt.h">
<Filter>Header files\pwr_mgmt</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Text Include="..\bmd380_sdk\external\segger_rtt\license\license.txt"> <Text Include="..\bmd380_sdk\external\segger_rtt\license\license.txt">
+261
View File
@@ -0,0 +1,261 @@
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C"
{
#endif
#include "app_config.h"
#include "apply_old_config.h"
#include "sdk_config.h"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
#include "nrf_sdh.h"
#include "nrf_sdh_ble.h"
#include "nrf_sdh_freertos.h"
#include "ble_srv_common.h"
#include "FreeRTOS.h"
#include "queue.h"
#include "semphr.h"
#include "task.h"
#ifdef __cplusplus
}
#endif
static QueueHandle_t regular_data_q = NULL;
static SemaphoreHandle_t regular_data_sem = NULL;
typedef struct __PACKED
{
uint32_t timestamp;
uint8_t id;
uint8_t type : 4;
uint8_t : 4;
union
{
double double_val;
float flaot_val;
uint64_t u64_val;
uint32_t u32_val;
uint16_t u16_val;
uint8_t u8_val;
int64_t i64_val;
int32_t i32_val;
int16_t i16_val;
int8_t i8_val;
} content;
uint8_t padding[2];
} channel_data_t;
#define REGULAR_I8_TYPE 0
#define REGULAR_I16_TYPE 1
#define REGULAR_I32_TYPE 2
#define REGULAR_I64_TYPE 3
#define REGULAR_U8_TYPE 4
#define REGULAR_U16_TYPE 5
#define REGULAR_U32_TYPE 6
#define REGULAR_U64_TYPE 7
#define REGULAR_FLOAT_TYPE 8
#define REGULAR_DOUBLE_TYPE 9
#define REGULAR_MAX_TYPE 10
const uint32_t channel_size_table[REGULAR_MAX_TYPE] = {
[REGULAR_I8_TYPE] = offsetof(channel_data_t, content) + sizeof(int8_t),
[REGULAR_I16_TYPE] = offsetof(channel_data_t, content) + sizeof(int16_t),
[REGULAR_I32_TYPE] = offsetof(channel_data_t, content) + sizeof(int32_t),
[REGULAR_I64_TYPE] = offsetof(channel_data_t, content) + sizeof(int64_t),
[REGULAR_U8_TYPE] = offsetof(channel_data_t, content) + sizeof(uint8_t),
[REGULAR_U16_TYPE] = offsetof(channel_data_t, content) + sizeof(uint16_t),
[REGULAR_U32_TYPE] = offsetof(channel_data_t, content) + sizeof(uint32_t),
[REGULAR_U64_TYPE] = offsetof(channel_data_t, content) + sizeof(uint64_t),
[REGULAR_FLOAT_TYPE] = offsetof(channel_data_t, content) + sizeof(float),
[REGULAR_DOUBLE_TYPE] = offsetof(channel_data_t, content) + sizeof(double),
};
void pseudo_sensorAA_read(channel_data_t *p_channel_data)
{
static uint32_t val = 0;
p_channel_data->timestamp = xTaskGetTickCount();
p_channel_data->id = 0xAA;
p_channel_data->type = REGULAR_U32_TYPE;
p_channel_data->content.u32_val = val++;
}
void pseudo_sensorBB_read(channel_data_t *p_channel_data)
{
static uint32_t val = 0;
p_channel_data->timestamp = xTaskGetTickCount();
p_channel_data->id = 0xBB;
p_channel_data->type = REGULAR_U32_TYPE;
p_channel_data->content.u32_val = val--;
}
static void pseudo_data_task(void *pArg)
{
void (*pfCallback)(channel_data_t *p_channel_data) = pArg;
for (;;)
{
channel_data_t ch_data;
memset(&ch_data, 0x00, sizeof(ch_data));
pfCallback(&ch_data);
if (xQueueSend(regular_data_q, &ch_data, pdMS_TO_TICKS(50)) == pdFAIL)
{
__BKPT(255);
}
else
{
portYIELD();
}
}
}
static union
{
uint8_t raw[256];
struct __PACKED
{
uint8_t len;
uint8_t seq;
uint16_t : 16;
uint32_t time;
uint8_t channel_len; /* channel len => group length */
} header;
} payload;
static void regular_data_msg_task(void *pArg)
{
for (;;)
{
channel_data_t ch_data;
uint32_t offset = sizeof(payload.header);
/*
Receive a message on the regular_data_q queue.
Block for forever if a message is not immediately available.
*/
if (xQueueReceive(regular_data_q, &ch_data, portMAX_DELAY) == pdTRUE)
{
uint32_t channel_size = channel_size_table[ch_data.type % REGULAR_MAX_TYPE];
memcpy(&payload.raw[offset], &ch_data, channel_size);
offset += channel_size;
/* set channel len = 1 */
payload.header.channel_len = 1;
}
else
{
continue;
}
extern uint16_t le_gatt_mtu(void);
uint16_t att_mtu = le_gatt_mtu() - 3;
for (;;)
{
/*
Receive a message on the regular_data_q queue.
Block for 50ms if a message is not immediately available.
if there is no new message after 50ms, breaks out of the loop.
*/
if (xQueueReceive(regular_data_q, &ch_data, pdMS_TO_TICKS(50)) == pdTRUE)
{
/* set channel data total length. */
uint32_t channel_size = channel_size_table[ch_data.type % REGULAR_MAX_TYPE];
/* copy channel data to payload buffer. */
memcpy(&payload.raw[offset], &ch_data, channel_size);
offset += channel_size;
/* increase channel len */
payload.header.channel_len++;
/* if payload length is almost full, breaks out of the loop. */
if (offset > (att_mtu - (sizeof(ch_data) - 2) - 1))
{
break;
}
}
else
{
break;
}
}
extern bool le_regular_data_notify_is_enable(void);
if (le_regular_data_notify_is_enable())
{
extern ret_code_t le_regular_data_notify(uint8_t * p_value, uint16_t len);
/* update payload length & sequence number */
payload.header.len = offset + 1;
payload.header.seq++;
for (int i = 0; i < 3; i++)
{
/* update payload notify time */
payload.header.time = xTaskGetTickCount();
/* calculate checksum */
uint8_t chksum = 0;
for (uint32_t i = 0; i < offset; i++)
{
chksum += payload.raw[i];
}
/* append checksum */
payload.raw[offset] = chksum;
/* try to send notify */
ret_code_t err_code = le_regular_data_notify(payload.raw, offset + 1);
/* if notify success, breaks out of the loop. */
if (err_code == NRF_SUCCESS)
{
break;
}
/* if timeout, breaks out of the loop. */
if (xSemaphoreTake(regular_data_sem, pdMS_TO_TICKS(50)) == false)
{
NRF_LOG_INFO("regulat data underrun.");
break;
}
}
}
}
}
static void eis_regular_data_handler(ble_evt_t const *p_ble_evt, void *p_context)
{
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_CONNECTED:
payload.header.seq = 0xFF;
xQueueReset(regular_data_q);
break;
case BLE_GAP_EVT_DISCONNECTED:
break;
case BLE_GATTS_EVT_HVN_TX_COMPLETE:
xSemaphoreGive(regular_data_sem);
break;
default:
break;
}
}
void eis_regular_data_init(void)
{
regular_data_q = xQueueCreate(64, sizeof(channel_data_t));
if (regular_data_q == NULL)
{
// Will not get here unless there is insufficient RAM.
__BKPT(255);
}
regular_data_sem = xSemaphoreCreateBinary();
if (regular_data_sem == NULL)
{
// Will not get here unless there is insufficient RAM.
__BKPT(255);
}
xTaskCreate(regular_data_msg_task, "regular_msg", 192, NULL, 5, NULL);
xTaskCreate(pseudo_data_task, "pseudo_AA", 192, pseudo_sensorAA_read, 2, NULL);
xTaskCreate(pseudo_data_task, "pseudo_BB", 192, pseudo_sensorBB_read, 2, NULL);
NRF_SDH_BLE_OBSERVER(m_eis_regular_data_observer, 3, eis_regular_data_handler, NULL);
}
+1 -2
View File
@@ -61,7 +61,6 @@ void le_adv_init(uint8_t ble_conn_cfg_tag)
ble_advertising_init_t init; ble_advertising_init_t init;
memset(&init, 0, sizeof(init)); memset(&init, 0, sizeof(init));
extern uint16_t bas_volt_read(void);
struct struct
{ {
const uint8_t company_code[5]; const uint8_t company_code[5];
@@ -70,7 +69,7 @@ void le_adv_init(uint8_t ble_conn_cfg_tag)
} __PACKED data = { } __PACKED data = {
.company_code = ELITE_COMPANY_CODE, .company_code = ELITE_COMPANY_CODE,
.hw_ver = ELITE_HW_VER, .hw_ver = ELITE_HW_VER,
.bat_volt = bas_volt_read(), .bat_volt = 100,
}; };
ble_advdata_manuf_data_t manuf_specific_data; ble_advdata_manuf_data_t manuf_specific_data;
-30
View File
@@ -1,30 +0,0 @@
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C"
{
#endif
#include "app_config.h"
#include "apply_old_config.h"
#include "sdk_config.h"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
#include "nrf_sdh.h"
#include "nrf_sdh_ble.h"
#include "nrf_sdh_freertos.h"
#include "ble_srv_common.h"
#ifdef __cplusplus
}
#endif
uint16_t bas_volt_read(void) {
return 3100;
}
+77
View File
@@ -0,0 +1,77 @@
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C"
{
#endif
#include "app_config.h"
#include "apply_old_config.h"
#include "sdk_config.h"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
#include "nrf_delay.h"
#include "nrf_gpio.h"
#include "nrf_sdh.h"
#include "nrf_sdh_ble.h"
#include "nrf_sdh_freertos.h"
#include "ble_conn_state.h"
#include "ble_dis.h"
#include "ble_dfu.h"
#include "nrf_ble_gatt.h"
#ifdef __cplusplus
}
#endif
static void le_dfu_evt_handler(ble_dfu_buttonless_evt_type_t event) {
switch (event) {
case BLE_DFU_EVT_BOOTLOADER_ENTER_PREPARE:
NRF_LOG_INFO("Device is preparing to enter bootloader mode.");
// Disconnect all other bonded devices that currently are connected.
// This is required to receive a service changed indication
// on bootup after a successful (or aborted) Device Firmware Update.
extern void le_gap_disconnect(uint16_t conn_handle, void * p_context);
uint32_t conn_count = ble_conn_state_for_each_connected(le_gap_disconnect, NULL);
NRF_LOG_INFO("Disconnected %d links.", conn_count);
break;
case BLE_DFU_EVT_BOOTLOADER_ENTER:
// YOUR_JOB: Write app-specific unwritten data to FLASH, control finalization of this
// by delaying reset by reporting false in app_shutdown_handler
NRF_LOG_INFO("Device will enter bootloader mode.");
break;
case BLE_DFU_EVT_BOOTLOADER_ENTER_FAILED:
NRF_LOG_ERROR("Request to enter bootloader mode failed asynchroneously.");
// YOUR_JOB: Take corrective measures to resolve the issue
// like calling APP_ERROR_CHECK to reset the device.
break;
case BLE_DFU_EVT_RESPONSE_SEND_ERROR:
NRF_LOG_ERROR("Request to send a response to client failed.");
// YOUR_JOB: Take corrective measures to resolve the issue
// like calling APP_ERROR_CHECK to reset the device.
APP_ERROR_CHECK(false);
break;
default:
NRF_LOG_ERROR("Unknown event from ble_dfu_buttonless.");
break;
}
}
void le_dfu_init(void) {
// ble dfu service
ble_dfu_buttonless_init_t dfus_init = { 0 };
dfus_init.evt_handler = le_dfu_evt_handler;
ret_code_t err_code = ble_dfu_buttonless_init(&dfus_init);
APP_ERROR_CHECK(err_code);
}
+290
View File
@@ -0,0 +1,290 @@
#include "sdk_common.h"
#if NRF_MODULE_ENABLED(BLE_EIS)
#include "app_error.h"
#include "ble_conn_state.h"
#include "ble_gatts.h"
#include "ble_srv_common.h"
#include "nrf_sdh_ble.h"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
#include <stdlib.h>
#include <string.h>
/**< Used vendor specific UUID. */
#define BLE_EIS_BASE_UUID \
{ \
{ \
0x4D, 0x3C, 0x56, 0x45, 0x12, 0x8B, 0x44, 0x1D, 0x8D, 0x6F, 0xC5, 0x95, 0x00, 0x00, 0x9B, 0xD8 \
} \
}
#define BLE_UUID_EIS_SERVICE 0x0001
#define BLE_UUID_EIS_REGULAR_DATA_CHAR 0x0002
#define BLE_UUID_EIS_LOW_FREQ_DATA_CHAR 0x0003
#define BLE_UUID_EIS_AUXILIARY_DATA_CHAR 0x0004
#define BLE_UUID_EIS_STATUS_CHAR 0x0005
#define BLE_UUID_EIS_EVENT_CHAR 0x0006
typedef struct
{
uint16_t conn_handle;
uint16_t service_handle;
ble_gatts_char_handles_t regular_data_handles;
ble_gatts_char_handles_t low_freq_data_handles;
ble_gatts_char_handles_t auxiliary_data_handles;
ble_gatts_char_handles_t status_handles;
ble_gatts_char_handles_t event_handles;
bool regular_data_notify_enable;
bool low_freq_data_notify_enable;
bool auxiliary_data_notify_enable;
bool status_notify_enable;
bool event_notify_enable;
} ble_eis_t;
typedef struct
{
uint16_t dummy;
} ble_eis_init_t;
static ble_eis_t ble_eis = {
.conn_handle = BLE_CONN_HANDLE_INVALID,
.regular_data_notify_enable = false,
.low_freq_data_notify_enable = false,
.auxiliary_data_notify_enable = false,
.status_notify_enable = false,
.event_notify_enable = false,
};
static void on_connect(ble_eis_t *p_eis, ble_evt_t const *p_ble_evt)
{
p_eis->conn_handle = p_ble_evt->evt.common_evt.conn_handle;
}
static void on_disconnect(ble_eis_t *p_eis, ble_evt_t const *p_ble_evt)
{
p_eis->conn_handle = BLE_CONN_HANDLE_INVALID;
p_eis->regular_data_notify_enable = false;
p_eis->low_freq_data_notify_enable = false;
p_eis->auxiliary_data_notify_enable = false;
p_eis->status_notify_enable = false;
p_eis->event_notify_enable = false;
}
static void eis_ccc_update(ble_eis_t *p_eis, ble_evt_t const *p_ble_evt)
{
ble_gatts_evt_write_t const *p_evt_write = &p_ble_evt->evt.gatts_evt.params.write;
if (p_evt_write->handle == p_eis->regular_data_handles.cccd_handle)
{
p_eis->regular_data_notify_enable = ble_srv_is_notification_enabled(p_evt_write->data);
NRF_LOG_INFO("regular_data_notify:%s", p_eis->regular_data_notify_enable ? "enable" : "disable");
return;
}
else if (p_evt_write->handle == p_eis->low_freq_data_handles.cccd_handle)
{
p_eis->low_freq_data_notify_enable = ble_srv_is_notification_enabled(p_evt_write->data);
NRF_LOG_INFO("low_freq_data_notify:%s", p_eis->low_freq_data_notify_enable ? "enable" : "disable");
return;
}
else if (p_evt_write->handle == p_eis->auxiliary_data_handles.cccd_handle)
{
p_eis->auxiliary_data_notify_enable = ble_srv_is_notification_enabled(p_evt_write->data);
NRF_LOG_INFO("auxiliary_data_notify:%s", p_eis->auxiliary_data_notify_enable ? "enable" : "disable");
return;
}
else if (p_evt_write->handle == p_eis->status_handles.cccd_handle)
{
p_eis->status_notify_enable = ble_srv_is_notification_enabled(p_evt_write->data);
NRF_LOG_INFO("status_notify:%s", p_eis->status_notify_enable ? "enable" : "disable");
return;
}
else if (p_evt_write->handle == p_eis->event_handles.cccd_handle)
{
p_eis->event_notify_enable = ble_srv_is_notification_enabled(p_evt_write->data);
NRF_LOG_INFO("event_notify:%s", p_eis->event_notify_enable ? "enable" : "disable");
return;
}
}
static void on_write(ble_eis_t *p_eis, ble_evt_t const *p_ble_evt)
{
ble_uuid_t uuid = p_ble_evt->evt.gatts_evt.params.write.uuid;
switch (uuid.uuid)
{
case BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG:
eis_ccc_update(p_eis, p_ble_evt);
break;
case BLE_UUID_CHARACTERISTIC:
break;
default:
break;
}
}
static void on_hvx_tx_complete(ble_eis_t *p_eis, ble_evt_t const *p_ble_evt)
{
}
static void ble_eis_evt_handler(ble_evt_t const *p_ble_evt, void *p_context)
{
ble_eis_t *p_eis = (ble_eis_t *)p_context;
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_CONNECTED:
on_connect(p_eis, p_ble_evt);
break;
case BLE_GAP_EVT_DISCONNECTED:
on_disconnect(p_eis, p_ble_evt);
break;
case BLE_GATTS_EVT_WRITE:
on_write(p_eis, p_ble_evt);
break;
case BLE_GATTS_EVT_HVN_TX_COMPLETE:
on_hvx_tx_complete(p_eis, p_ble_evt);
break;
default:
// No implementation needed.
break;
}
}
static ret_code_t add_characteristic(uint16_t uuid, uint8_t uuid_type, uint32_t val_len, void *p_val, ble_gatts_char_handles_t *p_handles)
{
ble_add_char_params_t add_char_params;
memset(&add_char_params, 0, sizeof(add_char_params));
add_char_params.uuid = uuid;
add_char_params.uuid_type = uuid_type;
add_char_params.max_len = val_len;
add_char_params.init_len = 0;
add_char_params.p_init_value = p_val;
add_char_params.is_value_user = false;
add_char_params.is_var_len = true;
add_char_params.char_props.read = 1;
add_char_params.char_props.notify = 1;
add_char_params.read_access = SEC_OPEN;
add_char_params.cccd_write_access = SEC_OPEN;
ret_code_t err_code = characteristic_add(ble_eis.service_handle, &add_char_params, p_handles);
return err_code;
}
static uint32_t ble_eis_init(ble_eis_init_t const *p_eis_init)
{
ret_code_t err_code;
ble_uuid128_t base_uuid = BLE_EIS_BASE_UUID;
ble_uuid_t ble_uuid = {
.type = BLE_UUID_TYPE_UNKNOWN,
.uuid = BLE_UUID_EIS_SERVICE,
};
// Adding vendor specific UUID to the SoftDevice
err_code = sd_ble_uuid_vs_add(&base_uuid, &ble_uuid.type);
APP_ERROR_CHECK(err_code);
// Adding proprietary service to the SoftDevice
err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &ble_eis.service_handle);
APP_ERROR_CHECK(err_code);
// Adding regular data characteristic to the SoftDevice
err_code = add_characteristic(BLE_UUID_EIS_REGULAR_DATA_CHAR,
ble_uuid.type,
NRF_SDH_BLE_GATT_MAX_MTU_SIZE - 3,
NULL,
&ble_eis.regular_data_handles);
APP_ERROR_CHECK(err_code);
// Adding low freq data characteristic to the SoftDevice
err_code = add_characteristic(BLE_UUID_EIS_LOW_FREQ_DATA_CHAR,
ble_uuid.type,
32,
NULL,
&ble_eis.low_freq_data_handles);
APP_ERROR_CHECK(err_code);
// Adding auxiliary data characteristic to the SoftDevice
err_code = add_characteristic(BLE_UUID_EIS_AUXILIARY_DATA_CHAR,
ble_uuid.type,
32,
NULL,
&ble_eis.auxiliary_data_handles);
APP_ERROR_CHECK(err_code);
// Adding status characteristic to the SoftDevice
err_code = add_characteristic(BLE_UUID_EIS_STATUS_CHAR,
ble_uuid.type,
32,
NULL,
&ble_eis.status_handles);
APP_ERROR_CHECK(err_code);
// Adding event characteristic to the SoftDevice
err_code = add_characteristic(BLE_UUID_EIS_EVENT_CHAR,
ble_uuid.type,
32,
NULL,
&ble_eis.event_handles);
APP_ERROR_CHECK(err_code);
// Register a handler for BLE events.
NRF_SDH_BLE_OBSERVER(m_eis_observer, EIS_BLE_OBSERVER_PRIO, ble_eis_evt_handler, &ble_eis);
return NRF_SUCCESS;
}
void le_eis_init(void)
{
ble_eis_init_t eis_init;
memset(&eis_init, 0x00, sizeof(eis_init));
ret_code_t err_code = ble_eis_init(&eis_init);
APP_ERROR_CHECK(err_code);
extern void eis_regular_data_init(void);
eis_regular_data_init();
}
ret_code_t le_regular_data_notify(uint8_t *p_value, uint16_t len)
{
ret_code_t err_code = NRF_SUCCESS;
// update database.
ble_gatts_value_t gatts_value = {
.offset = 0,
.len = len,
.p_value = p_value,
};
err_code = sd_ble_gatts_value_set(BLE_CONN_HANDLE_INVALID, ble_eis.regular_data_handles.value_handle, &gatts_value);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
// send notify
if (ble_eis.regular_data_notify_enable)
{
ble_gatts_hvx_params_t hvx_params = {
.handle = ble_eis.regular_data_handles.value_handle,
.type = BLE_GATT_HVX_NOTIFICATION,
.offset = gatts_value.offset,
.p_len = &gatts_value.len,
.p_data = gatts_value.p_value,
};
if (ble_conn_state_status(ble_eis.conn_handle) == BLE_CONN_STATUS_CONNECTED)
{
err_code = sd_ble_gatts_hvx(ble_eis.conn_handle, &hvx_params);
}
}
return err_code;
}
bool le_regular_data_notify_is_enable(void)
{
return ble_eis.regular_data_notify_enable;
}
#endif // NRF_MODULE_ENABLED(BLE_EIS)
+21 -4
View File
@@ -14,6 +14,8 @@ extern "C"
#include "nrf_sdh.h" #include "nrf_sdh.h"
#include "nrf_sdh_ble.h" #include "nrf_sdh_ble.h"
#include "nrf_log.h"
#include "app_error.h" #include "app_error.h"
#ifdef __cplusplus #ifdef __cplusplus
@@ -40,11 +42,26 @@ void le_gap_init(const char *device_name, uint16_t usAppearance)
// Set GAP Peripheral Preferred Connection Parameters. // Set GAP Peripheral Preferred Connection Parameters.
ble_gap_conn_params_t gap_conn_params; ble_gap_conn_params_t gap_conn_params;
memset(&gap_conn_params, 0, sizeof(gap_conn_params)); memset(&gap_conn_params, 0, sizeof(gap_conn_params));
gap_conn_params.min_conn_interval = MSEC_TO_UNITS(8, UNIT_1_25_MS); /**< Minimum connection interval (7.5 ms) */ gap_conn_params.min_conn_interval = MSEC_TO_UNITS(8, UNIT_1_25_MS); /**< Minimum connection interval (7.5 ms) */
gap_conn_params.max_conn_interval = MSEC_TO_UNITS(40, UNIT_1_25_MS); /**< Maximum connection interval (40 ms). */ gap_conn_params.max_conn_interval = MSEC_TO_UNITS(20, UNIT_1_25_MS); /**< Maximum connection interval (20 ms). */
gap_conn_params.slave_latency = 16; /**< Slave latency. */ gap_conn_params.slave_latency = 8; /**< Slave latency. */
gap_conn_params.conn_sup_timeout = MSEC_TO_UNITS(5000, UNIT_10_MS); /**< Connection supervisory timeout (5000 ms). */ gap_conn_params.conn_sup_timeout = MSEC_TO_UNITS(10000, UNIT_10_MS); /**< Connection supervisory timeout (10s). */
err_code = sd_ble_gap_ppcp_set(&gap_conn_params); err_code = sd_ble_gap_ppcp_set(&gap_conn_params);
APP_ERROR_CHECK(err_code); APP_ERROR_CHECK(err_code);
} }
void le_gap_disconnect(uint16_t conn_handle, void * p_context)
{
UNUSED_PARAMETER(p_context);
ret_code_t err_code = sd_ble_gap_disconnect(conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
if (err_code != NRF_SUCCESS)
{
NRF_LOG_WARNING("Failed to disconnect connection. Connection handle: %d Error: %d", conn_handle, err_code);
}
else
{
NRF_LOG_DEBUG("Disconnected connection handle %d", conn_handle);
}
}
+7 -1
View File
@@ -29,7 +29,13 @@ extern "C"
#endif #endif
NRF_BLE_GATT_DEF(m_gatt); /**< GATT module instance. */ NRF_BLE_GATT_DEF(m_gatt); /**< GATT module instance. */
void le_gatt_init(void) { void le_gatt_init(void)
{
ret_code_t err_code = nrf_ble_gatt_init(&m_gatt, NULL); ret_code_t err_code = nrf_ble_gatt_init(&m_gatt, NULL);
APP_ERROR_CHECK(err_code); APP_ERROR_CHECK(err_code);
} }
uint16_t le_gatt_mtu(void)
{
return nrf_ble_gatt_eff_mtu_get(&m_gatt, 0);
}
+14 -5
View File
@@ -21,18 +21,21 @@ extern "C"
#include "nrf_sdh_ble.h" #include "nrf_sdh_ble.h"
#include "nrf_sdh_freertos.h" #include "nrf_sdh_freertos.h"
#include "ble_conn_state.h"
#include "ble_dis.h" #include "ble_dis.h"
#include "ble_dfu.h"
#include "nrf_ble_gatt.h" #include "nrf_ble_gatt.h"
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#define MANUFACTURER_NAME "MEMCHIP" /**< Manufacturer. Will be passed to Device Information Service. */ #define MANUFACTURER_NAME "MEMCHIP" /**< Manufacturer. Will be passed to Device Information Service. */
#define HW_REV STRINGIFY(MAJOR_PRODUCT_NUMBER) "." STRINGIFY(MINOR_PRODUCT_NUMBER) "." STRINGIFY(MAJOR_VERSION_NUMBER) "." STRINGIFY(MINOR_VERSION_NUMBER) #define HW_REV STRINGIFY(MAJOR_PRODUCT_NUMBER) "." STRINGIFY(MINOR_PRODUCT_NUMBER) "." STRINGIFY(MAJOR_VERSION_NUMBER) "." STRINGIFY(MINOR_VERSION_NUMBER)
#define FW_REV "0.1.0" #define FW_REV "0.1.0"
#define SER_NUM "0000-00-00-00001" #define SER_NUM "0000-00-00-00001"
#define MODULE_NAME ELITE_DEVICE_NAME #define MODULE_NAME ELITE_DEVICE_NAME
static void le_dis_init(void) static void le_dis_init(void)
{ {
@@ -53,4 +56,10 @@ static void le_dis_init(void)
void le_srv_init(void) void le_srv_init(void)
{ {
le_dis_init(); le_dis_init();
extern void le_dfu_init(void);
le_dfu_init();
extern void le_eis_init(void);
le_eis_init();
} }
+27 -38
View File
@@ -33,11 +33,29 @@ extern "C"
static void le_evt_handler(ble_evt_t const *p_ble_evt, void *p_context) static void le_evt_handler(ble_evt_t const *p_ble_evt, void *p_context)
{ {
ret_code_t err_code;
switch (p_ble_evt->header.evt_id) switch (p_ble_evt->header.evt_id)
{ {
ret_code_t err_code; case BLE_GAP_EVT_PHY_UPDATE:
NRF_LOG_INFO("PHY update procedure is complete.");
break;
case BLE_GAP_EVT_CONN_PARAM_UPDATE:
NRF_LOG_INFO("Connection parameters updated.");
break;
case BLE_GAP_EVT_CONNECTED: {
NRF_LOG_INFO("Connect to peer.");
err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_CONN, p_ble_evt->evt.gap_evt.conn_handle, 8);
APP_ERROR_CHECK(err_code);
}
break;
case BLE_GAP_EVT_DISCONNECTED: {
NRF_LOG_INFO("Disconnect from peer.");
err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, p_ble_evt->evt.gap_evt.conn_handle, 0);
APP_ERROR_CHECK(err_code);
}
break;
case BLE_GAP_EVT_PHY_UPDATE_REQUEST: { case BLE_GAP_EVT_PHY_UPDATE_REQUEST: {
NRF_LOG_DEBUG("PHY update request."); NRF_LOG_INFO("PHY update response. (AUTO)");
ble_gap_phys_t const phys = { ble_gap_phys_t const phys = {
.rx_phys = BLE_GAP_PHY_AUTO, .rx_phys = BLE_GAP_PHY_AUTO,
.tx_phys = BLE_GAP_PHY_AUTO, .tx_phys = BLE_GAP_PHY_AUTO,
@@ -46,6 +64,11 @@ static void le_evt_handler(ble_evt_t const *p_ble_evt, void *p_context)
APP_ERROR_CHECK(err_code); APP_ERROR_CHECK(err_code);
} }
break; break;
case BLE_GATTS_EVT_SYS_ATTR_MISSING: {
ret_code_t err_code = sd_ble_gatts_sys_attr_set(p_ble_evt->evt.gatts_evt.conn_handle, NULL, 0, 0);
APP_ERROR_CHECK(err_code);
}
break;
default: default:
break; break;
} }
@@ -58,7 +81,7 @@ static void le_stack_Init(void)
ble_cfg_t ble_cfg; ble_cfg_t ble_cfg;
memset(&ble_cfg, 0x00, sizeof(ble_cfg)); memset(&ble_cfg, 0x00, sizeof(ble_cfg));
ble_cfg.conn_cfg.conn_cfg_tag = APP_BLE_CONN_CFG_TAG; ble_cfg.conn_cfg.conn_cfg_tag = APP_BLE_CONN_CFG_TAG;
ble_cfg.conn_cfg.params.gatts_conn_cfg.hvn_tx_queue_size = 8; ble_cfg.conn_cfg.params.gatts_conn_cfg.hvn_tx_queue_size = 12;
err_code = nrf_sdh_enable_request(); err_code = nrf_sdh_enable_request();
APP_ERROR_CHECK(err_code); APP_ERROR_CHECK(err_code);
@@ -79,38 +102,6 @@ static void le_stack_Init(void)
NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, le_evt_handler, NULL); NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, le_evt_handler, NULL);
} }
void led1_task(void *pArg)
{
nrf_gpio_cfg_output(13);
for (;;)
{
NRF_LOG_INFO("led 1 off");
nrf_gpio_pin_set(13);
vTaskDelay(500);
NRF_LOG_INFO("led 1 on");
nrf_gpio_pin_clear(13);
vTaskDelay(500);
}
}
void led2_task(void *pArg)
{
nrf_gpio_cfg_output(14);
for (;;)
{
NRF_LOG_INFO("led 2 off");
nrf_gpio_pin_set(14);
vTaskDelay(125);
NRF_LOG_INFO("led 2 on");
nrf_gpio_pin_clear(14);
vTaskDelay(125);
}
}
int main(void) int main(void)
{ {
NRF_LOG_INIT(NULL, 0); NRF_LOG_INIT(NULL, 0);
@@ -133,13 +124,11 @@ int main(void)
nrf_sdh_freertos_init(NULL, NULL); nrf_sdh_freertos_init(NULL, NULL);
xTaskCreate(led1_task, "led1_task", 160, NULL, 3, NULL);
xTaskCreate(led2_task, "led2_task", 160, NULL, 3, NULL);
vTaskStartScheduler(); vTaskStartScheduler();
for (;;) for (;;)
{ {
// Will not get here unless there is insufficient RAM.
__BKPT(255); __BKPT(255);
} }
} }
+2 -2
View File
@@ -5,8 +5,8 @@ MEMORY
{ {
FLASH_SOFTDEVICE (rx) : ORIGIN = 0x00000000, LENGTH = 0x00027000 FLASH_SOFTDEVICE (rx) : ORIGIN = 0x00000000, LENGTH = 0x00027000
FLASH (rx) : ORIGIN = 0x00027000, LENGTH = 0x000d9000 FLASH (rx) : ORIGIN = 0x00027000, LENGTH = 0x000d9000
RAM_SOFTDEVICE (rwx) : ORIGIN = 0x20000000, LENGTH = 0x000079e0 RAM_SOFTDEVICE (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00018000
RAM (rwx) : ORIGIN = 0x200079e0, LENGTH = 0x00037620 RAM (rwx) : ORIGIN = 0x20018000, LENGTH = 0x00027000
RTT (rwx) : ORIGIN = 0x2003F000, LENGTH = 0x00001000 RTT (rwx) : ORIGIN = 0x2003F000, LENGTH = 0x00001000
CODE_RAM (rwx) : ORIGIN = 0x800000, LENGTH = 0x6000 CODE_RAM (rwx) : ORIGIN = 0x800000, LENGTH = 0x6000
} }
+4 -3
View File
@@ -2,9 +2,10 @@
MEMORY MEMORY
{ {
FLASH (rx) : ORIGIN = 0x00027000, LENGTH = 0x000d9000 FLASH (rx) : ORIGIN = 0x00027000, LENGTH = 0x000B7000
EXTFLASH (rx) : ORIGIN = 0x12000000, LENGTH = 0x8000000 RAM_SOFTDEVICE (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00010000
RAM (rwx) : ORIGIN = 0x200079e0, LENGTH = 0x00038620 RAM (rwx) : ORIGIN = 0x20010000, LENGTH = 0x0002F000
RTT (rwx) : ORIGIN = 0x2003F000, LENGTH = 0x00001000
CODE_RAM (rwx) : ORIGIN = 0x800000, LENGTH = 0x40000 CODE_RAM (rwx) : ORIGIN = 0x800000, LENGTH = 0x40000
} }
+2 -2
View File
@@ -2,8 +2,8 @@
<EmbeddedProfile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <EmbeddedProfile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ToolchainID>com.visualgdb.arm-eabi</ToolchainID> <ToolchainID>com.visualgdb.arm-eabi</ToolchainID>
<ToolchainVersion> <ToolchainVersion>
<GCC>10.3.1</GCC> <GCC>12.3.1</GCC>
<GDB>10.2.90</GDB> <GDB>13.2</GDB>
<Revision>1</Revision> <Revision>1</Revision>
</ToolchainVersion> </ToolchainVersion>
<BspID>com.sysprogs.arm.nordic.nrf5x</BspID> <BspID>com.sysprogs.arm.nordic.nrf5x</BspID>
+5
View File
@@ -0,0 +1,5 @@
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIEM6TVi/ofxCYEb2O9OYK4sNHlpwd0ZrW3yFOIeRJKqKoAoGCCqGSM49
AwEHoUQDQgAEYUIRVGOQwmOEfsuYSufu4hHxRsQSUzh9lMBkvc3ewrPkpbfiXfa/
vGyIM8HAY2Jemux9+FyFERXRjgj5RxOJAA==
-----END EC PRIVATE KEY-----
+73
View File
@@ -0,0 +1,73 @@
import asyncio
import os
import sys
import time
from io import BytesIO
from bleak import BleakClient
from bleak import _logger as logger
from bleak.uuids import uuid16_dict
os.chdir(os.path.dirname(os.path.realpath(__file__)))
REGULAR_UUID = "D89B0002-95C5-6F8D-1D44-8B1245563C4D"
target = 'raw1.bin'
f = open(target, 'wb')
f.truncate()
global IsFirstPacket
global TimeStart
global TimeStop
global TotalBytes
IsFirstPacket = True
TotalBytes = 0
def notification_handler(sender, data):
global IsFirstPacket
global TimeStart
global TimeStop
global TotalBytes
if IsFirstPacket :
TimeStart = time.time()
TimeStop = time.time()
IsFirstPacket = False
else :
TimeStop = time.time()
TotalBytes += len(data)
f.write(data)
if (TimeStop-TimeStart) > 0:
print("Throughput: {0} kbps ({1})".format(round((TotalBytes * 8 / 1024)/(TimeStop-TimeStart), 2),len(data)))
async def ble_notify_demo(mac_addr: str):
print("Connect to {0}".format(mac_addr))
client = BleakClient(mac_addr)
await client.connect()
IsConnected = await client.is_connected()
if IsConnected == False :
print("Connect fail.")
return False
print("Connect success.")
print("Wait 2 sec for PHY update procedure.")
await asyncio.sleep(2.0)
await client.start_notify(REGULAR_UUID, notification_handler)
# delay 10 sec
await asyncio.sleep(15)
await client.stop_notify(REGULAR_UUID)
await client.disconnect()
return True
mac_addr = "DF:4C:23:1C:F5:59"
mac_addr = "EB:E6:E0:52:26:ED"
mac_addr = "D8:96:4A:0B:14:4A"
mac_addr = "DC:05:1F:1F:71:DA"
if asyncio.run(ble_notify_demo(mac_addr)) == True :
print("Recv total: {0} bytes".format(TotalBytes))
f.close()
# 資料讀取 n秒會自動存檔,並用 hex editor 開啟
os.system('010Editor.exe ' + target) # open file with hex editor