Commit 18309d45 authored by Federico Vaga's avatar Federico Vaga

lib: deprecate fmctdc_read_temperature

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent e8dd0b96
......@@ -317,15 +317,21 @@ int fmctdc_close(struct fmctdc_board *userb)
/**
* It reads the current temperature of a TDC device
* @param[in] userb TDC board instance token
* @return temperature
* @param[out] temperature the temperature in degree
* @return 0 on success, -1 on error and errno is appropriately set
*/
float fmctdc_read_temperature(struct fmctdc_board *userb)
int fmctdc_temperature_get(struct fmctdc_board *userb, float *temperature)
{
uint32_t t;
__define_board(b, userb);
uint32_t t;
int ret;
fmctdc_sysfs_get(b, "temperature", &t);
return (float)t / 16.0;
ret = fmctdc_sysfs_get(b, "temperature", &t);
if (ret < 0)
return ret;
*temperature = (float)t / 16.0;
return 0;
}
......@@ -1188,3 +1194,19 @@ int fmctdc_ts_mode_get(struct fmctdc_board *userb,
return 0;
}
/* DEPRECATED */
/**
* It reads the current temperature of a TDC device
* @param[in] userb TDC board instance token
* @return the temperature in degree
*/
float fmctdc_read_temperature(struct fmctdc_board *userb)
{
float t;
fmctdc_temperature_get(userb, &t);
return t;
}
......@@ -96,6 +96,8 @@ extern int fmctdc_init(void);
extern void fmctdc_exit(void);
/* Utilities */
extern char *fmctdc_strerror(int err);
extern int fmctdc_temperature_get(struct fmctdc_board *userb,
float *temperature);
/* Open And Close Devices */
extern struct fmctdc_board *fmctdc_open(int offset, int dev_id);
extern struct fmctdc_board *fmctdc_open_by_lun(int lun);
......@@ -171,7 +173,8 @@ extern int fmctdc_get_time(struct fmctdc_board *b, struct fmctdc_time *t);
extern int fmctdc_set_host_time(struct fmctdc_board *b);
extern int fmctdc_wr_mode(struct fmctdc_board *b, int on);
extern int fmctdc_check_wr_mode(struct fmctdc_board *b);
extern float fmctdc_read_temperature(struct fmctdc_board *b);
extern float fmctdc_read_temperature(struct fmctdc_board *b)
__attribute__((deprecated));
/* other */
extern const char * const libfmctdc_version_s;
......
......@@ -13,15 +13,21 @@ char git_version[] = "git version: " GIT_VERSION;
int main(int argc, char **argv)
{
init(argc, argv);
float t;
int err;
init(argc, argv);
check_help(argc, argv, 2,
"[-h] [-V] <device>",
"Displays current temperature of the mezzanine.\n", "");
open_board(argv[1]);
printf("%.1f deg C\n", fmctdc_read_temperature(brd));
err = fmctdc_temperature_get(brd, &t);
if (err)
fprintf(stderr, "Failed to read temperature: %s\n",
fmctdc_strerror(errno));
printf("%.1f deg C\n", t);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment