Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for TMAG5170 3d Hall effect sensor #61346

Merged
merged 2 commits into from Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions drivers/sensor/CMakeLists.txt
Expand Up @@ -134,6 +134,7 @@ add_subdirectory_ifdef(CONFIG_TEMP_NRF5 nrf5)
add_subdirectory_ifdef(CONFIG_TH02 th02)
add_subdirectory_ifdef(CONFIG_TI_HDC ti_hdc)
add_subdirectory_ifdef(CONFIG_TI_HDC20XX ti_hdc20xx)
add_subdirectory_ifdef(CONFIG_TMAG5170 tmag5170)
add_subdirectory_ifdef(CONFIG_TMD2620 tmd2620)
add_subdirectory_ifdef(CONFIG_TMP007 tmp007)
add_subdirectory_ifdef(CONFIG_TMP108 tmp108)
Expand Down
1 change: 1 addition & 0 deletions drivers/sensor/Kconfig
Expand Up @@ -190,6 +190,7 @@ source "drivers/sensor/tcs3400/Kconfig"
source "drivers/sensor/th02/Kconfig"
source "drivers/sensor/ti_hdc/Kconfig"
source "drivers/sensor/ti_hdc20xx/Kconfig"
source "drivers/sensor/tmag5170/Kconfig"
source "drivers/sensor/tmd2620/Kconfig"
source "drivers/sensor/tmp007/Kconfig"
source "drivers/sensor/tmp108/Kconfig"
Expand Down
6 changes: 6 additions & 0 deletions drivers/sensor/tmag5170/CMakeLists.txt
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_library()

zephyr_library_sources(tmag5170.c)
zephyr_library_sources_ifdef(CONFIG_TMAG5170_TRIGGER tmag5170_trigger.c)
69 changes: 69 additions & 0 deletions drivers/sensor/tmag5170/Kconfig
@@ -0,0 +1,69 @@
# Texas Instruments TMAG5170 high-precision, linear 3D Hall-effect sensor with SPI bus interface

# Copyright (c) 2023 Michal Morsisko
# SPDX-License-Identifier: Apache-2.0

menuconfig TMAG5170
bool "TMAG5170 SPI Hall-effect sensor driver"
default y
depends on DT_HAS_TI_TMAG5170_ENABLED
select SPI
help
Enable driver for TMAG5170 Hall-effect sensor driver

if TMAG5170

choice TMAG5170_TRIGGER_MODE
prompt "Trigger mode"
help
Specify the type of triggering to be used by the driver.

config TMAG5170_TRIGGER_NONE
bool "No trigger"

config TMAG5170_TRIGGER_GLOBAL_THREAD
bool "Use global thread"
depends on GPIO
select TMAG5170_TRIGGER

config TMAG5170_TRIGGER_OWN_THREAD
bool "Use own thread"
depends on GPIO
select TMAG5170_TRIGGER

config TMAG5170_TRIGGER_DIRECT
bool "Process trigger within interrupt context"
depends on GPIO
select TMAG5170_TRIGGER

endchoice

config TMAG5170_CRC
bool "Use CRC error detection"
default y
select CRC
help
Verify CRC of RX data and append CRC to TX data

config TMAG5170_TRIGGER
bool

if TMAG5170_TRIGGER

config TMAG5170_THREAD_PRIORITY
int "Thread priority"
depends on TMAG5170_TRIGGER_OWN_THREAD
default 10
help
Priority of thread used by the driver to handle interrupts.

config TMAG5170_THREAD_STACK_SIZE
int "Thread stack size"
depends on TMAG5170_TRIGGER_OWN_THREAD
default 1024
help
Stack size of thread used by the driver to handle interrupts.

endif # TMAG5170_TRIGGER

endif # TMAG5170