MBot Software Library  v1.0
An API documentation to mbot_firmware repository
encoder.h
1 
10 #include <stdio.h>
11 #include <stdint.h>
12 #include <pico/stdlib.h>
13 
14 #ifndef MBOT_ENCODER_H
15 #define MBOT_ENCODER_H
16 
22 int mbot_encoder_init();
23 
30 
37 int mbot_encoder_read_delta(uint8_t ch);
38 
45 int mbot_encoder_read_count(uint8_t ch);
46 
54 int mbot_encoder_write(uint8_t ch, int pos);
55 
56 #endif /* RC_ENCODER_H */
int mbot_encoder_cleanup()
Stops the encoder counters. Recommended to be called at the end of the program.
Definition: encoder.c:51
int mbot_encoder_read_count(uint8_t ch)
Reads the current count of an encoder channel. The count is a signed 32-bit integer that wraps around...
Definition: encoder.c:75
int mbot_encoder_write(uint8_t ch, int pos)
Sets the current position of an encoder channel. Typically used to reset a counter to 0,...
Definition: encoder.c:91
int mbot_encoder_init()
Initializes the encoder counters for channels 1-3. This also resets the encoder position to 0.
Definition: encoder.c:23
int mbot_encoder_read_delta(uint8_t ch)
Reads the current delta of an encoder channel.
Definition: encoder.c:61