Commit graph

15 commits

Author SHA1 Message Date
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Tomasz Bursztyka 97326c0445 device: Fix structure attributes access
Since struct devconfig was merged earlier into struct device, let's fix
accessing config_info, name, ... attributes everywhere via:

grep -rlZ 'dev->config->' | xargs -0 sed -i 's/dev->config->/dev->/g'

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Kumar Gala 762b521931 drivers: sensor: Fix missing DT_DRV_COMPAT
Some sensor drivers modify there struct's based on DT defines.  In those
cases we need to make sure that DT_DRV_COMPAT is set on all the source
files associated with that driver.  This updates any such files.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-17 03:32:19 -05:00
Peter Bigot de7e3e7693 sensor: adxl362: update for new GPIO API
Add a sample overlay.  Add GPIO flags to configuration state.  Replace
callback enable with interrupt enable.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Krzysztof Chruscinski ac417abdf0 drivers: sensors: Fix log module registration
All sensors were using legacy log module registeration method
where LOG_LEVEL was defined before registeration. This method
was error prone as it requires preserving includes order.

Replaced with LOG_MODULE_REGISTER(foo, level).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-10-11 07:33:08 -05:00
Peter Bigot e28f330a8e coccinelle: standardize k_thread create/define calls with integer timeouts
Re-run with updated script to convert integer literal delay arguments
to k_thread_create and K_THREAD_DEFINE to use the standard timeout
macros.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-09 08:38:10 -04:00
Anas Nashif a2fd7d70ec cleanup: include/: move misc/util.h to sys/util.h
move misc/util.h to sys/util.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 8c1f89fa99 cleanup: include/: move sensor.h to drivers/sensor.h
move sensor.h to drivers/sensor.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 6aa9c3a68f cleanup: include/: move gpio.h to drivers/gpio.h
move gpio.h to drivers/gpio.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Brett Witherspoon a5327b0003 drivers: adxl362: clear status independently and before mapping
Clear status bits before mapping them to the interrupt pin, so the
interrupt will occur on the next event instead of a pending event. Also
the status bits are cleared independently, because the threshold and
data ready functions can be enabled simultaneously.

Signed-off-by: Brett Witherspoon <spoonb@cdspooner.com>
2019-05-13 09:53:04 -05:00
Brett Witherspoon ed474e88bd drivers: adxl362: check interrupt status
Check the status and only execute the callback if the event has
occurred.

Signed-off-by: Brett Witherspoon <spoonb@cdspooner.com>
2019-05-13 09:53:04 -05:00
Brett Witherspoon 0e9257018c drivers: adxl362: don't disable callbacks
Enabling and disabling the GPIO callbacks is error prone and unnecessary
since the trigger data is protected with a mutex, so it has been
removed. This resolves the following issues:

- The GPIO callbacks are not being re-enabled properly in the error path
  of the trigger setting function.

- The device pointer used in the GPIO callback to retrieve the ADXL362
  driver configuration data is the GPIO device not the ADXL362 device,
  so this cast is invalid and the int_gpio field is garbage.

- There are potential timing issues between enabling interrupts and
  re-enabling the callbacks.

Signed-off-by: Brett Witherspoon <spoonb@cdspooner.com>
2019-05-13 09:53:04 -05:00
Brett Witherspoon cddb3a1e34 drivers: adxl362: use Kconfig for interrupt mode
Commit 11295c1 added Kconfig options for interrupt mode, but then hard
coded the interrupt mode. This commit uses the Kconfig option to set
the interrupt mode.

Applications expecting the interrupt mode to be something other than
the default will need to be updated.

Signed-off-by: Brett Witherspoon <spoonb@cdspooner.com>
2019-05-08 12:00:17 -05:00
Brett Witherspoon ae9905232c drivers: adxl362: don't skip mutex unlocking in error path
The default case of the switch statement jumps over the unlocking of the
trigger mutex. This has been fixed with more granular locking which has
the added benefit of being more explicit about what is being protected.

Signed-off-by: Brett Witherspoon <spoonb@cdspooner.com>
2019-05-08 11:58:07 -05:00
Henrik Malvik Halvorsen 11295c190b drivers: sensor: Add ADXL362 interrupt handling
The ADXL362 driver is expanded to support interrupt handling.

Signed-off-by: Henrik Malvik Halvorsen <henrik.halvorsen@nordicsemi.no>
2019-05-03 09:11:51 -05:00