Initializing the repository
This commit is contained in:
22
inc/jl_modbus/jl_config.h
Normal file
22
inc/jl_modbus/jl_config.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef JLV135_CLI_CONFIG_H
|
||||
#define JLV135_CLI_CONFIG_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define JLV135_BACKUP_BLOCKS_ADDRESS 0x40400
|
||||
#define JLV135_DEV_MTD_BLOCK "/dev/mtdblock0"
|
||||
|
||||
void
|
||||
jl_config_load(const char *name, void *def, size_t size);
|
||||
|
||||
bool
|
||||
jl_config_read(int block_num, void *data, size_t size);
|
||||
|
||||
bool
|
||||
jl_config_write(int block_num, void *data, size_t size);
|
||||
|
||||
void
|
||||
jl_config_save(const char *name, void *def, size_t size);
|
||||
|
||||
#endif // JLV135_CLI_CONFIG_H
|
||||
54
inc/jl_modbus/jl_modbus_config.h
Normal file
54
inc/jl_modbus/jl_modbus_config.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#ifndef JLV135_CLI_MODBUS_CONFIG_H
|
||||
#define JLV135_CLI_MODBUS_CONFIG_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct jl_version
|
||||
{
|
||||
uint16_t major;
|
||||
uint16_t minor;
|
||||
uint16_t path;
|
||||
} jl_version_t;
|
||||
|
||||
typedef struct jl_modbus_tcp_port
|
||||
{
|
||||
uint32_t addr;
|
||||
uint16_t port;
|
||||
uint16_t repeate;
|
||||
uint16_t timeout;
|
||||
} jl_modbus_tcp_port_t;
|
||||
|
||||
static const uint32_t jl_modbus_rs485_baud_rates[] = {9600, 19200, 38400, 57600, 115200};
|
||||
|
||||
typedef struct jl_modbus_rs485_port
|
||||
{
|
||||
uint16_t speed;
|
||||
uint16_t prop_p;
|
||||
uint16_t prop_s;
|
||||
uint16_t repeate;
|
||||
uint16_t timeout;
|
||||
} jl_modbus_rs485_port_t;
|
||||
|
||||
typedef struct jl_modbus_config
|
||||
{
|
||||
uint16_t num_port;
|
||||
uint16_t addr;
|
||||
uint16_t tcycle;
|
||||
jl_modbus_rs485_port_t port_rtu;
|
||||
jl_modbus_tcp_port_t port_tcp;
|
||||
} jl_modbus_config_t;
|
||||
|
||||
// -------------------------- Методы -------------------------- //
|
||||
|
||||
bool
|
||||
jl_modbus_rs485_baud_rate_is_index_valid(size_t index);
|
||||
|
||||
uint32_t
|
||||
jl_modbus_rs485_baud_rate_get_baud_by_index(size_t index);
|
||||
|
||||
int32_t
|
||||
jl_modbus_rs485_baud_rate_get_index_by_baud(uint32_t baud);
|
||||
|
||||
#endif // JLV135_CLI_MODBUS_CONFIG_H
|
||||
6
inc/jlv135_cli/jl_util.h
Normal file
6
inc/jlv135_cli/jl_util.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef JL135_CLI_UTIL
|
||||
#define JL135_CLI_UTIL
|
||||
|
||||
#define jl_array_size(x) (sizeof(x) / sizeof(x[0]))
|
||||
|
||||
#endif // JL135_CLI_UTIL
|
||||
Reference in New Issue
Block a user