Radiocraft Wireless M-Bus extension module
1.00.00
|
These functions are called from different C functions and contain common functionality. More...
Functions | |
static void | mbusDebug (const char *prefix, const char *format,...) |
Send a debug message to the device output in the format "<prefix>:<formated string>". More... | |
static int | mbusPower (uint8 power) |
Control power to module. More... | |
static int | mbusConfigEnter (void) |
Entering configuration mode. More... | |
static int | mbusConfigExit (void) |
Exit configuration mode. More... | |
static int | mbusConfigTransact (uint8 cmd, uint8 *data, int d_size, uint8 *reply, int r_size) |
Send a single configuration command with additional data and receive the reply. More... | |
static int | mbusConfigCmd (uint8 cmd, uint8 *reply, int size) |
Send a single command/argument. More... | |
static int | mbusConfigData (uint8 cmd) |
Send configuration data. More... | |
static int | mbus_read_reg (int8 reg, int size, const char *name) |
Reads the value of one or more registers in the M-Bus module and prints the value to the device output as hexadecimal values. More... | |
static int | mbus_read_regs (int8 reg, uint8 *buffer, int size) |
Reads the value of one or more registers in the M-Bus module and stores the value in the provided buffer. More... | |
static int | mbus_config_mem_reg (uint8 reg, uint8 val) |
Change the value of a register in the M-Bus module. More... | |
static int | mbus_config (int8 mode, int8 rssi, int8 only_installed) |
Configure a number of common settings. More... | |
static int | mbusConfigFactoryReset (void) |
This function performs a factory reset of the RF module. More... | |
These functions are called from different C functions and contain common functionality.
|
static |
Configure a number of common settings.
[in] | mode | Set the M-Bus mode( see mbusOpen() for values). Set to -1 to not change it. |
[in] | rssi | Set true to include RSSI in each packet. Set to -1 to not change it. |
[in] | only_installed | Set true to only receive packets from installed/registered slaves. Set to -1 to not change it. |
Definition at line 712 of file mod_mbus.c.
References mbus_config_mem_reg(), mbus_read_reg(), mbusConfigEnter(), mbusConfigExit(), and rssi_included.
Referenced by mbusCallSetFilter(), and mbusOpen().
|
static |
Change the value of a register in the M-Bus module.
It check to make sure that it does not already have the value, to avoid unneeded writing to the flash.
[in] | reg | The register to change |
[in] | val | The new value |
Definition at line 678 of file mod_mbus.c.
References mbusConfigCmd(), and mbusConfigData().
Referenced by mbus_config().
|
static |
Reads the value of one or more registers in the M-Bus module and prints the value to the device output as hexadecimal values.
[in] | reg | The index of the first register to read |
[in] | size | The number of sequential registers to read. |
[in] | name | The name of the register to show in the output. |
Definition at line 622 of file mod_mbus.c.
References mbusConfigCmd(), and mbusDebug().
Referenced by mbus_config().
|
static |
Reads the value of one or more registers in the M-Bus module and stores the value in the provided buffer.
[in] | reg | The index of the first register to read |
[in] | buffer | The bufer to place the data in. |
[in] | size | The number of sequential registers to read. |
Definition at line 653 of file mod_mbus.c.
References mbusConfigCmd().
Referenced by mbus_info().
|
static |
Send a single command/argument.
Will send the supplied configuration command/argument, and return any expected reply.
The module must first have been set in configuration mode using mbusConfigEnter().
[in] | cmd | The command or value to send. |
[in] | reply | Reference to where reply is stored. |
[in] | size | Size of expected reply, '0' of no reply is expected. |
Definition at line 571 of file mod_mbus.c.
References mbusConfigTransact().
Referenced by mbus_config_mem_reg(), mbus_info(), mbus_read_reg(), mbus_read_regs(), mbus_register_slave(), and mbusSend().
|
static |
Send configuration data.
Sends the supplied data and does not expect confirmation.
The module must first have been set in configuration mode using mbusConfigEnter().
[in] | cmd | The command or value to send. |
Definition at line 589 of file mod_mbus.c.
References fd, and mbusDebug().
Referenced by mbus_config_mem_reg().
|
static |
Entering configuration mode.
Request entering configuration mode by sending '0x00', and wait for confirmation. Any data received but not read and data written but not transmitted will be flushed, to ensure synchronization.
To exit configuration mode mbusConfigExit() must be called.
Definition at line 304 of file mod_mbus.c.
References cfg_activated, cfg_active, fd, and mbusDebug().
Referenced by mbus_config(), mbus_info(), mbus_register_slave(), mbusOpen(), and mbusSend().
|
static |
Exit configuration mode.
Request exit configuration mode by sending 'X', notice that the actual exit can't be confirmed, and success is always assumed.
To enter configuration mode, mbusConfigEnter() must be called.
Definition at line 408 of file mod_mbus.c.
References cfg_active, fd, and mbusDebug().
Referenced by mbus_config(), mbus_info(), mbus_register_slave(), mbusConfigFactoryReset(), mbusOpen(), and mbusSend().
|
static |
This function performs a factory reset of the RF module.
This includes erasing the serial number, so care should be taken when using it.
Definition at line 764 of file mod_mbus.c.
References cfg_activated, cfg_active, fd, mbusConfigExit(), mbusConfigTransact(), and mbusDebug().
|
static |
Send a single configuration command with additional data and receive the reply.
Will send the supplied configuration command/argument and the additional data, and return any expected reply.
The module must first have been set in configuration mode using mbusConfigEnter().
[in] | cmd | The command or value to send. |
[in] | data | Additional data to send. |
[in] | d_size | The length of the additional data to send |
[in] | reply | Reference to where reply is stored. |
[in] | r_size | Size of expected reply, '0' of no reply is expected. |
Definition at line 467 of file mod_mbus.c.
References fd, and mbusDebug().
Referenced by mbus_register_slave(), mbusConfigCmd(), and mbusConfigFactoryReset().
|
static |
Send a debug message to the device output in the format "<prefix>:<formated string>".
[in] | prefix | prefix to message |
[in] | format | the format and arguments |
Definition at line 244 of file mod_mbus.c.
Referenced by mbus_info(), mbus_read_reg(), mbusCallClose(), mbusCallInfo(), mbusCallOpen(), mbusCallReceive(), mbusCallRegisterSlave(), mbusCallSend(), mbusCallSetFilter(), mbusClose(), mbusConfigData(), mbusConfigEnter(), mbusConfigExit(), mbusConfigFactoryReset(), mbusConfigTransact(), mbusOpen(), mbusPower(), mbusReceive(), mbusSend(), moduleInit(), and moduleNotify().
|
static |
Control power to module.
Power the module on or off.
[in] | power | If 0 then off else on. |
Definition at line 269 of file mod_mbus.c.
References cfg_activated, and mbusDebug().
Referenced by mbusClose(), mbusOpen(), and moduleInit().