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 #130 from ojousima/master
Browse files Browse the repository at this point in the history
Fix Eddystone EID error
  • Loading branch information
ojousima authored Aug 1, 2018
2 parents f50fc38 + 7662722 commit 3d51788
Show file tree
Hide file tree
Showing 7 changed files with 301 additions and 101 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ For more details, please see [licenses.md](<licenses.md>).
## Developing Ruuvi Firmware
Instructions below are tested using OS X and Ubuntu, but basically any Unix distribution (or even Windows) should be fine. Compilation works also using the *Bash on Ubuntu on Windows* -feature added in the July 2016 update of Windows 10 if you follow the Ubuntu directions. If you've compiled and flashed successfully (or unsuccessfully), please identify yourself on our Slack :)

### Prerequisites (to compile):
### Prerequisites (to compile with ARMGCC):

The project currently uses the Nordic nRF52 SDK version 12.3.0 (downloaded in the `make` process)
and thus requires the GNU ARM Embedded Toolchain version 4.9 Q3 2015 (aka 4.9.3) for compiling:
Expand Down Expand Up @@ -157,6 +157,12 @@ Note that the nRF52 SDK will be downloaded in `make`, so only after this will
the `$SDK/components/toolchain/gcc/` folder exist in the project (typically
as the `nRF5_SDK_12.3.0_d7731ad/components/toolchain/gcc/` folder).

### Prerequisites (to compile with Segger Embedded Studio):
Since Q4 of 2017 Segger Embedded Studio has been free (as in beer) to use with Nordic Semiconductor products
such as nRF52. You can download latest version (>3.40) from Segger website.

You'll need to download and unzip the Nordic SDK 12.3 as above. Only Ruuvi Firmware is currently supported with SES, open folder `ruuvi_examples/ruuvi_firmware/ruuvitag_b/ses`To find the project file.

### Prerequisites (to create DFU distribution .zip packages)

Instructions how to install (on OS X, Ubuntu):
Expand Down
1 change: 1 addition & 0 deletions drivers/bluetooth/bluetooth_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "nrf_delay.h"

#include "bluetooth_config.h"
#include "bluetooth_application_config.h"
#include "ble_bulk_transfer.h"
#include "eddystone.h"
#include "ruuvi_endpoints.h"
Expand Down
4 changes: 0 additions & 4 deletions drivers/init/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,6 @@ init_err_code_t init_sensors(void)
err_code |= init_lis2dh12();
//init environmental sensor bme280
err_code |= init_bme280();
//init chain channels
chain_handler_init();
set_chain_handler(chain_handler);

return err_code;
}
Expand All @@ -264,7 +261,6 @@ init_err_code_t init_watchdog(watchdog_event_handler_t handler)
err_code |= watchdog_init(handler);
watchdog_enable();
return err_code;

}

/**
Expand Down
70 changes: 35 additions & 35 deletions drivers/nrf_nordic_pininterrupt/pin_interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
*/
ret_code_t pin_interrupt_init()
{
ret_code_t err_code = NRF_SUCCESS;
err_code |= nrf_drv_gpiote_init();
return err_code;
ret_code_t err_code = NRF_SUCCESS;
err_code |= nrf_drv_gpiote_init();
return err_code;
}

//Look-up table for event handlers
static message_handler pin_event_handlers[32] = {0};
static void in_pin_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
//Call event handler with empty message TODO: invalid message add context?
NRF_LOG_DEBUG("Handling pin event\r\n");
ruuvi_standard_message_t message;
if(NULL != pin_event_handlers[pin]){ (pin_event_handlers[pin])(message);}
//Call event handler with empty message TODO: invalid message add context?
NRF_LOG_DEBUG("Handling pin event\r\n");
ruuvi_standard_message_t message;
if (NULL != pin_event_handlers[pin]) { (pin_event_handlers[pin])(message);}
}
/**
* Enable interrput on pin. Pull-up is enabled on HITOLOW, pull-down is enabled on LOWTIHI
Expand All @@ -38,37 +38,37 @@ static void in_pin_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t actio
* NRF_GPIOTE_POLARITY_HITOLO
* NRF_GPIOTE_POLARITY_TOGGLE
*
* Message handler is called with an empty message on event.
* Message handler is called with an empty message on event.
*/
ret_code_t pin_interrupt_enable(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t polarity, message_handler handler)
{
NRF_LOG_INFO("Enabling\r\n");
ret_code_t err_code = NRF_SUCCESS;
nrf_drv_gpiote_in_config_t in_config = { \
.is_watcher = false, \
.hi_accuracy = false, \
.pull = NRF_GPIO_PIN_NOPULL, \
.sense = polarity \
};
switch(polarity)
{
case NRF_GPIOTE_POLARITY_TOGGLE:
in_config.pull = NRF_GPIO_PIN_NOPULL;
break;
case NRF_GPIOTE_POLARITY_HITOLO:
NRF_LOG_INFO("Pull-up\r\n");
in_config.pull = NRF_GPIO_PIN_PULLUP;
break;
case NRF_GPIOTE_POLARITY_LOTOHI:
in_config.pull = NRF_GPIO_PIN_PULLDOWN;
break;
default:
return 1; //TODO proper error code
}
pin_event_handlers[pin] = handler;
err_code |= nrf_drv_gpiote_in_init(pin, &in_config, in_pin_handler);
NRF_LOG_INFO("Enabling\r\n");
ret_code_t err_code = NRF_SUCCESS;
nrf_drv_gpiote_in_config_t in_config = {
.is_watcher = false, \
.hi_accuracy = false, \
.pull = NRF_GPIO_PIN_NOPULL, \
.sense = polarity \
};
switch (polarity)
{
case NRF_GPIOTE_POLARITY_TOGGLE:
in_config.pull = NRF_GPIO_PIN_NOPULL;
break;
case NRF_GPIOTE_POLARITY_HITOLO:
NRF_LOG_INFO("Pull-up\r\n");
in_config.pull = NRF_GPIO_PIN_PULLUP;
break;
case NRF_GPIOTE_POLARITY_LOTOHI:
in_config.pull = NRF_GPIO_PIN_PULLDOWN;
break;
default:
return 1; //TODO proper error code
}
pin_event_handlers[pin] = handler;
err_code |= nrf_drv_gpiote_in_init(pin, &in_config, in_pin_handler);

nrf_drv_gpiote_in_event_enable(pin, true);
nrf_drv_gpiote_in_event_enable(pin, true);

return err_code;
return err_code;
}
4 changes: 2 additions & 2 deletions ruuvi_examples/eddystone/bluetooth_application_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#define APPLICATION_ADV_INTERVAL 500 /**< ms **/
#define APP_TX_POWER 4 /**< dBm **/

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

#define APPLICATION_GATT 1
#define APP_GATT_PROFILE_ENABLED 1

#endif
Loading

0 comments on commit 3d51788

Please sign in to comment.