Valerio De Benedetto
81870dc1f2
Repository traffic workflow test 2
2023-02-11 10:23:38 +01:00
Valerio De Benedetto
129bac58e1
Repository traffic workflow test
2023-02-11 10:19:11 +01:00
Valerio De Benedetto
23ddf89409
Update README.md
2023-01-23 20:18:27 +01:00
Valerio De Benedetto
c96d6e63a0
Added clang-format check workflow
2023-01-23 18:43:11 +01:00
Valerio De Benedetto
9964a63d49
Merge pull request #19 from BenjaminPritchard/win32_examples
...
initial commit; add win32 example
2023-01-23 18:24:58 +01:00
benjamin pritchard
b2b91cc35f
fixed x64 project settings to target console subsystem
2023-01-23 11:52:55 -05:00
benjamin pritchard
8c0fafaf70
initial commit; add win32 example
2023-01-17 19:40:16 -05:00
Valerio De Benedetto
98814d2a66
Formatting
2022-12-28 15:05:56 +01:00
Valerio De Benedetto
c654babb52
clang-tidy
2022-12-28 15:02:51 +01:00
Valerio De Benedetto
f2b6ddda71
Fix to data pointer type of raw_pdu functions
2022-12-28 14:10:06 +01:00
Antonio Aguilera
fa02201710
Fix Wswitch-enum and Wcast-qual compiler warnings
...
The function nmbs_strerror does not handle the error code
NMBS_ERROR_INVALID_UNIT_ID inside the switch statement, which triggers
the GCC/Clang Wswitch-enum warning. Adding a new case inside the switch
statement solves this warning.
There is a cast from a const void pointer to an uint8_t pointer inside
the function nmbs_send_raw_pdu, which triggers the GCC/Clang Wcast-qual
warning. Adding the missing const qualifier solves this warning.
2022-12-27 20:42:36 +01:00
Valerio De Benedetto
b4172c8fef
Merge pull request #17 from jonathangjertsen/macros-to-funcs
...
Convert `get_` and `put_` to functions
2022-07-29 12:36:16 +02:00
jonath.re@gmail.com
70c75cb2db
Convert get_ and put_ to functions
...
This shaves off about 1 kB of flash usage from my client application.
It is also more type safe, which is nice.
2022-07-29 12:19:42 +02:00
Valerio De Benedetto
22fae7da9c
Enabled CI on pull requests
2022-07-29 10:58:54 +02:00
Valerio De Benedetto
074cdf3d86
Merge branch 'ci-arduino'
2022-07-25 15:34:37 +02:00
Valerio De Benedetto
d3381b2950
Proper setting of defines in tests
2022-07-25 15:20:09 +02:00
Valerio De Benedetto
fd101fe77f
Various fixes to NMBS_SERVER_* defines handling
2022-07-25 15:17:47 +02:00
Valerio De Benedetto
c12ba4b8a3
Merge branch 'callback-arg'
...
# Conflicts:
# nanomodbus.c
# nanomodbus.h
2022-07-25 12:59:40 +02:00
Valerio De Benedetto
5b685c9d97
Minor fixes
2022-07-25 12:47:11 +02:00
jonath.re@gmail.com
80fa8ef4ae
Send platform argument to nmbs_callbacks
...
This is useful for the same reasons as the arg is useful in the platform callbacks.
2022-07-22 19:19:04 +02:00
jonath.re@gmail.com
949cad80cf
Compile Arduino examples in CI
2022-07-22 18:46:37 +02:00
jonath.re@gmail.com
f926cd4a81
Add a CI workflow to build the code and run tests
...
Example output here: https://github.com/jonathangjertsen/nanoMODBUS/runs/7471676743
I'll try to build the Arduino examples as well, but this is a start
2022-07-22 18:10:39 +02:00
jonath.re@gmail.com
17aa0ca226
Support disabling individual server callbacks
...
This helps reduce code size for systems that do not implement the full
set of function codes supported by the library.
2022-07-22 17:14:32 +02:00
Valerio De Benedetto
10b9a0c13b
NMBS_ERROR_INVALID_TCP_MBAP on invalid transaction ID
2022-06-26 11:10:29 +02:00
Valerio De Benedetto
037de71d9b
Returning NMBS_ERROR_INVALID_UNIT_ID in case of invalid unit ID in response
2022-06-26 11:08:16 +02:00
Valerio De Benedetto
30c7ce3854
Moved nmbs_crc_calc() declaration
2022-06-26 09:26:07 +02:00
Valerio De Benedetto
4b613aa03d
Merge pull request #13 from jonathangjertsen/expose-crc
...
Expose the function that calculates CRC
2022-06-26 09:17:27 +02:00
Valerio De Benedetto
4f6c710835
Merge pull request #9 from jonathangjertsen/document-pointer-usage
...
Document that the platform configuration and callbacks can be discarded after initialization
2022-06-26 09:14:50 +02:00
jonath.re@gmail.com
f22b06082e
Expose the function that calculates CRC
...
Having access to this function is useful in a variety of cases:
- hand-crafting PDUs for unit tests
- implementing extensions of the protocol
- reusing the code for other purposes (e.g. firmware integrity check)
2022-06-25 17:17:34 +02:00
Jonathan Reichelt Gjertsen
53a6a64f9b
Update wording in comment for nmbs_client_create and nmbs_server_create
2022-06-24 19:06:37 +02:00
Valerio De Benedetto
ca0dd3bab3
Merge remote-tracking branch 'jonathangjertsen/update-helper-names'
2022-06-11 16:16:19 +02:00
Valerio De Benedetto
bcf42e5f5f
Merge pull request #10 from jonathangjertsen/debug-newline
...
Make the debug output less likely to clash with output from the callbacks
2022-06-11 16:04:22 +02:00
Jonathan Reichelt Gjertsen
4393c4a8a0
Update names of helper functions to show whether they call send or put_1/put_2
...
I think this makes the code easier to read, since you can tell whether each
function call will actually `send` some bytes over the wire, or if it will
just `put` some bytes into the buffer.
2022-06-07 20:09:17 +02:00
Jonathan Reichelt Gjertsen
249c4f3919
Sometimes it's useful to turn NMBS_DEBUG on, but the output is a bit of a mess if the read/write callbacks also log to the same channel. Moving the DEBUG statements in recv_msg_footer and send_msg_footer to the start of the function makes the output a bit cleaner, although it's not perfect.
...
Example output before this change:
```
NMBS req -> fc 16 a 12326 q 2 b 4 regs 4660 43981 transmitted[13] = { f7, 10, 30, 26, 00, 02, 04, 12, 34, ab, cd, c2, 04, }
received[1] = { 0xf7, }
received[1] = { 0x10, }
NMBS res <- fc 16 received[4] = { 0x30, 0x26, 00, 0x2, }
a 12326 q 2received[2] = { 0xbb, 0x95, }
NMBS req -> fc 3 a 12326 q 2 transmitted[8] = { f7, 03, 30, 26, 00, 02, 3e, 56, }
received[1] = { 0xf7, }
received[1] = { 0x3, }
NMBS res <- fc 3 received[1] = { 0x4, }
b 4 received[4] = { 0x12, 0x34, 0xab, 0xcd, }
regs 466043981received[2] = { 0x96, 0x2f, }
```
after:
```
NMBS req -> fc 16 a 12326 q 2 b 4 regs 4660 43981
transmitted[13] = { f7, 10, 30, 26, 00, 02, 04, 12, 34, ab, cd, c2, 04, }
received[1] = { 0xf7, }
received[1] = { 0x10, }
NMBS res <- fc 16 received[4] = { 0x30, 0x26, 00, 0x2, }
a 12326 q 2
received[2] = { 0xbb, 0x95, }
NMBS req -> fc 3 a 12326 q 2
transmitted[8] = { f7, 03, 30, 26, 00, 02, 3e, 56, }
received[1] = { 0xf7, }
received[1] = { 0x3, }
NMBS res <- fc 3 received[1] = { 0x4, }
b 4 received[4] = { 0x12, 0x34, 0xab, 0xcd, }
regs 466043981
received[2] = { 0x96, 0x2f, }
```
2022-06-07 19:52:40 +02:00
Jonathan Reichelt Gjertsen
3a1170b925
Document that the platform configuration and callbacks can be discarded after initialization
...
`nmbs_client_create` accepts a `const nmbs_platform_conf* platform_conf` with configuration. Without reading the source code, it is not clear whether or not the object pointed to by `platform_conf` can be declared on the stack, or if it needs to be kept alive for the duration of the program (as would be the case if the implementation simply kept a pointer to the configuration instead of copying it by value). This PR adds an assurance that it is OK to discard the platform configuration after calling `nmbs_client_create`. Same idea for `nmbs_server_create`.
2022-06-07 19:29:04 +02:00
Valerio De Benedetto
6a3086c0f5
Updated CMakeLists.txt
2022-06-04 14:20:02 +02:00
Valerio De Benedetto
6e7fa6fdcc
Updated README.md
2022-06-04 14:16:56 +02:00
Valerio De Benedetto
7045813f8b
Fixes to arduino examples
2022-06-04 14:16:43 +02:00
Valerio De Benedetto
2a149a93ec
Initial arduino examples
2022-06-02 22:49:30 +02:00
Valerio De Benedetto
494e1a385b
Refactoring of examples
2022-06-02 22:48:54 +02:00
Valerio De Benedetto
53da24091b
Added __AVR_ARCH__ endianness check
2022-06-02 22:39:30 +02:00
Valerio De Benedetto
7e6ce4f4fd
Fixes
2022-06-02 21:58:21 +02:00
Valerio De Benedetto
432f6801f8
Updated readme
2022-06-02 11:59:51 +02:00
Valerio De Benedetto
a8bf7428cc
Updated docstrings
2022-06-02 11:59:45 +02:00
Valerio De Benedetto
83fb04392b
Fixes to integer types
2022-06-02 11:52:10 +02:00
Valerio De Benedetto
76f28fefb9
Updated examples
2022-06-02 11:10:42 +02:00
Valerio De Benedetto
7f811f2338
Updated tests
2022-06-02 10:53:43 +02:00
Valerio De Benedetto
b6fee48160
Switch to multibyte transport read/write funcs, removed sleep
2022-06-02 10:53:32 +02:00
Valerio De Benedetto
afcdae0ec8
Formatting
2022-05-12 19:29:51 +02:00
Valerio De Benedetto
271f689771
Added NMBS_ERROR_CRC and NMBS_ERROR_INVALID_TCP_MBAP nmbs_error
2022-05-12 19:28:50 +02:00