INF2004-Project v0.1
 
Loading...
Searching...
No Matches
wheel_encoder.c File Reference

Driver code for the wheel encoder. More...

#include <stdbool.h>
#include <stdint.h>
#include "encoder/wheel_encoder.h"
Include dependency graph for wheel_encoder.c:

Functions

float wheel_enc_get_speed (float time_elapsed, bool is_pulse)
 Get the speed in either pulses/second or mm/second. More...
 
float wheel_enc_get_time_diff (uint64_t current_time, uint64_t prev_time)
 Get the time difference in ms. More...
 

Detailed Description

Driver code for the wheel encoder.

Author
Bryan Seah
Version
0.1
Date
2023-11-26

Function Documentation

◆ wheel_enc_get_speed()

float wheel_enc_get_speed ( float  time_elapsed,
bool  is_pulse 
)

Get the speed in either pulses/second or mm/second.

Parameters
[in]time_elapsedTime elapsed in ms
[in]is_pulseTrue if speed is in pulses/second, false if speed is in mm/second
Returns
float Speed in either pulses/second or mm/second

References WHEEL_ENC_DIST_PER_PULSE, and WHEEL_ENC_SEC_TO_MSEC.

◆ wheel_enc_get_time_diff()

float wheel_enc_get_time_diff ( uint64_t  current_time,
uint64_t  prev_time 
)

Get the time difference in ms.

Parameters
[in]current_timeCurrent time in us
[in]prev_timePrevious time in us
Returns
float Time difference in ms

References WHEEL_ENC_SEC_TO_MSEC.