This is similar to the LPD8806 sample, but uses the WS2812 driver
instead. The app configuration is a bit more finicky, so try to
provide helpful references. This could be made more beginner-friendly
with the addition of timing diagrams, etc., but this should be enough
for an experienced developer to use.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
This sample displays the colors red, green, and blue on consecutive
LEDs in an LED strip, moving the starting point where red begins
further down the strip at each time step. The color band wraps around
to the beginning when it reaches the end.
Since this is the first application in samples/drivers to have
documentation, add samples/drivers/drivers.rst as well, and include it
in the top-level toctree from samples/samples.rst.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
The WS2812 LED driver IC has a one-wire interface which encodes bit
values as pulse widths.
The ICs themselves are basically shift registers. Roughly speaking, a
"short" pulse shifts in a zero bit, a "long" pulse shifts in a one
bit, and an inter-pulse gap exceeding a reset time threshold causes a
pixel to latch the shifted-in color values. Each chip has an output
pin for daisy chaining. Refer to the chip datsheets and comments in
Kconfig.ws2812 for more details.
To meet timing without hogging the core, this driver generates pulses
using SPI. To work, this requires the MOSI line to stay low between
SPI frames, and for inter-frame delays to be less than the reset pulse
time.
There are other ways do it (PWM + DMA on some SoCs, GPIO bit-banging
if no other tasks need the core), but this is a reasonably
general-purpose implementation.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
LPD880x (e.g. LPD8803, LPD8806) devices are LED driver ICs which can
be controlled via a reduced SPI interface (clock and data only), and
support daisy chaining.
Add an led_strip driver for these devices.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
This API covers drivers for strips, or strings, of individually
addressable LEDs. Both RGB and grayscale LED strip drivers can be
implemented within these APIs.
The API only provides for updating the entire strip, since not all
strips support updating individual LEDs without affecting the others.
Subsequent patches will add individual driver support.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
All ztest_* apis now support format specifier which will
evetually help to pass variable arguments to ztest assert
apis in different test cases while showing error messages.
Signed-off-by: Punit Vara <punit.vara@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Remove CONFIG_NET_L2_ETHERNET, as it's automatically set by the
board. This effectively makes prj_frdm_k64f.conf fairly portable,
e.g. the same config can be used for frdm_kw41z whcih uses 802.15.4
connectivity instead.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This ensures DW_apb_i2c correctly transmits the slave address (7 or
10 bit) based on ic_10bitaddr_master when configured in master mode.
Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
The ic_tar and ic_sar were earlier set to 9 bits but now its
corrected to consider 10 bits.
Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
When the header file is located in the same directory as the source
file it is better to use a relative quote-include, e.g.
than a system include like
Avoiding the use of system includes in these cases is beneficial
because;
* The source code will be easier to build because there will be fewer
system include paths.
* It is easier for a user to determine where a quote-include header
file is located than where a system include is located.
* You are less likely to encounter aliasing issues if the list of
system include paths is minimized.
Authors:
Anas Nashif
Sebastian Bøe
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Recent commit fb7f6cfa97 ("net: lib: http: Fix invalid pointer
body_start") introduced logic to reset the response body_start pointer
when the response buffer was reused.
This check needs to be fixed so that it doesn't arbitrarily change
body_start when not needed.
The problem with the current check can be demonstrated by not setting
a response callback for request which generates a large response
spanning multiple packets.
In this case body_start is still valid (not reusing the response buffer
because there is no callback set), but it will be changed when the 2nd
packet is received and the "at" marker is located at the head of the
new packet (!= response_buffer).
Signed-off-by: Michael Scott <michael.scott@linaro.org>
This header doesn't need arch/cpu.h for anything in it, remove
to ease dependency inclusion dependencies.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Fix init_group bit clearing in _k_thread_group_leave()
Fix _k_object_uninit calling order. Though the order won't
make much difference in this case it is always good to destroy
or uninitialize in the reverse order of the object creation or
initialization.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
We only had a few hundred tests run when sanitycheck was first written,
and printing out the reasoning why tests were skipped seemed reasonable
at the time. Now that we are running tens of thousands of tests, this
is too much information.
The dump of what tests were skipped and why now requires two instances
of --verbose on the command line.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
_POLL_NUM_TYPES & _POLL_NUM_STATES are values of an enum, which the
preprocessor does not know about.
But the first of the removed lines needs to be evaluated by the
preprocessor using them.
The result is that the preprocessor will treat _POLL_NUM_TYPES
and _POLL_NUM_STATES as 0 in that expression, which would not seem the
intended behavior. It will also produce 2 warnings about this in each
file which includes kernel.h (lots)
=> lines 3779-3781 are be removed.
--------- The compiler warning:
include/kernel.h:3774:11: warning: "_POLL_NUM_TYPES" is not defined [-W
+ _POLL_NUM_TYPES \
^
include/kernel.h:3779:5: note: in expansion of macro ?_POLL_EVENT_NUM_U
^
include/kernel.h:3775:11: warning: "_POLL_NUM_STATES" is not defined [-
+ _POLL_NUM_STATES \
^
include/kernel.h:3779:5: note: in expansion of macro ?_POLL_EVENT_NUM_U
^
--------
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
When moving to the new CoAP API, I thought we would need to parse
incoming option values longer than 12 characters.
This hasn't proven to be true, so let's remove the auto-selection of
this config. If needed user can set this option later.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
Currently, we check the length of an option value in the
coap_packet_append_option() function. This isn't required as
we're appending to a net_pkt and not using struct coap_option
where the limitation is imposed.
Instead, we should check the option value length in
parse_option() where we assign the value to a struct
coap_option.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
Inform user if we could not install receive callback after
a connection is created in net-app client.
Coverity-CID: 178246
Fixes#4582
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Inform user if we could not install receive callback after
a connection is accepted in http server.
Coverity-CID: 178244
Fixes#4584
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If we run out of memory, then net_pkt might be null and we must
not access it.
Coverity-CID: 178235
Fixes#4593
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
No need to send FCS bytes as the monitor_15_4 is configured to not
expect them. If we change the monitor_15_4 to use them, then we would
need to put correct values into these two FCS bytes.
So cleanest solution is not to send FCS bytes at all.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The body_start field at http_client_ctx.rsp is used to check if this
fragment contains (a part of) headers or not.
If the device recived more than one fragment in one http response,
may cause re-use of the result buffer in function on_body().
Once the device re-use the result buffer, the body_start that point
to this buffer address will no longer be valid.
Signed-off-by: Ding Tao <miyatsu@qq.com>
Oftentimes, 15.4 PAN IDs are specified in hex. For example, that's
how Zephyr config specifies the default value. So, print them also
in hex, to avoid confusion.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Remove the RD client's stack in favor of using the engine's periodic
service to trigger RD client events. This saves 5K RAM of stack based
memory.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
Remove the stack from the device object and instead make use of
the periodic engine service which will trigger the device service
when it's ready.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
Stacks cost a lot of RAM in Zephyr. We have 3 total stacks in
the LwM2M lib. We can remove 2 of these if add a service handler
into the main LwM2M engine. Each service can register with this
handler so that they can be called based on their own periodic
timer. The handler itself will search through these registered
services and call them when they become due otherwise sleep
until another is ready.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
LwM2M is intended for constrained devices. The default samples
settings are quite large by that standard and can be reduced to
reflect actual usage.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
After the LwM2M sample was introduced several HW related defaults were
added to Kconfig. We no longer need separate prj*.conf files for K64F
and qemu_x86. Let's combine them into a single prj.conf file and
adjust documentation.
NOTE: This also adjusts README.rst
Signed-off-by: Michael Scott <michael.scott@linaro.org>
Let's use conservative defaults for the LwM2M library to enable
hardware with constrained resources. Users can increase where
necessary.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
Let's use snprintk for simple formatting to allow for possible disabling
of printf and protect calls to sprintf from string overruns.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
When using Leshan REST API to perform a discover OP on a client, only an
accept field is sent with "application/link-format". Current logic uses
the content-type to determine when a discover OP is indicated. Let's
handle this case as well.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
The C11 standard requires this. From 7.2 "Diagnostics <assert.h>"
paragraph 1:
> The header <assert.h> defines the assert and static_assert macros...
paragraph 3:
> The macro
> static_assert
> expands to _Static_assert.
Since static_assert is a keyword in C++11, don't define it if C++.
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
The C standard requires assert() to be a void result, so you
could write something like:
return assert(x), x;
From the C11 standard (7.2 Diagnostic <assert.h>):
> If NDEBUG is defined as a macro name at the point in the source file
> where <assert.h> is included, the assert macro is defined simply as
> #define assert(ignore) ((void)0)
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
Replacing the default paging scheme from 32-bit paging to
PAE paging in QEMU.
JIRA:ZEP-2511
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
Replace all controller asserts in control procedure responses
that checked for buffer availability with an implementation
that nacks request PDUs if there are no buffer to prepare
response PDUs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
There were decrements of TCP sequence numbers, inherited from FNET
stack implementation, as was used as an initial base. RFC793 does
not specify conditions for decrementing sequence numbers, so such
decrements are an artifact of FNET implementation. In Zephyr code,
we had to compensate for these decrements by extra increments
(including an increment-by-2). So, remove decrements and associated
extra increments to simplify the code.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Let's rename lwm2m_release_message() to lwm2m_reset_message()
and add a parameter to let the function know whether or not to
release the lwm2m_message resource back to the pool.
By adding the optional release parameter, we can keep the
lwm2m_message but reset the underlying net_pkt / net_buf resources.
This allows us to regenerate the net_pkt after determining
an error has occured. In this case, we don't want the previously
added net_pkt contents but we do want to maintain the message id,
token, etc.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
This patch moves from the ZoAP API in subsys/net/lib/zoap to
the CoAP API in subsys/net/lib/coap which handles multiple
fragments for sending / receiving data.
NOTE: This patch moves the LwM2M library over to the CoAP APIs
but there will be a follow-up patch which re-writes the content
formatter reader / writers to use net_pkt APIs for parsing
across multiple net buffers. The current implementation assumes
all of the data will land in 1 buffer.
Samples using the library still need a fairly large NET_BUF_DATA_SIZE
setting. (Example: CONFIG_NET_BUF_DATA_SIZE=384)
Signed-off-by: Michael Scott <michael.scott@linaro.org>
From RFC 7252, section 3
"The absence of the Payload Marker denotes a zero-length payload.
The presence of a marker followed by a zero-length payload MUST
be processed as a message format error."
Check empty payload when COAP_MARKER is found and add a test case to
cover it
Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
We removed the default values for:
* CONFIG_USB_DEVICE_VID
* CONFIG_USB_DEVICE_PID
So put some dummy values in the sample.yaml to get things building
again.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>