![]() |
GaIA BIOS Library
|
Encoder function prototypes. More...
#include <stdint.h>Functions | |
| int | gwa_encoder_init (uint8_t channel, uint8_t direction, uint32_t value) |
| Sets up the encoder. | |
| int | gwa_encoder_read (uint8_t channel, uint32_t *value) |
| Reads the value of the counter. | |
| int | gwa_encoder_enable_ovr_int (uint8_t channel) |
| Enables the overflow interrupt. | |
| int | gwa_encoder_disable_ovr_int (uint8_t channel) |
| Disables the overflow interrupt. | |
| int | gwa_encoder_clear_ovr_int (uint8_t channel) |
| Acknowledges the overflow interrupt. | |
| int | gwa_encoder_handle_ovr_int (uint8_t channel) |
| Handles overflow interrupt so that encoder value is 32-bit wide. | |
Encoder function prototypes.
| int gwa_encoder_clear_ovr_int | ( | uint8_t | channel | ) |
Acknowledges the overflow interrupt.
| channel | encoder channel: |
| int gwa_encoder_disable_ovr_int | ( | uint8_t | channel | ) |
Disables the overflow interrupt.
| channel | encoder channel: |
| int gwa_encoder_enable_ovr_int | ( | uint8_t | channel | ) |
Enables the overflow interrupt.
| channel | encoder channel: |
| int gwa_encoder_handle_ovr_int | ( | uint8_t | channel | ) |
Handles overflow interrupt so that encoder value is 32-bit wide.
This function must be called from the timer IRQ handler of the peripheral used for the encoder:
This function checks if the overflow interrupt flag is set and clears it so it can be called from the timer IRQ handler without any check on the interrupt type.
| channel | encoder channel: |
| int gwa_encoder_init | ( | uint8_t | channel, |
| uint8_t | direction, | ||
| uint32_t | value ) |
Sets up the encoder.
| channel | encoder channel: |
| direction | specifies if the counter counts up (ENCODER_DIR_UP) or down (ENCODER_DIR_DOWN). |
| value | initial value of the counter. |
| int gwa_encoder_read | ( | uint8_t | channel, |
| uint32_t * | value ) |
Reads the value of the counter.
| channel | encoder channel: |
| value | pointer to a variable that holds the counter value |