Page MenuHomec4science

tachometer.c
No OneTemporary

File Metadata

Created
Wed, May 1, 03:14

tachometer.c

#include "tachometer.h"
AdcChannel tac_channel;
/**
* @brief Initialize the tachometer driver.
* @param channel: the ADC channel the tachometer is wired to (0 or 1).
*/
void tac_Init(AdcChannel channel)
{
tac_channel = channel;
}
/**
* @brief Return the measured paddle angular speed.
* @retval The paddle angular speed [deg/s].
*/
float32_t tac_Get(void)
{
float32_t voltage = adc_GetChannelVoltage(tac_channel);
// Conversion from voltage to angular speed.
return voltage * TAC_VOLTAGE_TO_RPM;
}

Event Timeline