Skip to content
This repository has been archived by the owner on Sep 23, 2021. It is now read-only.

Commit

Permalink
Merge pull request #113 from ojousima/master
Browse files Browse the repository at this point in the history
  • Loading branch information
ojousima authored Apr 18, 2018
2 parents f3f0db7 + 8317821 commit d385ae9
Show file tree
Hide file tree
Showing 9 changed files with 899 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ keys

_build

#build files
*.hex
*.zip

# VisualGDB Makefile

nrf5x.mak
Expand All @@ -70,3 +74,4 @@ nRF5_SDK_12.1.0_0d23e2a.zip
nRF5_SDK_12.2.*
nRF5_SDK_12.3.*
nRF5_SDK_13.*
nRF5_SDK_14.*
7 changes: 6 additions & 1 deletion drivers/bluetooth/ble_event_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
#include "bluetooth_config.h"
#include "app_scheduler.h"

#if APPLICATION_GATT
#include "application_ble_event_handlers.h"
#endif


static uint16_t m_conn_handle = BLE_CONN_HANDLE_INVALID; /**< Handle of the current connection. */
Expand Down Expand Up @@ -329,6 +331,9 @@ void ble_evt_dispatch(ble_evt_t * p_ble_evt)
bsp_btn_ble_on_ble_evt(p_ble_evt);
ble_advertising_on_ble_evt(p_ble_evt);
on_ble_evt(p_ble_evt);
application_on_ble_evt(p_ble_evt);
nrf_ble_qwr_on_ble_evt(&m_qwr, p_ble_evt);

#if APPLICATION_GATT
application_on_ble_evt(p_ble_evt);
#endif
}
8 changes: 6 additions & 2 deletions drivers/bluetooth/bluetooth_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@
#include "sdk_errors.h"
#include "nrf_delay.h"

#include "ble_event_handlers.h"
#include "bluetooth_config.h"
#include "ble_bulk_transfer.h"
#include "eddystone.h"
#include "ruuvi_endpoints.h"
#include "ble_event_handlers.h"

#if APPLICATION_GATT
#include "application_service_if.h"
#endif

#define NRF_LOG_MODULE_NAME "BLE_CORE"
#define NRF_LOG__DEFAULT_LEVEL 4
Expand Down Expand Up @@ -358,10 +360,12 @@ ret_code_t bluetooth_stack_init(void)
peer_manager_init(true);
NRF_LOG_INFO("Peer manager init \r\n");
nrf_delay_ms(10);


#if APPLICATION_GATT
err_code |= application_services_init();
NRF_LOG_INFO("Services init status %d\r\n", err_code);
nrf_delay_ms(10);
#endif

gap_params_init();
NRF_LOG_INFO("GAP params init\r\n");
Expand Down
4 changes: 3 additions & 1 deletion ruuvi_examples/eddystone/bluetooth_application_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
#define APPLICATION_ADV_INTERVAL 500 /**< ms **/
#define APP_TX_POWER 4 /**< dBm **/

#define INIT_FWREV "Eddystone_2.2.0" /**< Github tag **/
#define INIT_FWREV "Eddystone_2.2.1" /**< Github tag **/
#define INIT_SWREV INIT_FWREV /**< Practicially same thing, as there is no separate SW **/

#define APPLICATION_GATT 1

#endif
14 changes: 12 additions & 2 deletions ruuvi_examples/ruuvi_firmware/bluetooth_application_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#define APPLICATION_DEVICE_NAME_LENGTH 5 /**< number of characters in above string, excluding null */
#define APP_DEVICE_NAME APPLICATION_DEVICE_NAME /**< TODO: Refactoring **/
#define APP_DEVICE_NAME_LENGTH APPLICATION_DEVICE_NAME_LENGTH
#define APPLICATION_ADV_INTERVAL 1000 /**< ms **/
#define APPLICATION_ADV_INTERVAL 1010 /**< ms. Use value which is not exactly divisible by 1000 ms for Minew interoperability **/
#define APP_TX_POWER 4 /**< dBm **/
#define INIT_FWREV "2.2.0" /**< Github tag. Do not include specifiers such as "alpha" so you can accept ready binaries as they are **/
#define INIT_FWREV "2.2.1" /**< Github tag. Do not include specifiers such as "alpha" so you can accept ready binaries as they are **/
#define INIT_SWREV INIT_FWREV /**< FW and SW are same thing in this context **/

