Commit graph

466 commits

Author SHA1 Message Date
Maureen Helm 9dea0315f7 samples: arduino_101: Add dts overlay and fixup to env sensing sample
Adds a board-specific dts overlay and fixup file to the arduino_101
environmental sensing sample, in preparation for making the sensor
drivers require dts.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-10-01 21:15:06 -05:00
Sebastian Bøe c0287695fb kconfig: Remove remnants of unimplemented BUILD_TIMESTAMP feature
The Kconfig option CONFIG_BUILD_TIMESTAMP became unused when
BUILD_VERSION was introduced, but it's option and parts of it's
implementation was not completely cleaned from the repository.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-09-26 22:18:29 +05:30
Daniel Leung 79e8f79498 boards/x86: up_squared: add sample app for GPIO
This adds a sample app to utilize GPIOs on the UP Squared
board.

Origin: Original

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-09-19 21:36:16 -04:00
Flavio Ceolin da49f2e440 coccicnelle: Ignore return of memset
The return of memset is never checked. This patch explicitly ignore
the return to avoid MISRA-C violations.

The only directory excluded directory was ext/* since it contains
only imported code.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-14 16:55:37 -04:00
Vikrant More ccade20ccf samples: mesh: nrf52: corrected Range status response
As per PTS, IUT is expected to return success for the
Range Get messages (Light Lightness Range Get for
MMDL/SR/LLNS/BI-01-C, Light CTL Temperature Range Get
for MMDL/SR/LCTLS/BI-01-C). This commit take care of
this issue.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-09-12 11:14:58 +03:00
Vikrant More 09e2cf3db0 samples: mesh: nrf52: corrected state Binding for Delta Level
Now if transition (instantaneous or non-instantaneous) is due
to delta level, then state binding would be as per it.

This is as per 3.3.2.2.3 of Bluetooth Mesh Model
Specification.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-09-12 11:14:58 +03:00
Vikrant More be27afb705 samples: mesh: nrf52: corrected spelling
Corrected spelling mistakes for content of enum defined in
transition.h & renamed some functions. Corrected comments
in main.c

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-09-12 11:14:58 +03:00
Vikrant More 864ebaaba6 samples: mesh: nrf52: revised status resp. behaviour & TT calculation
With this it is possible to get proper target value & remaining
time in status response from Servers when transition in progress.
If transition is not in progress then those things would not
get integrate into status response. This is as per Bluetooth
Mesh Model specification.

It is inspired concept from Bluetooth Mesh Developer study
Guide.

Also updated Transition Time (TT) related parameter calculation.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-09-12 11:14:58 +03:00
Vikrant More 6858cb417d samples: mesh: nrf52: corrected conditional compilation
Corrected conditional compilation directives defined in
publisher.c

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-09-12 11:14:58 +03:00
Vikrant More c805beeaaa samples: mesh: nrf52: initialized dev_uuid to some arbitrary value
Initialized dev_uuid defined in ble_mesh.c to some arbitrary value.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-09-12 11:14:58 +03:00
Vikrant More 89f00e6426 samples: mesh: nrf52: upgrade README.rst
Added Generic Default Transition Time Server & Client
Models names in list of Models supported by this App.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-09-12 11:14:58 +03:00
Emanuele Di Santo ea4f8b7d6c samples: nrf52: power_mgr: use dts-generated defines
This commit updates the power_mgr sample to use the dts-generated
defines instead of the aliases in board.h.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
2018-09-11 11:42:20 -05:00
Emanuele Di Santo 0a15793830 samples: nrf52: onoff-app: use dts-generated defines
This commit updates the onoff-app sample to use the dts-generated
defines instead of the aliases in board.h.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
2018-09-11 11:42:20 -05:00
Emanuele Di Santo 7fb051bc72 samples: nrf52: onoff_level_lightning_vnd_app: use dts-generated defines
This commit updates the onoff_level_lightning_vnd_app sample
to use the dts-generated defines instead of the aliases in board.h.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
2018-09-11 11:42:20 -05:00
Mieszko Mierunski 15813d343c boards: nrf: Changed GPIO default driver to NRFX shim
I removed GPIO configuration from board files and enabled them
as default in driver Kconfig file. All boards had GPIO ports
enabled that is why I decided to enable it by default.

Power management example was changed to use new driver.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-08-17 07:29:14 -07:00
Johan Hedberg f5026a11c9 samples/mesh: Fix dev_uuid initialization from identity address
With the recent changes to identity address handling the local
identity address is only guaranteed to be available once
settings_load() has been called. Move the initialization of dev_uuid
to the appropriate place.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-08-16 22:39:36 +03:00
Vikrant More 0aafcd6453 samples: mesh: nrf52 : to solve remaining PTS issues
Fixed coding style issues. Corrected conditional compilation
using pre-processor directives at proper location.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-08-15 21:28:49 +03:00
Sebastian Bøe 55ee53ce91 cmake: Prepend 'cmake_minimum_required()' into 'app' build scripts
Prepend the text 'cmake_minimum_required(VERSION 3.8.2)' into the
application and test build scripts.

Modern versions of CMake will spam users with a deprecation warning
when the toplevel CMakeLists.txt does not specify a CMake
version. This is documented in bug #8355.

To resolve this we include a cmake_minimum_required() line into the
toplevel build scripts. Additionally, cmake_minimum_required is
invoked from within boilerplate.cmake. The highest version will be
enforced.

This patch allows us to afterwards change CMake policy CMP000 from OLD
to NEW which in turn finally rids us of the verbose warning.

The extra boilerplate is considered more acceptable than the verbosity
of the CMP0000 policy.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-08-15 04:06:50 -07:00
Vikrant More 993c349a8a samples: mesh: nrf52: Transition Time support, Coding Style
Added transition time support. Now if NODE received optional
parameters then they would get entertained by it.

Added two new models that is Generic Default Transition Time
Server & Client resp. to complete overall architecture to
support newly introduced architecture.

With this it was possible to implement
gen_move_set/gen_move_set_unack message handlers.

Removed redundancy from App & revised overall implementation.
Fixed Bugs. Upgraded coding style. Added & replaced comments to
improve code readability. Improved printk messages.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-08-15 09:09:29 +03:00
Vikrant More 6efb173edb samples: mesh: nrf52: Time filtering, Coding style & others
Added time stamp based message filtering as per Bluetooth Mesh
Developer study guide for each Server. Now even if message
source address & TID is same even after 6 seconds then
that will get proceed otherwise will get ignored.

Coding style improvements.

If particular Server model receive Prohibited values as per
Mesh Model Specification then that message will not get entertained.

Now proper status code will get send if user upgrade
light_lightness_range_state & light_ctl_temperature_range_state.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-08-15 09:09:29 +03:00
Vikrant More 26322d651b samples: mesh: nrf52: upgrade state binding
Upgraded state binding algorithm & created separated
file for it. Moved light_default_status_init() from
device_composition.c to main.c. Shorten variables names
defined in struct light_lightness_state.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-08-15 09:09:29 +03:00
Subramanian Meenakshi Sundaram df20ebd64a samples: boards: Fix incorrect min max range validation
Fixing the min max range validation where condtions on
upper and lower bound are logically 'ANDed'. Fixing it
by logical ORing the result.

CID: 18325, 18326
Fixes Issue #9289
Fixes Issue #9290

Signed-off-by: Subramanian Meenakshi Sundaram <subbu147@gmail.com>
2018-08-13 19:35:13 -07:00
Johan Hedberg 5708f1e8b1 Bluetooth: Add infrastructure to handle multiple identities
Make it possible to have multiple identity addresses as an LE
peripheral. For central role only the default identity is supported
for now. This also extends the flash storage in a backward compatible
way.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-08-13 19:53:22 +03:00
Sebastian Bøe b9e8cd1133 cmake: Refactor usage of target_link_libraries on Zephyr libraries
CMake has several prototypes/signatures for the function
'target_link_libraries'. This commit migrates the usage of
'target_link_libraries' on Zephyr CMake libraries from the old 'plain'
signature to the new '<PRIVATE|PUBLIC|INTERFACE>' signature.

For technical reasons the two signatures can not be mixed. Each
library must exclusively use either the old or new signature.

The 'old' plain signature is equivalent to using the PUBLIC
signature. Migrating to use 'PUBLIC' is therefore expected to be a
safe change.

After the migration it will be possible to use the PRIVATE and
INTERFACE signatures on Zephyr CMake libraries. This is useful for
instance to fix issue 8438.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-08-09 14:03:10 +02:00
Armando Visconti aa609faab3 samples: board: 96b_argonkey: remove led blinking
The LED part is taking too much time. Let's skip the
led blinking part.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-07-30 09:20:00 -05:00
Johan Hedberg 8c1c1641fe Bluetooth: Mesh: Improve outgoing segment count configuration
The Mesh specification doesn't support more than 32 transport layer
segments, the way the number was so far derived from the advertising
buffer count could result in a highre numbe than 32, thereby wasting
memory. Make the number of supported segments build-time configurable
through a new BT_MESH_TX_SEG_MAX configuration option.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-07-25 18:16:45 +03:00
Ramakrishna Pallala 9a68fea98c samples: boards: quark_se_c1000: Do not enter LPS states on test exit
Do not enter Low Power states once the test execution is done. This
is needed to avoid the flashing issues which were seen when system
is in deep sleep states.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-07-25 07:21:17 -04:00
Luiz Augusto von Dentz 2e2f122d51 Bluetooth: samples: Make use of BT_LE_ADV_OPT_USE_NAME
Use BT_LE_ADV_OPT_USE_NAME whenver possible since it does properly
track updates.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-07-23 14:45:58 +03:00
Anas Nashif 4208642a53 samples: fix u32_t type usage
We have been mixing u32_t and uint32_t. Using u32_t when the API expects
something else.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-07-18 12:32:23 -04:00
Ramakrishna Pallala afad09dba6 samples: boards: nrf52: Refactor power_mgr app code
Removed redundant and unused config options from conf files.

Added separate files for handing power management and device
handling functions.

Added the PM policy based on the next timeout event instead of
simply advancing to the next power state.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-07-15 22:48:34 -04:00
Vikrant More b8b94280b9 samples: mesh: boards: nrf52: avoid responding to wrong messages
If temperature value are out of range which is from 0x0320
to 0x4E20 then no relevant get message handler will execute.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-07-13 15:48:16 +03:00
Vikrant More 460c585406 samples: mesh: boards: nrf52: edit struct for gen. level
Edit data types defined in struct for gen. level.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-07-13 15:48:16 +03:00
Vikrant More 00cd491ffe samples: mesh: boards: nrf52: modifications as per 3.3.2.2.3
Added extra case under state binding's switch statement for
Lightness i.e DELTA_LEVEL. Also upgrade binding between

1. root element's LEVEL state & Light Lightness Actual state.
2. Light Lightness Linear state & Light Lightness Actual state.
3. Light CTL lightness state & Light Lightness Actual state

This is as per Bluetooth Mesh Model Specification 3.3.2.2.3.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-07-13 15:48:16 +03:00
Vikrant More 2708ce561d samples: mesh: boards: nrf52: randomize publishers TID on boot
Now on reboot, NODE as client do not start message publishing
with TID = 1. Instead of that it would start with any random value
from 0 to 255.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-07-13 15:48:16 +03:00
Vikrant More 06f69b5c64 samples: mesh: improved code readability & remove redudancy
Improved code readability by declaring some pre-processor
definitions in device_composition.c

Remove model_instance variable from some structures define in
device_composition.h & its relevant code.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-07-13 15:48:16 +03:00
Vikrant More c58f102c90 samples: mesh: boards: nrf52: improved vendor model
Update Vendor model message handlers & make it to work as per
TID like other Models defined by SIG. Removed union based data
extraction mechanism.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-07-13 15:48:16 +03:00
Vikrant More 170ca38b75 samples: mesh: boards: nrf52: upgrade to pass PTS test
Updated state Binding as per PTS test requirements. Now if
gen_onoff_server & gen_onpowerup_server received Prohibited values
then they will not react on it further. Plus make necessary changes
wherever required for message handlers as per Mesh Model
Specification which is mostly regarding to default & range values.
Now right Status code would get publish in response to set lightness
& temperature range. Also upgrade Message handler
gen_delta_set_unack() algorithm as per PTS requirements.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-07-13 15:48:16 +03:00
Vikrant More c789662f77 samples: mesh/onoff_level_lighting_vnd_app: improved state binding
Removed redundancy from state binding & make it simplified.
Avoid partial state binding in case of state_binding() function
get called with invalid or IGNORE arguments.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-07-04 17:57:19 +03:00
Vikrant More 31cf5672dc samples: mesh/onoff_level_lighting_vnd_app: corrected printk message
Corrected printk messgae for GET handler for Generic Power OnOff
server.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-07-04 17:57:19 +03:00
Vikrant More 182be3b49a samples: mesh/onoff_level_lighting_vnd_app: fix buffers length
Changes buffer length for all GET handlers as per patter of
 < 2 + parameters length (in bytes) + 4 >

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-07-04 17:57:19 +03:00
Vikrant More 0febf03dc8 samples: mesh/onoff_level_lighting_vnd_app: Vendor Model upgrade
This patched improved architecture of already implemented Vendor
Model. Now there are 4 separate opcodes for Vendor viz;
get, set, set_unack & status. This helps to setup
<command + response> mechanism.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-07-04 17:57:19 +03:00
Armando Visconti 2ad2d07ce8 samples: board: 96b_argonkey: Add testing of 12 on-board leds
Enable the TI LP3943 led controller and test the 12 on-board leds.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-07-03 12:20:51 -05:00
Vikrant More e8ddd6def8 samples: mesh/onoff_level_lighting_vnd_app: edited message handlers
Removed TID implementations wherever it is not required as per
Bluetooth SIG Mesh Model Specification. Removed unnecessary
comments. Add status code value to get publish along with
Light Lightness range status message.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-07-02 13:47:44 +03:00
Vikrant More 34d475ff4e samples: mesh/onoff_level_lighting_vnd_app: fix bug in state binding
Fixed bug in binding of Light Lightness Actual state & Generic Level
state of Root Element.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-07-02 13:47:44 +03:00
Vikrant More 54df5b519a samples: mesh/onoff_level_lighting_vnd_app: update handlers mapping
Update message handlers & correct nubmber of bytes that every
handlers should fetch for their further processing as per
Bluetooth SIG Mesh Model Specification.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-07-02 13:47:44 +03:00
Vikrant More b3e7a8f67b samples: mesh/onoff_level_lighting_vnd_app: update publication context
Update models publication parameter lengths as per Mesh Model
Specification.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-07-02 13:47:44 +03:00
Vikrant More 11cb462df5 samples: mesh/onoff_level_lighting_vnd_app: States binding corrections
Make corrections in state binding of Servers as per Mesh Model
Specifications. Previously, when OnPowerUp state equal to 0x02,
then Light Lightness actual state was not assign to last power
down value. Plus when Generic OnOff state changes by client,
then Light Lightness Actual state value get assigned as Light
Lightness Last value instead of default one.
All these issues has fixed here.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-06-25 22:52:16 +03:00
Vikrant More 938f12e99d Bluetooth: Mesh: Gen. OnOff, Gen. Level, Lighting & Vendor Models
This is a application demonstrating a Bluetooth mesh node in
which Root element has following models

- Generic OnOff Server
- Generic OnOff Client
- Generic Level Server
- Generic Level Client
- Generic Power OnOff Server
- Generic Power OnOff Setup Server
- Generic Power OnOff Client
- Light Lightness Server
- Light Lightness Setup Server
- Light Lightness Client
- Light CTL Server
- Light CTL Setup Server
- Light CTL Client
- Vendor Model

And Secondary element has following models

- Generic OnOff Server
- Generic OnOff Client
- Generic Level Server
- Generic Level Client
- Light CTL Temperature Server

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-06-23 22:42:45 +02:00
Vikrant More 1bbfdf1d1a samples: mesh/onoff-app: Enable persistent storage support
Enable persistent storage support in
samples/boards/nrf52/mesh/onoff-app.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2018-06-15 15:47:27 +02:00
Luiz Augusto von Dentz 68de9d5d66 Bluetooth: Use Characteristic attribute whenever possible
With updates to bt_gatt_notify and bt_gatt_indicate it is now possible
to pass the Characteristic attribute instead of its value which makes
the code able to verify if attribute properties are set correctly.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-06-11 14:41:19 -04:00
Kumar Gala 27f05e3929 samples: board: 96b_argonkey: Remove dead code
CONFIG_ILS29035 isn't defined anywhere, so remove code associated with
it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-23 17:57:06 -04:00
Armando Visconti 02bb83bec2 samples/boards: Add ArgonKey test
Test ArgonKey board. It provides an example of how to test
all the sensors on-board. It currently enables by default
following sensors:

   LPS22HB pressure/temp
   HTS221 humidity
   LSM6DSL accel/gyro plus LIS2MDL magn connected to it.
   VL53L0x proximity

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-05-18 13:10:33 -05:00
Jan Van Winkel ca16779d9e driver: ILI9340 LCD display driver
Minimal driver for ILI9340 LCD display driver including support
for adafruit 2.2" LCD display (1480)

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-05-18 20:21:45 +03:00
Marti Bolivar 7588680afb samples: olimex_stm32_e407: ccm: trivial README.rst fix
Use zephyr-app-commands for portability instead of assuming Make and
Unix, and add a missing "run" goal.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-05-17 07:41:56 +03:00
Ramakrishna Pallala 769c3a8bf2 samples: boards: Remove deprcated k_call_stacks_analyze API
Replace deprecated k_call_stacks_analyze() API with
k_thread_foreach() API.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-05-15 13:43:00 +03:00
Luiz Augusto von Dentz 1b038f2941 Bluetooth: GATT: Make BT_GATT_CHARACTERISTIC declare its value
This ensures the every characteristic has a value attribute declared
with the same UUID since the old macro did not declare the value the
application would normally have to declare one itself using a different
UUID which is not allowed.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-05-14 18:51:22 +03:00
Johan Hedberg 8703ffad23 Bluetooth: Mesh: Redesign element and storage info for models
Keeping the model struct same sized, change the element pointer to two
indexes, and add a flags member that will be used to track pending
storage actions.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-05-11 16:44:43 +03:00
Anas Nashif b3275d651c tests/samples: add hw dependencies
Add hardware dependencies and filters to make sure we do not explode if
for example we try to build a sample/test using rtc when the platform
does not support that.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-01 19:10:27 -04:00
Anas Nashif 65600d4723 samples: power_mgr: add harnesss configuration
This test prints out to the console, when testing on real hardware,
parse output and compare to what we are expecting to avoid timeouts.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif 156091fba6 samples: sample.yaml cleanup
Cleanup test names and filtering and add console harness support where
needed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Armando Visconti 87d6c50e47 sensors: Add separation between ambient and die temperature
Some device include a temperature sensor, usually used as a
companion for helping in drift compensation, that measure the
die temperature. This temperature IS NOT related to the the
ambient temperature, hence a clean separation between the two
is required.

This commit introduces a clean separation between the two
types of temperature leaving the old deprecated definition
still there.

The list of current drivers that read the die (and not the ambient)
temperature is the following:

 - adxl362
 - bma280
 - bmg160
 - bmi160
 - fxos8700
 - lis3mdl
 - lsm6ds0
 - lsm6dsl
 - lsm9ds0
 - mpu6050

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-04-03 22:29:11 -04:00
Johan Hedberg b9588d8eb6 Bluetooth: Mesh: Switch to using Linux Foundation Company ID
The Linux Foundation now has an assigned Company Identifier, so switch
to using that.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-03-05 19:54:21 -05:00
Erwin Rol 6c0e69e7fd samples: olimex_stm32_e407: CCM usage example
Add an example program showing the use of the STM32 CCM.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2018-02-13 12:36:22 -06:00
Johan Hedberg ac1360f0a7 Bluetooth: Mesh: Convert to new net_buf_simple APIs
Convert the mesh code to use the new net_buf_siple APIs. This has the
benefit of saving 4 bytes off the stack due to the not needed pointer.
Also update the publication context helpers to map to the new
net_buf_simple API in an intuitive way.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-13 14:00:08 +02:00
Luiz Augusto von Dentz 800bfaf9a7 Bluetooth: UUID: Remove macros defining 16 bit values
Application should normally declare a bt_uuid with proper type and then
use bt_uuid_cmp.

Fixes #5162

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-02-13 13:33:48 +02:00
David B. Kinder 8cdd9bed6c doc: fix duplicate sample doc titles
Two docs listed in the Samples an Demos TOC had the same title displayed
in the board-specific samples section, "Power Management Demo".  Give
both sample docs a more specific title.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-02-12 21:59:54 -05:00
Paul Sokolovsky b7623a85b0 sensors: Redefine SENSOR_CHAN_HUMIDITY in percents, not milli-percents.
Based on the discussion in #5693, the reason why humidity was defined
in milli-percent was likely following Linux which defines it as such
in its sensor subsystem:
http://elixir.free-electrons.com/linux/latest/source/Documentation/ABI/testing/sysfs-bus-iio#L263

However, Linux defines temperature in milli-degrees either, but
Zephyr uses degrees (similarly for most other quantities). Typical
sensor resolution/precision for humidity is also on the order of 1%.

One of the existing drivers, th02.c, already returned values in
percents, and few apps showed it without conversion and/or units,
leading to confusing output to user like "54500".

So, switching units to percents, and update all the drivers and
sample apps.

For few drivers, there was also optimized conversion arithmetics
to avoid u64_t operations. (There're probably more places to
optimize it, and temperature conversion could use such optimization
too, but that's left for another patch.)

Fixes: #5693

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-05 14:10:39 +01:00
Johan Hedberg 8fc4c99496 Bluetooth: Remove redundant AD parsing check
A few lines earlier the code bails out in case len is 0. Checking for
buf->len < 1 is the same as checking for buf->len == 0. Since len is
guaranteed to be > 0 here the check len > buf->len implicitly checks
for buf->len == 0, i.e. the second test can be removed.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-01-31 07:01:10 -08:00
Anas Nashif 33592e8aa8 cmake: remove IS_TEST handling
Depending on a path inside the Zephyr tree to determine if we are a test
does not scale. Also some samples were marked as TEST while they are
not, just to get some options defined for tests.

Idenitfying a test will be addressed in another patch introducing
CONFIG_TEST.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-08 10:03:57 -05:00
Anas Nashif c78296dab4 tests: remove obsolete CONFIG_MDEF
CONFIG_MDEF is no more..

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-08 08:08:45 -05:00
Anas Nashif eba1bbd705 samples: remove more build_only tags
Remove build_only and add harness type needed for the sample/test to
allow running with sanitycheck and on devices once we have harness
support.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Ramakrishna Pallala b82dfb479b samples: boards: add sample for Altera Nios-II PIO core
Add a sample application for Nios-II PIO core on Altera MAX10 board.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2017-12-21 12:02:24 -08:00
Sebastian Bøe cf6cb590df cmake: Don't link with subsys__bluetooth unnecessarily
It is only necessary to link with subsys__bluetooth if the path
"subsys/bluetooth" is needed as an include directory. None of the
samples have this need.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2017-12-19 12:46:03 -05:00
Kumar Gala dfce457ebe samples: mesh/onoff-app: fix whitelist typo
Board name is nrf52840_pca10056 (with an underscore) instead of
nrf52840-pca10056 (with a dash).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-12-14 14:02:09 -05:00
Anas Nashif 2c96dacf0a samples: mesh/onoff-app: fix sample.yaml syntax
Also, remove build_only, we can run on the whitelisted platform.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-14 13:04:51 -05:00
Steve Brown bce1b974f0 samples: onoff-app: Add OnOff Model for the Nordic nRF52840-PDK board
Signed-off-by: Steve Brown <sbrown@cortland.com>

---

The updates to BlueZ' meshctl have not been submitted.

I am submitting this PR only for review. It could be committed
after the patches for the meshctl commands are applied.
2017-12-14 08:27:05 +02:00
Anas Nashif 23f81eeb42 tests/samples: fixed yaml syntax
Use a map directory, avoid the list which makes parsing a bit
cumbersome.

Fixes #5109

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-11 14:47:08 -05:00
Youvedeep Singh 691d709943 samples: nrf52: power_mgr: Increase idleness for main thread
Increase sleep time for main thread (1 sec to 1 minute) to keep SOC
in Low Power State for longer time. Currently nrf SOC is entering into
low power state and exiting immedately after 1 sec.
With this change SOC will wake stay in Low Power State till GPIO is
pressed or sleep time expired (whichever is earlier).

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-11-18 11:21:13 -05:00
Sebastian Bøe 49e7ca957e cmake: set IS_TEST in the samples that were including Makefile.test
For an unknown reason, various samples in KBuild were including
Makefile.test, this had some desired benefits, one of which is that
the popular BOOT_BANNER appears. The CMake-equivalent of including
Makefile.test is setting the flag IS_TEST. This commit reverts the
behaviour of the samples back to how it was pre-cmake.

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-16 08:26:25 -05:00
Carles Cufi bd9d38b5bd samples: boards: Convert doc to CMake
Convert doc of samples/boards to CMake.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-11-12 21:13:23 -05:00
Sebastian Bøe 0829ddfe9a kbuild: Removed KBuild
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Sebastian Bøe 12f8f76165 Introduce cmake-based rewrite of KBuild
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.

Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.

This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.

For users that just want to continue their work with minimal
disruption the following should suffice:

Install CMake 3.8.2+

Port any out-of-tree Makefiles to CMake.

Learn the absolute minimum about the new command line interface:

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..

$ cd build
$ make

PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Youvedeep Singh 3a179e29b0 samples: boards: nrf52: test demo for nrf52 power management
This sample tesecase provides sample code :-
1. Triggers Low Power tasks into nrf52 SOC (CONST LAT and LOW PWR)
2. Triggers System Off state.
3. Wake up device through port Event by GPIO (Button 1).

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-11-06 09:29:10 -05:00
Harry Jiang 17404abed3 samples: environmental_sensing: fix the data type for read_u32()
Signed-off-by: Harry Jiang <explora26@gmail.com>
2017-10-17 09:10:26 +03:00
Anas Nashif 0356590df5 tests: samples: fix yaml syntax
Fix indentation and syntax and make it pass yamllint tool.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-15 08:15:00 -04:00
Johan Hedberg 8f168c85f7 samples: microbit/pong: Fix incorrect placement of parenthesis
The code was causing only one byte of data to be placed in timeout
instead of sizeof(timeout) as intended.

Coverity-CID: 170744

Fixes #4057

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-09-26 12:55:14 +03:00
Anas Nashif f7b2484219 samples: add missing sample.yaml and fix build
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-09-12 17:21:08 -07:00
Johan Hedberg 2975ca0754 Bluetooth: Kconfig: Rename CONFIG_BLUETOOTH_* to CONFIG_BT_*
The API name space for Bluetooth is bt_* and BT_* so it makes sense to
align the Kconfig name space with this. The additional benefit is that
this also makes the names shorter. It is also in line with what Linux
uses for Bluetooth Kconfig entries.

Some Bluetooth-related Networking Kconfig defines are renamed as well
in order to be consistent, such as NET_L2_BLUETOOTH.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-08-09 11:14:19 +03:00
Andrew Boie 65a9d2a94a kernel: make K_.*_INITIALIZER private to kernel
Upcoming memory protection features will be placing some additional
constraints on kernel objects:

- They need to reside in memory owned by the kernel and not the
application
- Certain kernel object validation schemes will require some run-time
initialization of all kernel objects before they can be used.

Per Ben these initializer macros were never intended to be public. It is
not forbidden to use them, but doing so requires care: the memory being
initialized must reside in kernel space, and extra runtime
initialization steps may need to be peformed before they are fully
usable as kernel objects. In particular, kernel subsystems or drivers
whose objects are already in kernel memory may still need to use these
macros if they define kernel objects as members of a larger data
structure.

It is intended that application developers instead use the
K_<object>_DEFINE macros, which will automatically put the object in the
right memory and add them to a section which can be iterated over at
boot to complete initiailization.

There was no K_WORK_DEFINE() macro for creating struct k_work objects,
this is now added.

k_poll_event and k_poll_signal are intended to be instatiated from
application memory and have not been changed.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-10 11:44:56 -07:00
Anas Nashif c69de8b146 samples: remove reference to nimble
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Johan Hedberg 30beef9419 Bluetooth: GATT Introduce BT_GATT_CCC_MAX helper define
The worst-case maximum number of CCC entries we need is actually
MAX_CONN + MAX_PAIRED. Provide a helper define for it and use it
whenever appropriate.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-07-04 17:30:40 +03:00
Anas Nashif dc36e905b6 samples: environmental_sensing: update filtering
Build only for arduino 101 and update title and description.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-22 09:22:48 -04:00
Anas Nashif 470c5f3189 tests: remove testcase.ini files
We now use yaml files.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-21 20:56:53 -04:00
Anas Nashif cc24f4b03c tests: samples: convert testcase files to yaml
This will prepare test cases and samples with metadata and information
that will be consumed by the sanitycheck script which will be changed to
parse YAML files instead of ini.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-21 20:56:53 -04:00
David B. Kinder a741c00a08 doc: fix references to moved files
Some recent PRs moved sample files to a new location

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-06-20 18:26:53 -04:00
Anas Nashif 19e78bcfe1 samples: move quark se power samples to boards/
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 21:23:11 -04:00
Anas Nashif f7c226400d samples: move environment sensing to boards
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 21:23:11 -04:00
Luiz Augusto von Dentz 79af35991b Bluetooth: GATT: Add bt_gatt_register_service
This adds bt_gatt_register_service using bt_gatt_service which contains
the attribute array that is then added to the database saving a pointer
in each and every attribute declared.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Luiz Augusto von Dentz d837a6ec4b Bluetooth: GATT: Add GAP service by default
GAP is mandatory service and now that the db can only be build
dynamically there is no reason to keep the applications registering it.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Luiz Augusto von Dentz b3cfabab63 Bluetooth: Remove CONFIG_BLUETOOTH_GATT_DYNAMIC_DB
Removes CONFIG_BLUETOOTH_GATT_DYNAMIC_DB in preparation to the
introduction of bt_gatt_unregister.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Johan Hedberg d2ba7950c5 samples: boards/microbit: Use 250 ticks per second for smooth display
To avoid display flickering, use 250 ticks per second instead of the
default 100.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-30 12:29:11 +03:00
Johan Hedberg a90735d64c samples: microbit/pong: Disable advertising when connected
The state machine of the game assumes that the user needs to
explicitly re-select multiplayer game when disconnected. We need to
therefore make sure that advertising stays off as soon as the first
connection happens.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-30 10:11:09 +03:00
Johan Hedberg eb89db26b5 samples: microbit/pong: Fix disabling sound when ending game
Occasionally the sound might stay enabled for the restart timeout (2
seconds) if the ball would hit the wall right before missing the
paddle. Ensure that it's disabled whenever the game ends.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-30 10:11:09 +03:00
Johan Hedberg 1bb9a04912 samples: microbit/pong: Fix refreshing display upon disconnect
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-29 17:31:30 +03:00
Johan Hedberg 190b0d1a10 samples: microbit/pong: Filter out spurious button presses
The buttons on the microbit cause quite easily "ghost" key presses.
Add a simple filter that ignores button presses from the same button
that happen less than 100ms from each other.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-29 17:31:30 +03:00
Johan Hedberg 0b16e8ada5 samples: microbit/pong: Increase ISR stack size
The stuff that the GPIO button callback does (in particular the printk
calls) requires more stack space from the ISR stack. Increase it to 1k
from the default 640.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-29 17:31:30 +03:00
Johan Hedberg 3357813373 samples: microbit/pong: Analyze kernel stacks periodically
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-29 17:31:30 +03:00
Johan Hedberg 9e2fb2f3ad samples: microbit/pong: Add basic sound support
Add beeps whenever the ball hits the walls or the paddle. Requires a
piezo buzzer connected to pin 0.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-23 14:46:02 -07:00
Johan Hedberg 5e59f13ca3 samples: microbit/pong: Add BLE-based multiplayer support
Add support for connecting two micro:bit devices to play pong between
themselves.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-23 14:46:02 -07:00
Johan Hedberg 9a7cb7134a samples: microbit/pong: Add initial draft of a pong game
Add initial draft of a pong game using the display on the micro:bit
and its two buttons. This draft only supports a solo game where the
ball bounces from the "roof" and lets the player play against himself.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-23 14:46:02 -07:00
Kumar Gala e547533435 samples: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I08c682bfc0b80dfa88de859e90a011bcd2db2762
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 09:53:53 -05:00
Johan Hedberg 191cb2d0fc samples/boards/microbit: Add sound sample
Add a sample demonstrating sound output using PWM to a piezo buzzer
connected to the external edge connector port P0.

Change-Id: I8c0902fd935f2eb3b9979476a7540e7a0216ca63
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-18 01:55:10 +00:00
Johan Hedberg d7a189d2ec drivers: display: mb_display: Unify image and string APIs
Both the string and image rendering may want to take advantage of
scrolling and sequential display capabilities. Consolidate the APIs so
that there's a single one for images (mb_display_image) and a single
one for strings (mb_display_print). Both take a duration parameter for
the per-frame duration as well as a mode parameter which specifies
sequential vs scrolling behavior as well as an optional looping flag.

Change-Id: Ia092d771e3f1b94afd494c7544dab988161c539e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-06 00:59:30 +00:00
David B. Kinder 0f77021ba7 doc: add labels to board-specific sample docs
Docs need a label at the top so we can use :ref:`labelname`
to create a link to that doc from other docs.

Change-Id: Ib2d9b1cc4144bd84b1b89691a80dffd99212289d
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-04 20:47:53 +00:00
Johan Hedberg 7e5df0cc02 drivers: display: Enhance BBC micro:bit string output capabilities
Add a new mb_display_print() API which takes printf-style parameters
and outputs scrolling text instead of one character at a time. The
existing mb_display_str() API is renamed to mb_display_string() for
consistency, and now also takes printf-style parameters.

Change-Id: I59c42bcd74c62f05ecb6d097dc808b9e5c1984c5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-04 13:54:00 +03:00
Johan Hedberg 380d24de1d drivers: Add support for BBC micro:bit LED display
Adds a simple driver to access the 5x5 LED display found on BBC
micro:bit boards. The display is so limited that no effort is done to
try to integrate with the existing console (which would likely make
the display unusable). Instead, dedicated mb_display_* APIs are added
that are specific to this display.

References:

 https://www.microbit.co.uk/device/screen
 https://lancaster-university.github.io/microbit-docs/ubit/display/

Jira: ZEP-1990
Change-Id: I431b5b358b5f07592a60d3aed87eaab6ac20ce25
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-04 08:14:36 +03:00