Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4c615f0b3b | |||
| a8d9400624 | |||
| 6b4d87232a | |||
| 06a1b0d036 | |||
| c8a4a15b3d | |||
| 2f1a013dd4 | |||
| 4f0a383880 | |||
| a2653f7919 | |||
| 066b436762 | |||
| fdab23e151 | |||
| 386bc17007 | |||
| 8ed0921284 | |||
| 3e1d8bfedc | |||
| bb5bf77aa1 | |||
| 99482ff463 | |||
| adc92b10ac | |||
| d0d915d69e | |||
| 4894838edf | |||
| 811bcae588 | |||
| 6162d15791 | |||
| c358f20a8a | |||
| 60fb26518a | |||
| 672ccaaa02 | |||
| 2f708e0113 | |||
| 10aed00a1c | |||
| d0f90da1fd | |||
| da65b6ab49 | |||
| d114bac8f0 | |||
| f6ea58ce38 | |||
| 905cdfee4d | |||
| 0f7c3e9803 | |||
| 5246b2f867 | |||
| a69b875884 | |||
| 414c88aea2 | |||
| c8c8d6fe73 | |||
| 88d3e6c7c3 | |||
| d439f4d2ba |
+19
-19
@@ -56,25 +56,25 @@
|
||||
#define configTICK_SOURCE FREERTOS_USE_RTC
|
||||
|
||||
#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_SIMPLE_DEBUG 1 /* See into vPortSuppressTicksAndSleep source code for explanation */
|
||||
#define configCPU_CLOCK_HZ ( SystemCoreClock )
|
||||
#define configTICK_RATE_HZ 1024
|
||||
#define configMAX_PRIORITIES ( 5 )
|
||||
#define configMINIMAL_STACK_SIZE ( 160 )
|
||||
#define configTOTAL_HEAP_SIZE ( 8192 )
|
||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||
#define configMAX_PRIORITIES ( 6 )
|
||||
#define configMINIMAL_STACK_SIZE ( 192 )
|
||||
#define configTOTAL_HEAP_SIZE ( 32 * 1024 )
|
||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 0
|
||||
#define configUSE_ALTERNATIVE_API 0 /* Deprecated! */
|
||||
#define configQUEUE_REGISTRY_SIZE 2
|
||||
#define configUSE_QUEUE_SETS 0
|
||||
#define configUSE_TIME_SLICING 0
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#define configUSE_NEWLIB_REENTRANT 1
|
||||
#define configENABLE_BACKWARD_COMPATIBILITY 1
|
||||
|
||||
/* Hook function related definitions. */
|
||||
@@ -113,22 +113,22 @@
|
||||
#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 1
|
||||
|
||||
/* Optional functions - most linkers will remove unused functions anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskPrioritySet 0
|
||||
#define INCLUDE_uxTaskPriorityGet 0
|
||||
#define INCLUDE_vTaskDelete 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_xResumeFromISR 1
|
||||
#define INCLUDE_xResumeFromISR 0
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 1
|
||||
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1
|
||||
#define INCLUDE_pcTaskGetTaskName 1
|
||||
#define INCLUDE_eTaskGetState 1
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 0
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
|
||||
#define INCLUDE_pcTaskGetTaskName 0
|
||||
#define INCLUDE_eTaskGetState 0
|
||||
#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"
|
||||
function. */
|
||||
|
||||
+98
-3
@@ -7,9 +7,6 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
// DEVICE INFO
|
||||
#define DEVICE_NAME "xyz"
|
||||
|
||||
// LOG
|
||||
#define NRF_LOG_ENABLED 1
|
||||
#define NRF_LOG_DEFAULT_LEVEL 3
|
||||
@@ -83,6 +80,104 @@ extern "C"
|
||||
#define POWER_CONFIG_IRQ_PRIORITY 6
|
||||
#define CLOCK_CONFIG_IRQ_PRIORITY 6
|
||||
|
||||
// SoftDevice BLE event handler
|
||||
#define NRF_SDH_BLE_ENABLED 1
|
||||
// The number of vendor-specific UUIDs.
|
||||
#define NRF_SDH_BLE_VS_UUID_COUNT 2
|
||||
// Attribute Table size in bytes. The size must be a multiple of 4.
|
||||
#define NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE 1408
|
||||
// BLE Observers - Observers and priority levels
|
||||
#define NRF_SDH_BLE_OBSERVER_PRIO_LEVELS 4
|
||||
// Include the Service Changed characteristic in the Attribute Table.
|
||||
#define NRF_SDH_BLE_SERVICE_CHANGED 1
|
||||
|
||||
// This setting configures how Stack events are dispatched to the application.
|
||||
#define NRF_SDH_DISPATCH_MODEL 2 /* SoftDevice events are to be fetched manually. */
|
||||
|
||||
// BLE Observers priorities - Invididual priorities
|
||||
#define BLE_ADV_BLE_OBSERVER_PRIO 1
|
||||
#define BLE_CONN_PARAMS_BLE_OBSERVER_PRIO 1
|
||||
#define BLE_CONN_STATE_BLE_OBSERVER_PRIO 0
|
||||
|
||||
// Enable Advertising module
|
||||
#define BLE_ADVERTISING_ENABLED 1
|
||||
|
||||
// BLE device name
|
||||
#define DEF_ELITE_EDC_15RE 0x00020107
|
||||
#define DEF_ELITE_EDC_15R2 0x00020108
|
||||
#define DEF_ELITE_EIS_10 0x00040100
|
||||
#define DEF_ELITE_EIS_11 0x00040101
|
||||
#define DEF_ELITE_EIS_MINI_10 0x00040102
|
||||
#define DEF_ELITE_MODEL DEF_ELITE_EIS_11
|
||||
|
||||
#if (DEF_ELITE_MODEL == DEF_ELITE_EDC_15RE)
|
||||
#define ELITE_DEVICE_NAME "EDC"
|
||||
#define MAJOR_PRODUCT_NUMBER 0
|
||||
#define MINOR_PRODUCT_NUMBER 2
|
||||
#define MAJOR_VERSION_NUMBER 1
|
||||
#define MINOR_VERSION_NUMBER 7
|
||||
#elif (DEF_ELITE_MODEL == DEF_ELITE_EDC_15R2)
|
||||
#define ELITE_DEVICE_NAME "EDC"
|
||||
#define MAJOR_PRODUCT_NUMBER 0
|
||||
#define MINOR_PRODUCT_NUMBER 2
|
||||
#define MAJOR_VERSION_NUMBER 1
|
||||
#define MINOR_VERSION_NUMBER 8
|
||||
#elif (DEF_ELITE_MODEL == DEF_ELITE_EIS_10)
|
||||
#define ELITE_DEVICE_NAME "EIS"
|
||||
#define MAJOR_PRODUCT_NUMBER 0
|
||||
#define MINOR_PRODUCT_NUMBER 4
|
||||
#define MAJOR_VERSION_NUMBER 1
|
||||
#define MINOR_VERSION_NUMBER 0
|
||||
#define BLE_EIS_ENABLED 1
|
||||
#define EIS_BLE_OBSERVER_PRIO 3
|
||||
#elif (DEF_ELITE_MODEL == DEF_ELITE_EIS_11)
|
||||
#define ELITE_DEVICE_NAME "EIS"
|
||||
#define MAJOR_PRODUCT_NUMBER 0
|
||||
#define MINOR_PRODUCT_NUMBER 4
|
||||
#define MAJOR_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)
|
||||
#define ELITE_DEVICE_NAME "EIS"
|
||||
#define MAJOR_PRODUCT_NUMBER 0
|
||||
#define MINOR_PRODUCT_NUMBER 4
|
||||
#define MAJOR_VERSION_NUMBER 1
|
||||
#define MINOR_VERSION_NUMBER 2
|
||||
#endif
|
||||
|
||||
#define ELITE_COMPANY_CODE "Elite"
|
||||
#define ELITE_HW_VER \
|
||||
{ \
|
||||
MAJOR_PRODUCT_NUMBER, MINOR_PRODUCT_NUMBER, MAJOR_VERSION_NUMBER, MINOR_VERSION_NUMBER \
|
||||
}
|
||||
|
||||
// Maximum number of peripheral links.
|
||||
#define NRF_SDH_BLE_PERIPHERAL_LINK_COUNT 1
|
||||
// Maximum number of central links.
|
||||
#define NRF_SDH_BLE_CENTRAL_LINK_COUNT 0
|
||||
// Total link count.
|
||||
#define NRF_SDH_BLE_TOTAL_LINK_COUNT 1
|
||||
|
||||
// Enable GATT module.
|
||||
#define NRF_BLE_GATT_ENABLED 1
|
||||
// Priority with which BLE events are dispatched to the GATT module.
|
||||
#define NRF_BLE_GATT_BLE_OBSERVER_PRIO 1
|
||||
// Requested BLE GAP data length to be negotiated.
|
||||
#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.
|
||||
#define NRF_SDH_BLE_GAP_EVENT_LENGTH (0xFFFF)
|
||||
// Static maximum MTU size.
|
||||
#define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 247
|
||||
|
||||
// Enable ble device info module
|
||||
#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
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<ProjectFile>bmd380_peripheral.vcxproj</ProjectFile>
|
||||
<RemoteBuildEnvironment>
|
||||
<Records />
|
||||
<EnvironmentSetupFiles />
|
||||
</RemoteBuildEnvironment>
|
||||
<ParallelJobCount>1</ParallelJobCount>
|
||||
<SuppressDirectoryChangeMessages>true</SuppressDirectoryChangeMessages>
|
||||
@@ -33,7 +34,19 @@
|
||||
<CustomBuild>
|
||||
<PreSyncActions />
|
||||
<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 />
|
||||
<PostCleanActions />
|
||||
</CustomBuild>
|
||||
|
||||
@@ -32,36 +32,44 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">
|
||||
<GNUConfigurationType>Debug</GNUConfigurationType>
|
||||
<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>
|
||||
<MCUPropertyListFile>$(ProjectDir)nrf5x.props</MCUPropertyListFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|VisualGDB'">
|
||||
<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>
|
||||
<MCUPropertyListFile>$(ProjectDir)nrf5x.props</MCUPropertyListFile>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">
|
||||
<ClCompile>
|
||||
<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;%(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>
|
||||
<AdditionalOptions />
|
||||
<CPPLanguageStandard />
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLinkerInputs>;%(Link.AdditionalLinkerInputs)</AdditionalLinkerInputs>
|
||||
<LibrarySearchDirectories>;%(Link.LibrarySearchDirectories)</LibrarySearchDirectories>
|
||||
<AdditionalLibraryNames>;%(Link.AdditionalLibraryNames)</AdditionalLibraryNames>
|
||||
<LinkerScript>nRF52811_XXAA_s140.lds</LinkerScript>
|
||||
<AdditionalLinkerInputs>%(Link.AdditionalLinkerInputs)</AdditionalLinkerInputs>
|
||||
<LibrarySearchDirectories>%(Link.LibrarySearchDirectories)</LibrarySearchDirectories>
|
||||
<AdditionalLibraryNames>%(Link.AdditionalLibraryNames)</AdditionalLibraryNames>
|
||||
<LinkerScript>nRF52840_XXAA_S140_reserve.lds</LinkerScript>
|
||||
<AdditionalOptions />
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|VisualGDB'">
|
||||
<ClCompile>
|
||||
<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>
|
||||
<Link>
|
||||
<AdditionalLinkerInputs>;%(Link.AdditionalLinkerInputs)</AdditionalLinkerInputs>
|
||||
<LibrarySearchDirectories>;%(Link.LibrarySearchDirectories)</LibrarySearchDirectories>
|
||||
<AdditionalLibraryNames>;%(Link.AdditionalLibraryNames)</AdditionalLibraryNames>
|
||||
<LinkerScript>nRF52840_XXAA_S140_reserve.lds</LinkerScript>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\bmd380_sdk\external\freertos\license\license.txt" />
|
||||
@@ -74,7 +82,12 @@
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<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\nrf_ble_gatt\nrf_ble_gatt.c" />
|
||||
<ClCompile Include="..\bmd380_sdk\components\libraries\atomic\nrf_atomic.c" />
|
||||
<ClCompile Include="..\bmd380_sdk\components\libraries\atomic_flags\nrf_atflags.c" />
|
||||
<ClCompile Include="..\bmd380_sdk\components\libraries\balloc\nrf_balloc.c" />
|
||||
<ClCompile Include="..\bmd380_sdk\components\libraries\experimental_section_vars\nrf_section_iter.c" />
|
||||
<ClCompile Include="..\bmd380_sdk\components\libraries\log\src\nrf_log_backend_flash.c" />
|
||||
@@ -85,8 +98,24 @@
|
||||
<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\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\strerror\nrf_strerror.c" />
|
||||
<ClCompile Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh_ant.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh_ble.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh_freertos.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">false</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh_soc.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\external\freertos\portable\CMSIS\nrf52\port_cmsis.c" />
|
||||
<ClCompile Include="..\bmd380_sdk\external\freertos\portable\CMSIS\nrf52\port_cmsis_systick.c" />
|
||||
<ClCompile Include="..\bmd380_sdk\external\freertos\portable\GCC\nrf52\port.c" />
|
||||
@@ -95,21 +124,27 @@
|
||||
<ClCompile Include="..\bmd380_sdk\external\freertos\source\list.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)'=='Release|VisualGDB'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\external\freertos\source\portable\MemMang\heap_1.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|VisualGDB'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\external\freertos\source\portable\MemMang\heap_2.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|VisualGDB'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\external\freertos\source\portable\MemMang\heap_3.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|VisualGDB'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\external\freertos\source\portable\MemMang\heap_4.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|VisualGDB'">false</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\external\freertos\source\portable\MemMang\heap_5.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|VisualGDB'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\external\freertos\source\queue.c" />
|
||||
<ClCompile Include="..\bmd380_sdk\external\freertos\source\stream_buffer.c" />
|
||||
@@ -143,6 +178,13 @@
|
||||
<ClCompile Include="..\bmd380_sdk\integration\nrfx\legacy\nrf_drv_uart.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|VisualGDB'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="eis_regular_data.c" />
|
||||
<ClCompile Include="le_adv.c" />
|
||||
<ClCompile Include="le_dfu.c" />
|
||||
<ClCompile Include="le_eis_srv.c" />
|
||||
<ClCompile Include="le_gap.c" />
|
||||
<ClCompile Include="le_gatt.c" />
|
||||
<ClCompile Include="le_srv.c" />
|
||||
<ClCompile Include="main.c" />
|
||||
<None Include="nRF52811_XXAA_s140.lds" />
|
||||
<None Include="nRF52840_XXAA_S140_reserve.lds" />
|
||||
@@ -203,9 +245,13 @@
|
||||
<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\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\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_internal.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\libraries\atomic\nrf_atomic_sanity_check.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\libraries\atomic_flags\nrf_atflags.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\libraries\balloc\nrf_balloc.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\libraries\experimental_section_vars\nrf_section.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\libraries\experimental_section_vars\nrf_section_iter.h" />
|
||||
@@ -223,8 +269,14 @@
|
||||
<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\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\strerror\nrf_strerror.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh_ant.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh_ble.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh_freertos.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh_soc.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\external\freertos\portable\CMSIS\nrf52\portmacro_cmsis.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\external\freertos\portable\GCC\nrf52\portmacro.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\external\freertos\source\include\croutine.h" />
|
||||
@@ -521,5 +573,18 @@
|
||||
<None Include="bmd380_peripheral-Debug.vgdbsettings" />
|
||||
<None Include="bmd380_peripheral-Release.vgdbsettings" />
|
||||
<None Include="nrf5x.xml" />
|
||||
<ClCompile Include="..\bmd380_sdk\components\ble\ble_advertising\ble_advertising.c" />
|
||||
<ClCompile Include="..\bmd380_sdk\components\ble\common\ble_advdata.c" />
|
||||
<ClCompile Include="..\bmd380_sdk\components\ble\common\ble_conn_params.c" />
|
||||
<ClCompile Include="..\bmd380_sdk\components\ble\common\ble_conn_state.c" />
|
||||
<ClCompile Include="..\bmd380_sdk\components\ble\common\ble_srv_common.c" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\ble_advertising\ble_advertising.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\common\ble_advdata.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\common\ble_conn_params.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\common\ble_conn_state.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\common\ble_date_time.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\common\ble_gatt_db.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\common\ble_sensor_location.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\common\ble_srv_common.h" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -202,6 +202,72 @@
|
||||
<Filter Include="Header files\integration\nrfx\legacy">
|
||||
<UniqueIdentifier>{3eb77b43-f265-4923-86c6-d9e123cdf282}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source files\softdevice">
|
||||
<UniqueIdentifier>{3d372dea-1fd2-4fa6-9de8-8f8e3e36d4cd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header files\softdevice">
|
||||
<UniqueIdentifier>{9d0c0dc5-0836-4799-8e1e-863bb92fa31b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source files\softdevice\common">
|
||||
<UniqueIdentifier>{e08c3a0a-44b9-484a-a2d6-753845cfc53f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header files\softdevice\common">
|
||||
<UniqueIdentifier>{c7ac68a2-299c-474c-885e-d429e8e5a452}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source files\ble">
|
||||
<UniqueIdentifier>{bc9e84c6-e1eb-4f92-a953-156157313736}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source files\ble\ble_advertising">
|
||||
<UniqueIdentifier>{e343d3fa-a2ab-4468-a86f-85ab5bf8691f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source files\ble\common">
|
||||
<UniqueIdentifier>{6796de8c-d113-49ae-b410-1ba146602aaa}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header files\ble">
|
||||
<UniqueIdentifier>{e35e5681-0697-4cac-a093-e56c06a1b735}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header files\ble\ble_advertising">
|
||||
<UniqueIdentifier>{7f288a24-1e47-49e6-9a8a-907e9c84ca1d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header files\ble\common">
|
||||
<UniqueIdentifier>{defffc43-551c-4791-967b-7d0aee507516}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source files\ble\nrf_ble_gatt">
|
||||
<UniqueIdentifier>{345707cc-7a27-4c28-94b4-19df7d90e78d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header files\ble\nrf_ble_gatt">
|
||||
<UniqueIdentifier>{b6e27cec-5179-4ec4-8f4d-e7e9fbaabae8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header files\ble\ble_services">
|
||||
<UniqueIdentifier>{4153528a-d996-4c55-be9f-917ce26d6277}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source files\ble\ble_services">
|
||||
<UniqueIdentifier>{7abc8adc-4234-4ec2-a927-53d29690cfc0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source files\ble\ble_services\ble_dis">
|
||||
<UniqueIdentifier>{2cf242dc-b5b5-4aa3-b56f-92c1afd295a1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header files\ble\ble_services\ble_dis">
|
||||
<UniqueIdentifier>{e8688895-c809-46b5-a2ab-2bd49da33d45}</UniqueIdentifier>
|
||||
</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>
|
||||
<ClCompile Include="main.c">
|
||||
@@ -1230,6 +1296,99 @@
|
||||
<ClCompile Include="..\bmd380_sdk\integration\nrfx\legacy\nrf_drv_uart.c">
|
||||
<Filter>Source files\integration\nrfx\legacy</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh.c">
|
||||
<Filter>Source files\softdevice\common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh_ant.c">
|
||||
<Filter>Source files\softdevice\common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh_ble.c">
|
||||
<Filter>Source files\softdevice\common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh_freertos.c">
|
||||
<Filter>Source files\softdevice\common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh_soc.c">
|
||||
<Filter>Source files\softdevice\common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="le_adv.c">
|
||||
<Filter>Source files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="le_gap.c">
|
||||
<Filter>Source files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\components\ble\ble_advertising\ble_advertising.c">
|
||||
<Filter>Source files\ble\ble_advertising</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\components\ble\common\ble_advdata.c">
|
||||
<Filter>Source files\ble\common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\components\ble\common\ble_conn_params.c">
|
||||
<Filter>Source files\ble\common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\components\ble\common\ble_conn_state.c">
|
||||
<Filter>Source files\ble\common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\components\ble\common\ble_srv_common.c">
|
||||
<Filter>Source files\ble\common</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\ble_advertising\ble_advertising.h">
|
||||
<Filter>Header files\ble\ble_advertising</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\common\ble_advdata.h">
|
||||
<Filter>Header files\ble\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\common\ble_conn_params.h">
|
||||
<Filter>Header files\ble\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\common\ble_conn_state.h">
|
||||
<Filter>Header files\ble\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\common\ble_date_time.h">
|
||||
<Filter>Header files\ble\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\common\ble_gatt_db.h">
|
||||
<Filter>Header files\ble\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\common\ble_sensor_location.h">
|
||||
<Filter>Header files\ble\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\common\ble_srv_common.h">
|
||||
<Filter>Header files\ble\common</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="le_gatt.c">
|
||||
<Filter>Source files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\components\ble\nrf_ble_gatt\nrf_ble_gatt.c">
|
||||
<Filter>Source files\ble\nrf_ble_gatt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\components\ble\ble_services\ble_dis\ble_dis.c">
|
||||
<Filter>Source files\ble\ble_services\ble_dis</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="le_srv.c">
|
||||
<Filter>Source files</Filter>
|
||||
</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>
|
||||
<None Include="nRF52840_XXAA_S140_reserve.lds">
|
||||
@@ -1465,6 +1624,36 @@
|
||||
<ClInclude Include="..\bmd380_sdk\integration\nrfx\legacy\nrf_drv_wdt.h">
|
||||
<Filter>Header files\integration\nrfx\legacy</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh.h">
|
||||
<Filter>Header files\softdevice\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh_ant.h">
|
||||
<Filter>Header files\softdevice\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh_ble.h">
|
||||
<Filter>Header files\softdevice\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh_freertos.h">
|
||||
<Filter>Header files\softdevice\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\bmd380_sdk\components\softdevice\common\nrf_sdh_soc.h">
|
||||
<Filter>Header files\softdevice\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\nrf_ble_gatt\nrf_ble_gatt.h">
|
||||
<Filter>Header files\ble\nrf_ble_gatt</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\ble_services\ble_dis\ble_dis.h">
|
||||
<Filter>Header files\ble\ble_services\ble_dis</Filter>
|
||||
</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>
|
||||
<Text Include="..\bmd380_sdk\external\segger_rtt\license\license.txt">
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
#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_advdata.h"
|
||||
#include "ble_advertising.h"
|
||||
#include "ble_srv_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
BLE_ADVERTISING_DEF(m_advertising); /**< Advertising module instance. */
|
||||
|
||||
static void le_adv_evt_handler(ble_adv_evt_t const adv_evt)
|
||||
{
|
||||
switch (adv_evt)
|
||||
{
|
||||
case BLE_ADV_EVT_IDLE:
|
||||
case BLE_ADV_EVT_DIRECTED_HIGH_DUTY:
|
||||
case BLE_ADV_EVT_DIRECTED:
|
||||
case BLE_ADV_EVT_FAST:
|
||||
case BLE_ADV_EVT_SLOW:
|
||||
case BLE_ADV_EVT_FAST_WHITELIST:
|
||||
case BLE_ADV_EVT_SLOW_WHITELIST:
|
||||
case BLE_ADV_EVT_WHITELIST_REQUEST:
|
||||
case BLE_ADV_EVT_PEER_ADDR_REQUEST:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void le_adv_error_handler(uint32_t nrf_error)
|
||||
{
|
||||
// TODO...
|
||||
__BKPT(255);
|
||||
}
|
||||
|
||||
void le_adv_init(uint8_t ble_conn_cfg_tag)
|
||||
{
|
||||
uint32_t err_code;
|
||||
ble_advertising_init_t init;
|
||||
memset(&init, 0, sizeof(init));
|
||||
|
||||
struct
|
||||
{
|
||||
const uint8_t company_code[5];
|
||||
const uint8_t hw_ver[4];
|
||||
uint16_t bat_volt;
|
||||
} __PACKED data = {
|
||||
.company_code = ELITE_COMPANY_CODE,
|
||||
.hw_ver = ELITE_HW_VER,
|
||||
.bat_volt = 100,
|
||||
};
|
||||
|
||||
ble_advdata_manuf_data_t manuf_specific_data;
|
||||
manuf_specific_data.data.p_data = (uint8_t *)&data;
|
||||
manuf_specific_data.data.size = sizeof(data);
|
||||
manuf_specific_data.company_identifier = 0xFFFF;
|
||||
init.advdata.p_manuf_specific_data = &manuf_specific_data;
|
||||
init.advdata.name_type = BLE_ADVDATA_FULL_NAME;
|
||||
init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
|
||||
|
||||
init.config.ble_adv_fast_enabled = true;
|
||||
init.config.ble_adv_fast_interval = MSEC_TO_UNITS(25, UNIT_0_625_MS);
|
||||
init.config.ble_adv_fast_timeout = MSEC_TO_UNITS(3000, UNIT_10_MS);
|
||||
init.config.ble_adv_slow_enabled = true;
|
||||
init.config.ble_adv_slow_interval = MSEC_TO_UNITS(250, UNIT_0_625_MS);
|
||||
init.config.ble_adv_slow_timeout = MSEC_TO_UNITS(0, UNIT_10_MS);
|
||||
|
||||
init.evt_handler = le_adv_evt_handler;
|
||||
init.error_handler = le_adv_error_handler;
|
||||
|
||||
err_code = ble_advertising_init(&m_advertising, &init);
|
||||
APP_ERROR_CHECK(err_code);
|
||||
|
||||
ble_advertising_conn_cfg_tag_set(&m_advertising, ble_conn_cfg_tag);
|
||||
|
||||
ret_code_t ret = ble_advertising_start(&m_advertising, BLE_ADV_MODE_FAST);
|
||||
APP_ERROR_CHECK(ret);
|
||||
}
|
||||
@@ -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
@@ -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)
|
||||
@@ -0,0 +1,67 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "app_config.h"
|
||||
#include "apply_old_config.h"
|
||||
#include "sdk_config.h"
|
||||
|
||||
#include "nrf_sdh.h"
|
||||
#include "nrf_sdh_ble.h"
|
||||
|
||||
#include "nrf_log.h"
|
||||
|
||||
#include "app_error.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
void le_gap_init(const char *device_name, uint16_t usAppearance)
|
||||
{
|
||||
ret_code_t err_code;
|
||||
|
||||
ble_gap_conn_sec_mode_t sec_mode;
|
||||
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
|
||||
if (device_name != NULL)
|
||||
{
|
||||
// Set GAP device name
|
||||
err_code = sd_ble_gap_device_name_set(&sec_mode, (const uint8_t *)device_name, strlen(device_name));
|
||||
APP_ERROR_CHECK(err_code);
|
||||
}
|
||||
|
||||
// Set GAP Appearance value
|
||||
err_code = sd_ble_gap_appearance_set(usAppearance);
|
||||
APP_ERROR_CHECK(err_code);
|
||||
|
||||
// Set GAP Peripheral Preferred Connection Parameters.
|
||||
ble_gap_conn_params_t 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.max_conn_interval = MSEC_TO_UNITS(20, UNIT_1_25_MS); /**< Maximum connection interval (20 ms). */
|
||||
gap_conn_params.slave_latency = 8; /**< Slave latency. */
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
#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_gatt.h"
|
||||
#include "nrf_ble_gatt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
NRF_BLE_GATT_DEF(m_gatt); /**< GATT module instance. */
|
||||
void le_gatt_init(void)
|
||||
{
|
||||
ret_code_t err_code = nrf_ble_gatt_init(&m_gatt, NULL);
|
||||
APP_ERROR_CHECK(err_code);
|
||||
}
|
||||
|
||||
uint16_t le_gatt_mtu(void)
|
||||
{
|
||||
return nrf_ble_gatt_eff_mtu_get(&m_gatt, 0);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
#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
|
||||
|
||||
#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 FW_REV "0.1.0"
|
||||
#define SER_NUM "0000-00-00-00001"
|
||||
#define MODULE_NAME ELITE_DEVICE_NAME
|
||||
|
||||
static void le_dis_init(void)
|
||||
{
|
||||
ble_dis_init_t dis_init;
|
||||
memset(&dis_init, 0, sizeof(dis_init));
|
||||
|
||||
ble_srv_ascii_to_utf8(&dis_init.manufact_name_str, MANUFACTURER_NAME);
|
||||
ble_srv_ascii_to_utf8(&dis_init.fw_rev_str, FW_REV);
|
||||
ble_srv_ascii_to_utf8(&dis_init.hw_rev_str, HW_REV);
|
||||
ble_srv_ascii_to_utf8(&dis_init.model_num_str, MODULE_NAME);
|
||||
ble_srv_ascii_to_utf8(&dis_init.serial_num_str, SER_NUM);
|
||||
dis_init.dis_char_rd_sec = SEC_OPEN;
|
||||
|
||||
ret_code_t err_code = ble_dis_init(&dis_init);
|
||||
APP_ERROR_CHECK(err_code);
|
||||
}
|
||||
|
||||
void le_srv_init(void)
|
||||
{
|
||||
le_dis_init();
|
||||
|
||||
extern void le_dfu_init(void);
|
||||
le_dfu_init();
|
||||
|
||||
extern void le_eis_init(void);
|
||||
le_eis_init();
|
||||
}
|
||||
@@ -6,9 +6,9 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "sdk_config.h"
|
||||
#include "app_config.h"
|
||||
#include "apply_old_config.h"
|
||||
#include "sdk_config.h"
|
||||
|
||||
#include "nrf_log.h"
|
||||
#include "nrf_log_ctrl.h"
|
||||
@@ -17,6 +17,10 @@ extern "C"
|
||||
#include "nrf_delay.h"
|
||||
#include "nrf_gpio.h"
|
||||
|
||||
#include "nrf_sdh.h"
|
||||
#include "nrf_sdh_ble.h"
|
||||
#include "nrf_sdh_freertos.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
@@ -24,51 +28,107 @@ extern "C"
|
||||
}
|
||||
#endif
|
||||
|
||||
void led1_task(void *pArg)
|
||||
#define APP_BLE_CONN_CFG_TAG 1 /**< A tag identifying the SoftDevice BLE configuration. */
|
||||
#define APP_BLE_OBSERVER_PRIO 3 /**< Application's BLE observer priority. You shouldn't need to modify this value. */
|
||||
|
||||
static void le_evt_handler(ble_evt_t const *p_ble_evt, void *p_context)
|
||||
{
|
||||
nrf_gpio_cfg_output(13);
|
||||
|
||||
for (;;)
|
||||
ret_code_t err_code;
|
||||
switch (p_ble_evt->header.evt_id)
|
||||
{
|
||||
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);
|
||||
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: {
|
||||
NRF_LOG_INFO("PHY update response. (AUTO)");
|
||||
ble_gap_phys_t const phys = {
|
||||
.rx_phys = BLE_GAP_PHY_AUTO,
|
||||
.tx_phys = BLE_GAP_PHY_AUTO,
|
||||
};
|
||||
err_code = sd_ble_gap_phy_update(p_ble_evt->evt.gap_evt.conn_handle, &phys);
|
||||
APP_ERROR_CHECK(err_code);
|
||||
}
|
||||
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:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void led2_task(void *pArg)
|
||||
static void le_stack_Init(void)
|
||||
{
|
||||
nrf_gpio_cfg_output(14);
|
||||
ret_code_t err_code;
|
||||
uint32_t ram_start = 0;
|
||||
ble_cfg_t 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.params.gatts_conn_cfg.hvn_tx_queue_size = 12;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
NRF_LOG_INFO("led 2 off");
|
||||
nrf_gpio_pin_set(14);
|
||||
vTaskDelay(125);
|
||||
err_code = nrf_sdh_enable_request();
|
||||
APP_ERROR_CHECK(err_code);
|
||||
|
||||
NRF_LOG_INFO("led 2 on");
|
||||
nrf_gpio_pin_clear(14);
|
||||
vTaskDelay(125);
|
||||
}
|
||||
// Configure the BLE stack using the default settings.
|
||||
// Fetch the start address of the application RAM.
|
||||
err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start);
|
||||
APP_ERROR_CHECK(err_code);
|
||||
|
||||
err_code = sd_ble_cfg_set(BLE_CONN_CFG_GATTS, &ble_cfg, ram_start);
|
||||
APP_ERROR_CHECK(err_code);
|
||||
|
||||
// Enable BLE stack.
|
||||
err_code = nrf_sdh_ble_enable(&ram_start);
|
||||
APP_ERROR_CHECK(err_code);
|
||||
|
||||
// Register a handler for BLE events.
|
||||
NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, le_evt_handler, NULL);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
NRF_LOG_INIT(NULL, 0);
|
||||
NRF_LOG_DEFAULT_BACKENDS_INIT();
|
||||
NRF_LOG_INFO("%s Build: %s %s", DEVICE_NAME, __TIME__, __DATE__);
|
||||
NRF_LOG_INFO("%s Build: %s %s", ELITE_DEVICE_NAME, __TIME__, __DATE__);
|
||||
|
||||
xTaskCreate(led1_task, "led1_task", 160, NULL, 3, NULL);
|
||||
xTaskCreate(led2_task, "led2_task", 160, NULL, 3, NULL);
|
||||
le_stack_Init();
|
||||
|
||||
extern void le_gap_init(const char *device_name, uint16_t usAppearance);
|
||||
le_gap_init(ELITE_DEVICE_NAME, BLE_APPEARANCE_UNKNOWN);
|
||||
|
||||
extern void le_gatt_init(void);
|
||||
le_gatt_init();
|
||||
|
||||
extern void le_srv_init(void);
|
||||
le_srv_init();
|
||||
|
||||
extern void le_adv_init(uint8_t ble_conn_cfg_tag);
|
||||
le_adv_init(APP_BLE_CONN_CFG_TAG);
|
||||
|
||||
nrf_sdh_freertos_init(NULL, NULL);
|
||||
|
||||
vTaskStartScheduler();
|
||||
|
||||
for (;;)
|
||||
{
|
||||
// Will not get here unless there is insufficient RAM.
|
||||
__BKPT(255);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ MEMORY
|
||||
{
|
||||
FLASH_SOFTDEVICE (rx) : ORIGIN = 0x00000000, LENGTH = 0x00027000
|
||||
FLASH (rx) : ORIGIN = 0x00027000, LENGTH = 0x000d9000
|
||||
RAM_SOFTDEVICE (rwx) : ORIGIN = 0x20000000, LENGTH = 0x000079e0
|
||||
RAM (rwx) : ORIGIN = 0x200079e0, LENGTH = 0x00037620
|
||||
RAM_SOFTDEVICE (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00018000
|
||||
RAM (rwx) : ORIGIN = 0x20018000, LENGTH = 0x00027000
|
||||
RTT (rwx) : ORIGIN = 0x2003F000, LENGTH = 0x00001000
|
||||
CODE_RAM (rwx) : ORIGIN = 0x800000, LENGTH = 0x6000
|
||||
}
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x00027000, LENGTH = 0x000d9000
|
||||
EXTFLASH (rx) : ORIGIN = 0x12000000, LENGTH = 0x8000000
|
||||
RAM (rwx) : ORIGIN = 0x200079e0, LENGTH = 0x00038620
|
||||
FLASH (rx) : ORIGIN = 0x00027000, LENGTH = 0x000B7000
|
||||
RAM_SOFTDEVICE (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00010000
|
||||
RAM (rwx) : ORIGIN = 0x20010000, LENGTH = 0x0002F000
|
||||
RTT (rwx) : ORIGIN = 0x2003F000, LENGTH = 0x00001000
|
||||
CODE_RAM (rwx) : ORIGIN = 0x800000, LENGTH = 0x40000
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<EmbeddedProfile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<ToolchainID>com.visualgdb.arm-eabi</ToolchainID>
|
||||
<ToolchainVersion>
|
||||
<GCC>10.3.1</GCC>
|
||||
<GDB>10.2.90</GDB>
|
||||
<GCC>12.3.1</GCC>
|
||||
<GDB>13.2</GDB>
|
||||
<Revision>1</Revision>
|
||||
</ToolchainVersion>
|
||||
<BspID>com.sysprogs.arm.nordic.nrf5x</BspID>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIEM6TVi/ofxCYEb2O9OYK4sNHlpwd0ZrW3yFOIeRJKqKoAoGCCqGSM49
|
||||
AwEHoUQDQgAEYUIRVGOQwmOEfsuYSufu4hHxRsQSUzh9lMBkvc3ewrPkpbfiXfa/
|
||||
vGyIM8HAY2Jemux9+FyFERXRjgj5RxOJAA==
|
||||
-----END EC PRIVATE KEY-----
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user