Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/upload_components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ jobs:
# esp32-p4-nano), which depend on espp/ethernet, so it is
# uploaded to the registry first.
#
# Note: magnetic_encoder is intentionally listed ahead of as5600 and
# mt6701, which depend on espp/magnetic_encoder, so it is
# uploaded to the registry first.
#
# Note: comments are not allowed in the "components" list, so please
# do not add any comments here.
components: |
components/magnetic_encoder
components/adc
components/adrc
components/ads1x15
Expand Down
2 changes: 1 addition & 1 deletion components/as5600/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
idf_component_register(
INCLUDE_DIRS "include"
REQUIRES "base_peripheral" "timer" "task"
REQUIRES "magnetic_encoder" "base_peripheral" "timer"
)
13 changes: 8 additions & 5 deletions components/as5600/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ menu "AS5600 Configuration"
the velocity will be set to 0. This helps filter out noise and
small jitter in the encoder readings.

config AS5600_USE_TIMER
bool "Use high resolution timer instead of task"
config AS5600_USE_HIGH_RESOLUTION_TIMER
bool "Use high resolution timer instead of software timer"
default y
help
Use the high resolution timer instead of a FreeRTOS task for
periodic updates. The timer is more precise and has lower overhead.
Disable this if you prefer to use a task-based implementation.
Drive the periodic encoder update with an esp_timer-backed
HighResolutionTimer (microsecond resolution). This is the right
choice for sub-millisecond update periods. Disable this to instead
use an espp::Timer, which schedules against an absolute wake-up time
(drift-free and in phase) but is limited to the FreeRTOS tick
resolution.

endmenu
6 changes: 4 additions & 2 deletions components/as5600/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ measure
* Accumulated degrees (since the component was created)
* Speed (rotations per minute / RPM)

It does so by spawning a task which periodically reads the magnetic encoder,
It does so by spawning a timer which periodically reads the magnetic encoder,
updates the accumulator, and computes the velocity. The component can be
configured to optionally filter the velocity.
configured to optionally filter the velocity. The timer can be either a
`espp::HighResolutionTimer` (default) or an `espp::Timer`, selected via KConfig /
menuconfig.

The periodicity / update rate of the encoder can be configured at time of
creation.
Expand Down
5 changes: 3 additions & 2 deletions components/as5600/example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ ESP32-S3. If you wish to use a different chip / board, changes those and rebuild
This example shows the use of the `As5600` component to communicate with an
AS5600 I2C magnetic encoder chip.

It uses the `task` component to periodically read the raw count, position, and
velocity of the encoder, the `filters` component (specifically the
It uses the `task` component to periodically poll and print the raw count,
position, and velocity of the encoder (the `As5600` itself maintains that state
with its own internal timer), the `filters` component (specifically the
`espp::ButterworthFilter` class) to filter the raw values from the sensor, and
the `format` component to print the data to the console in CSV format.

Expand Down
2 changes: 1 addition & 1 deletion components/as5600/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ tags:
dependencies:
idf:
version: '>=5.0'
espp/magnetic_encoder: '>=1.0'
espp/base_peripheral: '>=1.0'
espp/task: '>=1.0'
espp/timer: '>=1.0'
Loading