Enable Softdevice, This application is for xxAC now.

This commit is contained in:
imi415 2020-09-17 00:58:48 +08:00
parent a6f724b51a
commit 5912e3de77
Signed by: imi415
GPG Key ID: 17F01E106F9F5E0A
5 changed files with 16 additions and 5 deletions

View File

@ -6,7 +6,7 @@ SDK_ROOT := $(PWD)/../../nRF_SDK/nRF5_SDK_12.3.0_d7731ad
PROJ_DIR := $(PWD)
$(OUTPUT_DIRECTORY)/nrf51822_xxaa.out: \
LINKER_SCRIPT := nrf51_xxaa_softdevice.ld
LINKER_SCRIPT := nrf51_xxac_softdevice.ld
# Source files common to all targets
SRC_FILES += \

View File

@ -99,7 +99,7 @@
#define configTICK_RATE_HZ 1000
#define configMAX_PRIORITIES ( 3 )
#define configMINIMAL_STACK_SIZE ( 60 )
#define configTOTAL_HEAP_SIZE ( 4096 )
#define configTOTAL_HEAP_SIZE ( 8192 )
#define configMAX_TASK_NAME_LEN ( 4 )
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1

View File

@ -2,5 +2,7 @@
#define __USER_CONFIG_H
#define APP_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. */
#define CENTRAL_LINK_COUNT 0 /**< Number of central links used by the application. When changing this number remember to adjust the RAM settings*/
#define PERIPHERAL_LINK_COUNT 1 /**< Number of peripheral links used by the application. When changing this number remember to adjust the RAM settings*/
#endif

View File

@ -6,7 +6,7 @@ GROUP(-lgcc -lc -lnosys)
MEMORY
{
FLASH (rx) : ORIGIN = 0x1b000, LENGTH = 0x25000 /* --- */
RAM (rwx) : ORIGIN = 0x200013c8, LENGTH = 0x2c38 /* Nordic S130 SDS v2 */
RAM (rwx) : ORIGIN = 0x20001fe8, LENGTH = 0x2018 /* Nordic S130 SDS v2 */
}
SECTIONS

View File

@ -10,6 +10,7 @@
#include "task.h"
#include "semphr.h"
#include "user_config.h"
#include "user_functions.h"
#include "user_tasks.h"
@ -30,9 +31,10 @@ void init_tasks(void) {
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
}
if(pdPASS != xTaskCreate(vTaskBlinkLED, "TASKBLINK0", 64, NULL, 2, &xTaskBlinkLEDHandle)) {
if(pdPASS != xTaskCreate(vTaskBlinkLED, "TASKBLINK0", 128, NULL, 2, &xTaskBlinkLEDHandle)) {
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
}
if(pdPASS != xTaskCreate(vTaskBLE, "TASKBLE0", 256, NULL, 2, &xTaskBLEHandle)) {
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
}
@ -57,7 +59,14 @@ void vTaskBLE(void *pvParameters) {
nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, ble_new_event_handler);
NRF_LOG_INFO("Softdevice handler created, waiting for events\r\n");
ble_enable_params_t ble_enable_params;
uint32_t err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT, &ble_enable_params);
APP_ERROR_CHECK(err_code);
CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT);
err_code = softdevice_enable(&ble_enable_params);
APP_ERROR_CHECK(err_code);
NRF_LOG_INFO("Softdevice enabled, waiting for events\r\n");
for(;;) {
while(pdFALSE == xSemaphoreTake(xSemaphoreBLEEventReadyHandle, portMAX_DELAY)) {