As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.
Most of these changes were automated using coccinelle with the following
script:
@@
@@
- void
+ int
main(...) {
...
- return;
+ return 0;
...
}
Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.
Signed-off-by: Keith Packard <keithp@keithp.com>
This will enable the use of stm23f072b_disco on this sample.
- Set pwm3 as tim3_ch1_pc6 since red led is using PC6/ TIM3_CH1.
Signed-off-by: Scott Chao <scott_chao@wistron.com>
Not all toolchains support newlib so tests that require newlib need
to have a filter to we don't try and build those tests on those
testcases. Add the following to samples.yaml to handle the issue:
filter: TOOLCHAIN_HAS_NEWLIB == 1
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
When running the testcase libraries.hash_map.newlib.cxx_unordered_map.djb2
of this samples/basic/hash_map, it appears that some platforms
have a too low stack size.
This PR is increasing that value to pass the testcase.
Signed-off-by: Francois Ramu <francois.ramu@st.com>
The fractional part of the divider value is a 4 bit value. Setting it to
255 leads to an overflow in pwm_rpi_get_clkdiv(). This has resulted in a
slight deviation from the reported timing, which is btw. printed in nsec.
Fixes: c5cb0d1a3b ("samples: blinky_pwm: Fix sample for rpi_pico")
Signed-off-by: Oliver Barta <o.barta89@gmail.com>
Switch to using the dedicated `gpio_is_ready_dt`
function instead of the raw `device_is_ready`.
Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
Switch to using the dedicated `gpio_is_ready_dt`
function instead of the raw `device_is_ready`.
Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
integration_platforms help us control what get built/executed in CI and
for each PR submitted. They do not filter out platforms, instead they
just minimize the amount of builds/testing for a particular
tests/sample.
Tests still run on all supported platforms when not in integration mode.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Fixes the channel 2 PWM pinmux adds servos and PWM LEDs.
Required to operate servo motors and status lighting.
Tested on RDDRONE board.
Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
Co-authored-by: Sumit Batra <sumit.batra@nxp.com>
Co-authored-by: Landon Haugh <landon.haugh1@gmail.com>
The RP2040 needs a DTS overlay for the PWM to work with the
blinky_pwm examples. This commit adds the required overlay.
Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
The commit bfb1040612 has renamed the
sample blink_led to blinky_pwm, however, the project still have the
former name: blink_led.
This renames the project to its new name: blinky_pwm.
Signed-off-by: Gaël PORTAY <gael.portay@gmail.com>
Use dts overlay to declare the pwm-led only when needed.
This is only used for demo purpose of PWM0 on RCAR gen3
boards (H3ULCB only at the moment).
Signed-off-by: Pierre Marzin <pierre.marzin@iot.bzh>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.
The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.
NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Having the LED device enabled in devicetree will now get the driver
enabled by default when CONFIG_LED=y is set. So we can remove
setting driver enabling Kconfig values in various .conf files.
Signed-off-by: Kumar Gala <galak@kernel.org>
Replace access to dts 'label' property (which we are phasing out)
with simple int as the serve the purpose for error report.
Signed-off-by: Kumar Gala <galak@kernel.org>
Updates device tree pin states definitions and node
descriptions to group pins sharing common properties.
Accordingly, updates in-tree overlays as well.
Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
Updates device tree pin states definitions and node
descriptions to group pins sharing common properties.
Accordingly, updates in-tree overlays as well.
Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
- update device tree pin states definitions and node
descriptions to group pins sharing common properties.
- update ESP32's in-tree overlays.
Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
Add overlay for espressif boards that does not have a built-in LED.
Add instructions on README file about the required LED connection.
Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
This commit moves the hardware configuration for ledc
peripheral to the device-tree instead of Kconfig.
Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
The overlay was accidentally pushed as part of another commit while
doing some pinctrl/pwm tests.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Linker files were not migrated with the new <zephyr/...> prefix. Note
that the conversion has been scripted, refer to #45388 for more details.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
In order to bring consistency in-tree, migrate all samples to the use
the new prefix <zephyr/...>. Note that the conversion has been scripted:
```python
from pathlib import Path
import re
EXTENSIONS = ("c", "h", "cpp", "rst")
for p in Path(".").glob("samples/**/*"):
if not p.is_file() or p.suffix and p.suffix[1:] not in EXTENSIONS:
continue
content = ""
with open(p) as f:
for line in f:
m = re.match(r"^(.*)#include <(.*)>(.*)$", line)
if (m and
not m.group(2).startswith("zephyr/") and
(Path(".") / "include" / "zephyr" / m.group(2)).exists()):
content += (
m.group(1) +
"#include <zephyr/" + m.group(2) +">" +
m.group(3) + "\n"
)
else:
content += line
with open(p, "w") as f:
f.write(content)
```
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
In order to be consistent with what is possible in Devicetree, always
take a period in nanoseconds. Other scales or units may be specified by
using, e.g., the PWM_MSEC() macros (all of them converting down to
nanoseconds). This change then deletes the "_nsec" and "_usec" versions
of the pwm_set call.
Note that this change limits the period to UINT32_MAX nanoseconds,
~4.3s. PWM is, in generali, used with periods below the second so it
should not be a problem.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The sample did not use PWM in a proper way: it relied on a PWM device
handle, but channel or flags were hardcoded in the code. This patch
changes the sample to use a local binding ("pwm-servo") where the `pwms`
property is defined. This allows to make use of pwm_dt_spec facilities,
reducing the overall sample complexity and making it more portable
without editing the source code. The custom binding also requires to
provide the minimum/maximum pulse width so that different servos can be
easily plugged in without the need to edit sources.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
- add `channel-gpios` property with GPIO assignment for the used PWM
channel to the `sw_pwm` node
- replace ambiguous "pin 21" in the sample's README with "pin P19"
that uses notation from the official micro:bit documentation and
is consistent with this pin number within the edge_connector node
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
At some recent point, directory <zephyr-root>/include was moved to
<zephyr-root>/include/zephyr. However, links from documentation to
Zephyr source on Github were not updated. Update them now.
Signed-off-by: Aleksandar Markovic <aleksandar.markovic.sa@gmail.com>
Samples should run on a board if they have the peripheral connected, in
this case, if any LED on the board is connected to a PWM output. A
shield could be used to demonstrate a sample on a board that doesn't
have the required peripheral. In this case, it was also unclear where
that "external LED" had to be connected, unless one checks where channel
1 for PWM1 is routed to. All board LEDs are connected to pins that
cannot be driven by PWM.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The board had PWM LEDs defined in the blinky_pwm sample, mainly because
it conflicts with SPI1 pinmux. A better approach is to still define the
PWM LEDs in the board but keep the PWM controller disabled by default.
Then, samples just need to enable the PWM controller (and disable SPI if
used simultaneously).
Also updated period to 20ms (reasonable value for a PWM-driven LED).
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The board had PWM LEDs defined in the blinky_pwm sample, mainly because
it conflicts with SPI1 pinmux. A better approach is to still define the
PWM LEDs in the board but keep the PWM controller disabled by default.
Then, samples just need to enable the PWM controller (and disable SPI if
used simultaneously).
Also updated period to 20ms (reasonable value for a PWM-driven LED).
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The board had PWM LEDs defined in the blinky_pwm sample, mainly because
it conflicts with SPI1 pinmux. A better approach is to still define the
PWM LEDs in the board but keep the PWM controller disabled by default.
Then, samples just need to enable the PWM controller (and disable SPI if
used simultaneously).
Also updated period to 20ms (reasonable value for a PWM-driven LED).
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
While the pwm-led0 alias may exist, it could happen that the node with
pwm-leds compatible is disabled, making the sample fail compilation.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Adding an overlay to configure the nucleo_l4r5zi for testing the pwm
blinky application on red led (PB14 on nucleo board)
Each has a specific pwm output from different timers/channels
Signed-off-by: Francois Ramu <francois.ramu@st.com>
The overlay are defined to run the samples application with PWM
feature on the nucleo_l073rz,nucleo_f091rc, nucleo_g474re
Signed-off-by: Francois Ramu <francois.ramu@st.com>
Blinky PWM sample minimum pwm period was too high for iMX.RT PWM module.
decrease the minimum pwm period so sample will pass pwm calibration
phase.
Fixes#38954
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>