Commit graph

65 commits

Author SHA1 Message Date
Andrei Emeltchenko 4e21f0651a samples: mesh_badge: Update project config
Add CONFIG_BT.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-11-23 09:10:01 -05:00
Grzegorz Kolodziejczyk 3abb8a8521 samples: reel_board/mesh_badge: Fix sensor statuses struct organization
Patch modifies structure organization to be specification compliant.

Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@codecoup.pl>
2018-11-20 18:00:51 +02:00
Johan Hedberg d0253d310d samples: reel_board/mesh_badge: Fix various coding style issues
Fix coding style issues, mainly related to whitespace usage.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-11-19 15:06:14 +02:00
Johan Hedberg b164c9723f samples: reel_board/mesh_badge: Fix out-of-bounds array access
The show_sensors_data() function tries to access val[2] when
outputting the Z-axis value, so the array must have at least three
elements. This also triggered Coverity CID 189741.

Fixes #11482

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-11-19 15:06:14 +02:00
Johan Hedberg 381a9dd1ee samples: reel_board/mesh_badge: Fix comparison with unsigned number
This comparison was always supposed to be > rather than >=. Fixing
this also fixes Coverity CID 189740.

Fixes #11483

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-11-19 15:06:14 +02:00
Andrzej Głąbek 20202902f2 dts_fixups: Use DT_ prefix in all defined labels not related to Kconfig
These changes were obtained by running a script  created by
Ulf Magnusson <Ulf.Magnusson@nordicsemi.no> for the following
specification:

1. Read the contents of all dts_fixup.h files in Zephyr
2. Check the left-hand side of the #define macros (i.e. the X in
   #define X Y)
3. Check if that name is also the name of a Kconfig option
   3.a If it is, then do nothing
   3.b If it is not, then replace CONFIG_ with DT_ or add DT_ if it
       has neither of these two prefixes
4. Replace the use of the changed #define in the code itself
   (.c, .h, .ld)

Additionally, some tweaks had to be added to this script to catch some
of the macros used in the code in a parameterized form, e.g.:
- CONFIG_GPIO_STM32_GPIO##__SUFFIX##_BASE_ADDRESS
- CONFIG_UART_##idx##_TX_PIN
- I2C_SBCON_##_num##_BASE_ADDR
and to prevent adding DT_ prefix to the following symbols:
- FLASH_START
- FLASH_SIZE
- SRAM_START
- SRAM_SIZE
- _ROM_ADDR
- _ROM_SIZE
- _RAM_ADDR
- _RAM_SIZE
which are surprisingly also defined in some dts_fixup.h files.

Finally, some manual corrections had to be done as well:
- name##_IRQ -> DT_##name##_IRQ in uart_stm32.c

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-11-13 10:44:42 -06:00
Grzegorz Kolodziejczyk 2cce0a6f9f samples: reel_board/mesh_badge: Introduce sensor model
Patch introduces sensor model to mesh badge application. Along with
model definition a sensor get message is implemented and handled on
server.

Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@codecoup.pl>
2018-11-13 12:33:14 +02:00
Grzegorz Kolodziejczyk 5148e68da5 samples: reel_board/mesh_badge: Add generic on off model
Add generic on/off model which drives green led on board.

Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@codecoup.pl>
2018-11-13 12:33:14 +02:00
Grzegorz Kolodziejczyk 92117dc27c samples: reel_board/mesh_badge: Add sensors
This patch introduces new screen to mesh_badge application. Sensor
screen shows measurements from board sensors updated every 2 seconds.

Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@codecoup.pl>
2018-11-13 12:33:14 +02:00
Andrzej Głąbek 386846fbff samples: reel_board: Change a DTS-derived label to the alias one
Change the label GPIO_KEYS_BUTTON_0_GPIO_CONTROLLER that is generated
for the DT node directly to the corresponding one generated through
the "sw0" alias (i.e. SW0_GPIO_CONTROLLER) to make it consistent with
other DT related labels used in this code (SW0_* and LED?_*).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-11-10 08:59:50 -05:00
Johan Hedberg 39155d55b6 samples: boards/mesh_badge: Fix checking for null in hello message
Use strncpy instead of memcpy to make sure copying stops at the first
null-character.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-11-06 22:31:24 +02:00
Johan Hedberg a19ca5cce6 samples: reel_board/mesh_badge: Fix null-termination of string buffer
The way the code is structured the buffer is always guaranteed to be
large enough, however perform explicit termination anyway to avoid
Coverity warnings.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-11-06 22:31:24 +02:00
Reto Schneider 7eabab2f5d samples, tests: Use semi-accurate project names
When using an IDE (e.g. Eclipse, Qt Creator), the project name gets
displayed. This greatly simplifies the navigation between projects when
having many of them open at the same time. Naming every project "NONE"
defeats this functionality.

This patch tries to use sensible project names while not duplicating
too much of what is already represented in the path. This is done by
using the name of the directory the relevant CMakeLists.txt file is
stored in. To ensure unique project names in the samples (and again, in
the tests folder) folder, small manual adjustments have been done.

Signed-off-by: Reto Schneider <code@reto-schneider.ch>
2018-10-27 21:31:25 -04:00
Johan Hedberg b0ad17d0a4 samples: reel_board/mesh_badge: Add statistics and new message
Add a new "heartbeat" message so that number of hops between nodes can
be discovered. Also add a statistics page which can be toggled using a
long key press, showing local information and the top message senders.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-10-27 11:16:30 +01:00
Johan Hedberg 7fd7be0fc6 samples: reel_board: Add Bluetooth Mesh badge demo app
Add a demo app for showcasing badge functionality together with
Bluetooth Mesh.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-10-24 22:06:46 +01:00