Like other STM32 series the STM32L4x SoCs have an internal voltage
reference source that need to be enabled.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Convert the LMP90xxx ADC driver from using k_sleep() to using
k_msleep() in order to resolve a compilation error caused by passing
an int to k_sleep().
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Use the new devicetree API. Remove per-board enabling of ADC_0 by
setting ADC_0 to default y when the 'adc' node label points at an
enabled node of the expected compatible (depending on SoC).
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
DT_CALL_WITH_ARG() is an internal implementation detail that should
not be used outside of devicetree.h.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Run the int_literal_to_timeout Coccinelle script to fix places where
it is clear that an integer duration is being passed where a timeout
value is required.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Kernel timeouts have always been a 32 bit integer despite the
existence of generation macros, and existing code has been
inconsistent about using them. Upcoming commits are going to make the
timeout arguments opaque, so fix things up to be rigorously correct.
Changes include:
+ Adding a K_TIMEOUT_EQ() macro for code that needs to compare timeout
values for equality (e.g. with K_FOREVER or K_NO_WAIT).
+ Adding a k_msleep() synonym for k_sleep() which can continue to take
integral arguments as k_sleep() moves away to timeout arguments.
+ Pervasively using the K_MSEC(), K_SECONDS(), et. al. macros to
generate timeout arguments.
+ Removing the usage of K_NO_WAIT as the final argument to
K_THREAD_DEFINE(). This is just a count of milliseconds and we need
to use a zero.
This patch include no logic changes and should not affect generated
code at all.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Replace all occurences of BUILD_ASSERT_MSG() with BUILD_ASSERT()
as a result of merging BUILD_ASSERT() and BUILD_ASSERT_MSG().
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
We have a number of cases that now look like:
#if DT_HAS_COMPAT(ti_lmp90077)
LMP90XXX_DEVICE(90077, 0, 16, 4);
#endif /* DT_INST_0_TI_LMP90077 */
The DT_INST_0_TI_LMP90077 comment is stale, and doesn't add much since
the #if associated with the #endif is just 2 lines up. Removing the old
comments seems the best cleanup.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add checks to prevent SPI transactions from being run in ISR
context. This affects both the LMP90xxx ADC and GPIO drivers.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Move calibration setup SPI transaction to acquisition thread to allow
adc_read_async() to be called from ISR context.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Introduce a dedicated function for performing an entire LMP90xxx ADC
channel read and sample all channels in one go in the ADC acquisition
thread.
This removes the SPI transactions from adc_context_start_sampling()
which can be called in k_timer ISR context for consecutive ADC reads.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Convert older DT_INST_ macro use in microchip drivers to the new
include/devicetree.h DT_INST macro APIs.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Convert older DT_INST_ macro use in STM32 drivers to the new
include/devicetree.h DT_INST macro APIs.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This reverts commit 8739517107.
Pull Request #23437 was merged by mistake with an invalid manifest.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Replace all occurences of BUILD_ASSERT_MSG() with BUILD_ASSERT()
as a result of merging BUILD_ASSERT() and BUILD_ASSERT_MSG().
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
This enables the ADC output data to be shifted right when using
10-bit resolution. Or else, data would be left justified as if
it's doing 12-bit ADC with the right 2 bits filled with zeroes.
Fixes#23202
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
In order to overrdie a choice one needs to define it again. Override it
by redefining it in the .defconfig file.
See #22474.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
ADC_1 peripheral instance was enabled by default in driver.
This is not the usual way to enable peripheral instances, as it
makes board configuration unclear.
Move activation in boards that are declaring ADC support.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Update the DRDYB pin interrupt handling code of the TI LMP90xxx ADC
driver to use the new GPIO API.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Gain values are specified with enumeration values that can't be used
to reverse the effects of scaling the input signal. Provide a
function that reverses the effect of the gain by scaling a measured
value.
Also provide a function that converts a raw measurement captured with
a reference voltage and specific gain and resolution to the
corresponding voltage in millivolts.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
The build infrastructure should not be adding the drivers subdirectory
to the include path. Fix the legacy uses that depended on that
addition.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The build infrastructure should not be adding the drivers subdirectory
to the include path. Fix the legacy uses that depended on that
addition.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Add driver for the Texas Instruments LMP90xxx series of multi-channel,
low-power 16-/24-bit sensor analog frontends (AFEs).
The functionality is split into two drivers; an ADC driver and a GPIO
driver.
Tested with LMP90080 and LMP90100.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Fix clock setup for stm32 f3, l4, wb and g4 series.
The macro __LL_ADC_COMMON_INSTANCE() is called without argument, which
leads to a compile error. Fix by passing adc parameter.
Signed-off-by: Thomas Schmid <tom@lfence.de>
Update calls to nrfx HAL functions to reflect API changes introduced in
nrfx 2.0.0. All these functions are now called with the first parameter
pointing to the structure of registers of the relevant peripheral.
Also a few functions got renamed:
- nrf_gpiote_int_is_enabled to nrf_gpiote_int_enable_check
- nrf_gpiote_event_is_set to nrf_gpiote_event_check
- nrf_rng_event_get to nrf_rng_event_check
- nrf_rng_int_get to nrf_rng_int_enable_check
- nrf_rtc_event_pending to nrf_rtc_event_check
- nrf_rtc_int_is_enabled to nrf_rtc_int_enable_check
- nrf_timer_cc_read to nrf_timer_cc_get
- nrf_timer_cc_write to nrf_timer_cc_set
Default configuration values were removed from nrfx_config files,
so the drivers pwm_nrfx and spi_nrfx_spis no longer can use those.
Function nrfx_pwm_init() now takes one more parameter - context pointer
that is passed to the event handler, not used in the pwm_nrfx driver.
HALs for UART and UARTE now allow configuration of the parity type
and the number of stop bits, for SoCs that provide the corresponding
registers.
Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Use this short header style in all Kconfig files:
# <description>
# <copyright>
# <license>
...
Also change all <description>s from
# Kconfig[.extension] - Foo-related options
to just
# Foo-related options
It's clear enough that it's about Kconfig.
The <description> cleanup was done with this command, along with some
manual cleanup (big letter at the start, etc.)
git ls-files '*Kconfig*' | \
xargs sed -i -E '1 s/#\s*Kconfig[\w.-]*\s*-\s*/# /'
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Convert the NXP Kinetis ADC12 driver from relying on CONFIG_ADC_n
Kconfig defines to using DT_INST defines for instance configuration.
This resolves the issue of having e.g. ADC12 instances 2 and 3
enabled, but not instance 0.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Same deal as in commit 7fdb525754 ("kconfig: Use 'default' instead of
'def_bool' in Kconfig.defconfig files"), but I hacked Kconfiglib to also
find cases where the type is given separately as e.g.
config FOO
int
default 3
Motivation (from a note in
https://docs.zephyrproject.org/latest/guides/kconfig/index.html):
For a symbol defined in multiple locations (e.g., in a
Kconfig.defconfig file in Zephyr), it is best to only give the
symbol type for the "base" definition of the symbol, and to use
'default' (instead of 'def_<type>' value) for the remaining
definitions. That way, if the base definition of the symbol is
removed, the symbol ends up without a type, which generates a
warning that points to the other definitions. That makes the extra
definitions easier to discover and remove.
It's also nice if 'def_bool' and the like turn into a semi-reliable flag
that the symbol is only defined in Kconfig.defconfig files. That might
be a sign that things could be cleaned up.
Will do a separate pass later to remove some symbols only defined in
Kconfig.defconfig files.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Defining a symbol with 'menuconfig' just tells the menuconfig to display
any dependent symbols that immediately follow it in a separate menu.
'menuconfig' has no effect on symbol values.
Making a symbol that doesn't have any dependent symbols after it a
'menuconfig' should be avoided, because then you end up with an empty
menu, which is shown as e.g.
[*] Enable foo ---
This is how it would be shown if there were children but they all
happened to be invisible as well.
With a regular 'config', it turns into
[*] Enable foo
Change all pointless 'menuconfig's to 'config's.
See the section on 'menuconfig' on the Kconfig - Tips and Best Practices
page as well.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Unused after commit a8d0e5af07 ("adc: ti_adc108s102: Remove driver as
its bit-rotted").
Found with a script.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Use the int_literal_to_timeout Coccinelle script to convert literal
integer arguments for kernel API timeout parameters to the standard
timeout value representations.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Value MCHP_ADC_MAX_CHAN_MASK defined in microchip hal as
0x07u which is different method for mask calculation then used in Zephyr
API for 8 channels (MCHP_ADC_MAX_CHAN = 8).
Calculate bitmask ourselves using BIT_MASK().
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>