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.

89 lines
4.2 KiB
C

/*
* RUBUSDataBase.h
*
* Author: Aleksey Gerasimenko
* gerasimenko.aleksey.n@gmail.com
*/
#ifndef MODBUSRTU_RUBUSDATABASE_H_
#define MODBUSRTU_RUBUSDATABASE_H_
#include <math.h>
#include <stdint.h>
#include "framework.h"
#include "SYSCTRL/SystemEnvironment.h"
#include "MODBUSRTU/RUBUSTypes.h"
#include "MODBUSRTU/RUBUSRegister.h"
namespace MODBUSRTU
{
#define NUMBER_RUBUSCELLS ((uint16_t)(420))
class RUBUSDataBase
{
private:
MODBUSRTU::RUBUSRegister m_cell[NUMBER_RUBUSCELLS];
uint16_t m_current_index_cell;
uint16_t m_index_cell;
uint16_t m_counter_cell;
uint16_t m_size_cell;
public:
RUBUSDataBase();
public:
void configurate();
public:
void add_register_bool (uint16_t index, uint16_t readonly, bool* param);
void add_register_float (uint16_t index, uint16_t readonly, float* param);
void add_register_uint8 (uint16_t index, uint16_t readonly, uint8_t* param);
void add_register_uint16(uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_uint32(uint16_t index, uint16_t readonly, uint32_t* param);
void add_register_int8 (uint16_t index, uint16_t readonly, int8_t* param);
void add_register_int16 (uint16_t index, uint16_t readonly, int16_t* param);
void add_register_int32 (uint16_t index, uint16_t readonly, int32_t* param);
void add_register_bit0 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit1 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit2 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit3 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit4 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit5 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit6 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit7 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit8 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit9 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit10 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit11 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit12 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit13 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit14 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit15 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit16 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit17 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit18 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit19 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit20 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit21 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit22 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit23 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit24 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit25 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit26 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit27 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit28 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit29 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit30 (uint16_t index, uint16_t readonly, uint16_t* param);
void add_register_bit31 (uint16_t index, uint16_t readonly, uint16_t* param);
public:
MODBUSRTU::RUBUSRegister& get_register(uint16_t index);
void read_register(uint16_t index, RUBUS_REGISTER_32& data);
uint16_t write_register(uint16_t index, RUBUS_REGISTER_32 data);
};
} /* namespace MODBUSRTU */
#endif /* MODBUSRTU_RUBUSDATABASE_H_ */