0
|
1 |
/*
|
|
2 |
* readFloat.c
|
|
3 |
*
|
|
4 |
* Created on: Mar 20, 2014
|
|
5 |
* Author: user
|
|
6 |
*/
|
|
7 |
|
|
8 |
#include <stdio.h>
|
|
9 |
#include <aSubRecord.h>
|
|
10 |
#include <registryFunction.h>
|
|
11 |
#include <epicsExport.h>
|
|
12 |
|
|
13 |
static int readFloat(aSubRecord *precord)
|
|
14 |
{
|
|
15 |
/*
|
|
16 |
* Long variable in precord->a field, needs to reinterpreted as a float
|
|
17 |
* and stored to the output value field precord->vala
|
|
18 |
*/
|
|
19 |
*((float *)precord->vala) = *((float *)precord->a);
|
|
20 |
|
|
21 |
return 0;
|
|
22 |
}
|
|
23 |
|
|
24 |
static int writeFloat(aSubRecord *precord)
|
|
25 |
{
|
|
26 |
/*
|
|
27 |
* Float variable in precord->a field, needs to reinterpreted as a long
|
|
28 |
* and stored to the output value field precord->vala
|
|
29 |
*/
|
|
30 |
*((long *)precord->vala) = *((long *)precord->a);
|
|
31 |
|
|
32 |
return 0;
|
|
33 |
}
|
|
34 |
|
|
35 |
|
|
36 |
epicsRegisterFunction(readFloat);
|
|
37 |
epicsRegisterFunction(writeFloat);
|
|
38 |
|
|
39 |
|
|
40 |
|