You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.0 KiB
C
53 lines
1.0 KiB
C
4 weeks ago
|
/*
|
||
|
* WeinRegisterVariant.h
|
||
|
*
|
||
|
* Author: Aleksey Gerasimenko
|
||
|
* gerasimenko.aleksey.n@gmail.com
|
||
|
*/
|
||
|
|
||
|
#include <math.h>
|
||
|
#include <stdint.h>
|
||
|
|
||
|
#include "WEINBUS/WeinbusDefines.h"
|
||
|
|
||
|
#ifndef WEINBUS_WEINBUSREGISTERVARIANT_H_
|
||
|
#define WEINBUS_WEINBUSREGISTERVARIANT_H_
|
||
|
|
||
|
|
||
|
namespace WEINBUS
|
||
|
{
|
||
|
|
||
|
class WeinbusRegisterVariant
|
||
|
{
|
||
|
private:
|
||
|
union
|
||
|
{
|
||
|
uint16_t u16;
|
||
|
int16_t i16;
|
||
|
uint32_t u32;
|
||
|
int32_t i32;
|
||
|
float f;
|
||
|
};
|
||
|
data_variant_type_t t;
|
||
|
public:
|
||
|
WeinbusRegisterVariant();
|
||
|
data_variant_type_t get_type() const;
|
||
|
//setters
|
||
|
void set_uint16 (uint16_t value);
|
||
|
void set_int16 (int16_t value);
|
||
|
void set_uint32 (uint32_t value);
|
||
|
void set_int32 (int32_t value);
|
||
|
void set_float (float value);
|
||
|
//getters
|
||
|
uint16_t get_uint16() const;
|
||
|
int16_t get_int16() const;
|
||
|
uint32_t get_uint32() const;
|
||
|
int32_t get_int32() const;
|
||
|
float get_float() const;
|
||
|
//
|
||
|
};
|
||
|
|
||
|
} /* namespace WEINBUS */
|
||
|
|
||
|
#endif /* WEINBUS_WEINBUSREGISTERVARIANT_H_ */
|