/*
 * This work is part of the White Rabbit project
 *
 * Copyright (C) 2016 GSI (www.gsi.de)
 * Author: Alessandro rubini
 *
 * Released according to the GNU GPL, version 2 or any later version.
 */
#ifndef __TEMPERATURE_H__
#define __TEMPERATURE_H__

#include <stdint.h>

#define WRC_MAX_TEMPERATURES 4

struct wrc_onetemp {
	char *name;
	int32_t t;  /* fixed point, 16.16 (signed!) */
};

#define TEMP_INVALID (0x8000 << 16)

struct wrc_temp {
	int used;
	int (*read)(struct wrc_temp *);
	void *data;
	struct wrc_onetemp *t; /* zero-terminated */
};

/* lib functions  */
extern uint32_t wrc_temp_get(char *name);
struct wrc_onetemp *wrc_temp_getnext(struct wrc_onetemp *);
extern int wrc_temp_format(char *buffer, int len);
void wrc_temp_init(void);
int wrc_temp_refresh(void);

#endif /* __TEMPERATURE_H__ */
