Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed
Fork of ICE by
src/ModbusMaster/ModbusMasterApi.cpp@83:0f76cfbb4eba, 2016-09-20 (annotated)
- Committer:
- davidjhoward
- Date:
- Tue Sep 20 16:21:17 2016 +0000
- Revision:
- 83:0f76cfbb4eba
- Child:
- 134:f90154ff33ec
add API to access modbus registers
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| davidjhoward | 83:0f76cfbb4eba | 1 | #include "ModbusMasterApi.h" |
| davidjhoward | 83:0f76cfbb4eba | 2 | #include "MTSLog.h" |
| davidjhoward | 83:0f76cfbb4eba | 3 | |
| davidjhoward | 83:0f76cfbb4eba | 4 | bool ModbusMasterReadRegister( const std::string &io_tag, ModbusValue *value ) |
| davidjhoward | 83:0f76cfbb4eba | 5 | { |
| davidjhoward | 83:0f76cfbb4eba | 6 | logInfo("%s:%d ", __func__, __LINE__); |
| davidjhoward | 83:0f76cfbb4eba | 7 | value->value = ModbusRegisterMap[io_tag].float_value; |
| davidjhoward | 83:0f76cfbb4eba | 8 | value->valid = true; |
| davidjhoward | 83:0f76cfbb4eba | 9 | return true; |
| davidjhoward | 83:0f76cfbb4eba | 10 | } |
| davidjhoward | 83:0f76cfbb4eba | 11 | |
| davidjhoward | 83:0f76cfbb4eba | 12 | bool ModbusMasterWriteRegister( const std::string &io_tag, float value ) |
| davidjhoward | 83:0f76cfbb4eba | 13 | { |
| davidjhoward | 83:0f76cfbb4eba | 14 | logInfo("%s:%d ", __func__, __LINE__); |
| davidjhoward | 83:0f76cfbb4eba | 15 | ModbusRegisterMap[io_tag].float_value = value; |
| davidjhoward | 83:0f76cfbb4eba | 16 | return true; |
| davidjhoward | 83:0f76cfbb4eba | 17 | } |
