Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F66535619
strain_gauge.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jun 11, 05:08
Size
887 B
Mime Type
text/x-c
Expires
Thu, Jun 13, 05:08 (2 d)
Engine
blob
Format
Raw Data
Handle
18237286
Attached To
R2671 HHRI-software
strain_gauge.c
View Options
#include "strain_gauge.h"
#include "dac.h"
#include "../lib/basic_filter.h"
AdcChannel sg_channel;
bfilt_BasicFilter sg_filt;
/**
* @brief Initialize the strain gauge driver.
* @param channel: the ADC channel the strain gauge is wired to (0 or 1).
*/
void sg_Init(AdcChannel channel)
{
sg_channel = channel;
dac_SetVoltage2(2.4f);
bfilt_Init(&sg_filt, 0.1f, 0.0f);
}
/**
* @brief Return the measured force on the paddle.
* @retval The force applied to the top of the paddle [N].
* @warning this function is not implemented yet, and returns actually the raw
* voltage from the sensor, instead of the ready-to-use force.
*/
float32_t sg_Get(void)
{
float32_t voltage = adc_GetChannelVoltage(sg_channel, ADC_SCALE_0_033_V);
// TODO: the voltage to angle conversion is not implemented yet.
return bfilt_Step(&sg_filt, voltage);
}
Event Timeline
Log In to Comment