// milliseconds until main loop timer function is called. Other timers can bring
Expand All @@ -26,4 +26,14 @@
//Raw v2
#define RAW_DATA_LENGTH 24

/**
* BLE_GAP_ADV_TYPE_ADV_IND 0x00 Connectable, scannable
* BLE_GAP_ADV_TYPE_ADV_DIRECT_IND 0x01
* BLE_GAP_ADV_TYPE_ADV_SCAN_IND 0x02 Nonconnectable, scannable
* BLE_GAP_ADV_TYPE_ADV_NONCONN_IND 0x03 Nonconnectable, nonscannable
*/
#define APPLICATION_ADVERTISEMENT_TYPE 0x00
//Set to 0 if you don't want to include GATT connectivity. Remember to adjust advertisement type
#define APPLICATION_GATT 1

#endif
6 changes: 3 additions & 3 deletions ruuvi_examples/ruuvi_firmware/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ int main(void)

// Initialize BLE Stack. Required in all applications for timer operation.
err_code |= init_ble();
bluetooth_advertising_stop();
bluetooth_configure_advertisement_type(APPLICATION_ADVERTISEMENT_TYPE);
bluetooth_tx_power_set(BLE_TX_POWER);
bluetooth_configure_advertising_interval(ADVERTISING_INTERVAL_RAW);

Expand Down Expand Up @@ -290,8 +290,8 @@ int main(void)
lis2dh12_enable();
lis2dh12_set_scale(LIS2DH12_SCALE);
// Sample rate 10 for activity detection.
lis2dh12_set_sample_rate(LIS2DH12_RATE_10);
lis2dh12_set_resolution(LIS2DH12_SAMPLERATE_RAW);
lis2dh12_set_sample_rate(LIS2DH12_SAMPLERATE_RAW);
lis2dh12_set_resolution(LIS2DH12_RESOLUTION);

//XXX If you read this, I'm sorry about line below.
#include "lis2dh12_registers.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ SRC_FILES += \
$(PROJ_DIR)/../../libraries/ruuvi_sensor_formats/chain_channels.c \
$(PROJ_DIR)/../../libraries/ruuvi_sensor_formats/sensortag.c \
$(PROJ_DIR)/../../sdk_overrides/app_button.c \
$(PROJ_DIR)/../../sdk_overrides/nrf_drv_wdt.c \
$(PROJ_DIR)/ble_services/application_ble_event_handlers.c \
$(PROJ_DIR)/ble_services/application_service_if.c \
$(PROJ_DIR)/ble_services/nrf_dfu_flash_buttonless.c \
Expand Down Expand Up @@ -74,7 +75,6 @@ SRC_FILES += \
$(SDK_ROOT)/components/drivers_nrf/saadc/nrf_drv_saadc.c \
$(SDK_ROOT)/components/drivers_nrf/hal/nrf_saadc.c \
$(SDK_ROOT)/components/drivers_nrf/gpiote/nrf_drv_gpiote.c \
$(SDK_ROOT)/components/drivers_nrf/wdt/nrf_drv_wdt.c \
$(SDK_ROOT)/components/ble/ble_advertising/ble_advertising.c \
$(SDK_ROOT)/components/libraries/bootloader/dfu/nrf_dfu_settings.c \
$(SDK_ROOT)/components/libraries/crc16/crc16.c \
Expand Down
Loading

0 comments on commit d385ae9

Please sign in to comment.