Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F63312327
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
Sun, May 19, 05:52
Size
887 B
Mime Type
text/x-c
Expires
Tue, May 21, 05:52 (2 d)
Engine
blob
Format
Raw Data
Handle
17758598
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