-
Notifications
You must be signed in to change notification settings - Fork 7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drivers: sensor: ams_as5600: Rewrite driver to support attributes/cha…
…nnels/Kconfig This is a complete rewrite of the existing AS5600 driver. Device registers and configuration are supported through the fetch and get API using channels and attributes. The Kconfig was updated to cover all configurable options of the device. The device is now initialized to the state defined in Kconfig on init. Signed-off-by: Cameron Ewing <cameronramsayewing@gmail.com>
- Loading branch information
Cameron Ewing
committed
Mar 3, 2025
1 parent
43564e7
commit 23b285e
Showing
3 changed files
with
1,058 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,172 @@ | ||
# AS5600 Angular position sensor configuration option | ||
|
||
# Copyright (c) 2022, Felipe Neves. | ||
# Copyright (c) 2025, Cameron Ewing | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config AMS_AS5600 | ||
bool "AS5600 Angular position sensor" | ||
default y | ||
depends on DT_HAS_AMS_AS5600_ENABLED | ||
select I2C | ||
help | ||
Enable driver for AS5600 Angular position sensor. | ||
menuconfig AMS_AS5600 | ||
bool "AS5600 Angular position sensor" | ||
default y | ||
depends on DT_HAS_AMS_AS5600_ENABLED | ||
select I2C | ||
help | ||
Enable driver for AS5600 Angular position sensor. | ||
|
||
if AMS_AS5600 | ||
|
||
config AS5600_START_POSITION | ||
int "Start position" | ||
default 0 | ||
range 0 4095 | ||
help | ||
Start position (min. 0; max. 4095) | ||
Difference between Start and End position must be at least 18 degrees (205 steps). | ||
config AS5600_END_POSITION | ||
int "End position" | ||
default 0 | ||
range 0 4095 | ||
help | ||
End position (min. 0; max. 4095) | ||
Difference between Start and End position must be at least 18 degrees (205 steps). | ||
|
||
config AS5600_ANGULAR_RANGE | ||
int "Maximum angular range" | ||
range 205 4096 | ||
default 4096 | ||
help | ||
Maximum angular range (min. 205; max. 4096) | ||
The minimum angular range is 18 degrees (205 steps). | ||
|
||
config AS5600_POWER_MODE | ||
bool | ||
|
||
choice | ||
prompt "Power mode" | ||
help | ||
Configure the power mode and polling time of AS5600. | ||
|
||
Power Mode | Polling Time (ms) | ||
NOM: Always On | ||
LPM1: 5 | ||
LPM2: 20 | ||
LPM3: 100 | ||
|
||
config AS5600_POWER_MODE_NOM | ||
bool "NOM" | ||
config AS5600_POWER_MODE_LPM1 | ||
bool "LPM1" | ||
config AS5600_POWER_MODE_LPM2 | ||
bool "LPM2" | ||
config AS5600_POWER_MODE_LPM3 | ||
bool "LPM3" | ||
endchoice | ||
|
||
config AS5600_HYSTERESIS | ||
bool | ||
|
||
choice | ||
prompt "Hysteresis" | ||
help | ||
Configure the number of bits of hysteresis on output. | ||
|
||
config AS5600_HYSTERESIS_0 | ||
bool "0 bits" | ||
config AS5600_HYSTERESIS_1 | ||
bool "1 bit" | ||
config AS5600_HYSTERESIS_2 | ||
bool "2 bits" | ||
config AS5600_HYSTERESIS_3 | ||
bool "3 bits" | ||
|
||
endchoice | ||
|
||
config AS5600_OUTPUT_STAGE | ||
bool | ||
|
||
choice | ||
prompt "Output stage" | ||
help | ||
Enable output of angle reading over the OUT pin. | ||
NOTE: AS5600L only supports digital PWM output and pulls OUT high for any other output stage. | ||
|
||
config AS5600_OUTPUT_STAGE_ANALOG | ||
bool "Full range from 0% to 100% of (GND -> VDD) Analog output" | ||
config AS5600_OUTPUT_STAGE_REDUCED | ||
bool "Reduced range from 10% to 90% of (GND -> VDD) Analog output" | ||
config AS5600_OUTPUT_STAGE_PWM | ||
bool "Digital PWM output" | ||
|
||
endchoice | ||
|
||
config AS5600_PWM_FREQUENCY | ||
bool | ||
|
||
choice | ||
prompt "PWM Frequency" | ||
help | ||
If output_stage is enabled, set the PWM signalling frequency in Hz. | ||
|
||
config AS5600_PWM_FREQUENCY_115 | ||
bool "115 Hz" | ||
config AS5600_PWM_FREQUENCY_230 | ||
bool "230 Hz" | ||
config AS5600_PWM_FREQUENCY_460 | ||
bool "460 Hz" | ||
config AS5600_PWM_FREQUENCY_920 | ||
bool "920 Hz" | ||
endchoice | ||
|
||
config AS5600_SLOW_FILTER | ||
bool | ||
choice | ||
prompt "Slow filter" | ||
help | ||
Configure the slow step response filter. | ||
Longer step sampling windows lead to lower output noise at the cost of response time. | ||
|
||
config AS5600_SLOW_FILTER_16 | ||
bool "2.2 ms response time" | ||
config AS5600_SLOW_FILTER_8 | ||
bool "1.1 ms response time" | ||
config AS5600_SLOW_FILTER_4 | ||
bool "0.55 ms response time" | ||
config AS5600_SLOW_FILTER_2 | ||
bool "0.286 ms response time" | ||
endchoice | ||
|
||
config AS5600_FAST_FILTER_THRESHOLD | ||
bool | ||
|
||
choice | ||
prompt "Fast filter threshold" | ||
help | ||
Configure the fast filter threshold. | ||
The fast filter is only applied if the input changes more than the fast filter threshold, otherwise only the slow filter is applied. | ||
The fast filter is disabled after the variation is less than the disable threshold. | ||
|
||
Enable Threshold (Steps), Disable Threshold (Steps) | ||
|
||
config AS5600_FAST_FILTER_THRESHOLD_SLOW_ONLY | ||
bool "Slow Filter Only" | ||
config AS5600_FAST_FILTER_THRESHOLD_6_1 | ||
bool "6,1" | ||
config AS5600_FAST_FILTER_THRESHOLD_7_1 | ||
bool "7,1" | ||
config AS5600_FAST_FILTER_THRESHOLD_9_1 | ||
bool "9,1" | ||
config AS5600_FAST_FILTER_THRESHOLD_18_2 | ||
bool "18,2" | ||
config AS5600_FAST_FILTER_THRESHOLD_21_2 | ||
bool "21,2" | ||
config AS5600_FAST_FILTER_THRESHOLD_24_2 | ||
bool "24,2" | ||
config AS5600_FAST_FILTER_THRESHOLD_10_4 | ||
bool "10,4" | ||
endchoice | ||
|
||
|
||
config AS5600_WATCHDOG | ||
bool "Automatic low power watchdog" | ||
help | ||
Automatically enter LPM3 if the output is within 4LSB for at least one minute. | ||
|
||
endif # AMS_AS5600 |
Oops, something went wrong.