Skip to content

Commit f2766c5

Browse files
committed
test: Adds tests for issues
1 parent 13bc434 commit f2766c5

File tree

6 files changed

+140
-0
lines changed

6 files changed

+140
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.pio
2+
.vscode/.browse.c_cpp.db*
3+
.vscode/c_cpp_properties.json
4+
.vscode/launch.json
5+
.vscode/ipch
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
; PlatformIO Project Configuration File
2+
;
3+
; Build options: build flags, source filter
4+
; Upload options: custom upload port, speed and extra flags
5+
; Library options: dependencies, extra library storages
6+
; Advanced options: extra scripting
7+
;
8+
; Please visit documentation for the other options and examples
9+
; https://docs.platformio.org/page/projectconf.html
10+
11+
[platformio]
12+
default_envs = mkrvidor4000
13+
14+
[env:mkrvidor4000]
15+
platform = atmelsam
16+
board = mkrvidor4000
17+
framework = arduino
18+
lib_extra_dirs = ../../..
19+
;lib_deps = epsilonrt/Modbus-Serial@^2.0.3
20+
21+
[env:mkrvidor4000-debug]
22+
platform = atmelsam
23+
framework = arduino
24+
board = mkrvidor4000
25+
debug_tool = atmel-ice
26+
27+
28+
; Debugger (gdb) support
29+
; https://docs.arduino.cc/tutorials/mkr-wifi-1010/mkr-jlink-setup
30+
; https://gojimmypi.blogspot.com/2018/12/swd-debugging-arduino-mkr-wifi-1010.html
31+
32+
build_type = debug
33+
lib_extra_dirs = ../../..
34+
;lib_deps = epsilonrt/Modbus-Serial@^2.0.3
35+
36+
; activate Dual USB just as README says
37+
build_flags =
38+
-DDEBUG # Comment out to disable debugging.
39+
;debug_build_flags = -O0 -g2 -ggdb2
40+
debug_build_flags = -O0 -ggdb3 -g3
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <Arduino.h>
2+
#include <ModbusSerial.h>
3+
4+
ModbusSerial mb (Serial, 10);
5+
6+
const uint8_t NbOfIsts = 24;
7+
const uint16_t FirstIsts = 197;
8+
const uint32_t IstsValues = 0xB5DBAC;
9+
10+
void setup() {
11+
12+
Serial.begin (38400);
13+
mb.config (38400);
14+
15+
for (uint8_t i = 0; i < NbOfIsts; i++) {
16+
17+
mb.addIsts (FirstIsts -1 + i, (IstsValues & (1 << i)) != 0);
18+
}
19+
}
20+
21+
void loop() {
22+
23+
mb.task();
24+
}
25+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.pio
2+
.vscode/.browse.c_cpp.db*
3+
.vscode/c_cpp_properties.json
4+
.vscode/launch.json
5+
.vscode/ipch
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
; PlatformIO Project Configuration File
2+
;
3+
; Build options: build flags, source filter
4+
; Upload options: custom upload port, speed and extra flags
5+
; Library options: dependencies, extra library storages
6+
; Advanced options: extra scripting
7+
;
8+
; Please visit documentation for the other options and examples
9+
; https://docs.platformio.org/page/projectconf.html
10+
11+
[platformio]
12+
default_envs = mkrvidor4000
13+
14+
[env:mkrvidor4000]
15+
platform = atmelsam
16+
board = mkrvidor4000
17+
framework = arduino
18+
lib_extra_dirs = ../../..
19+
;lib_deps = epsilonrt/Modbus-Serial@^2.0.3
20+
21+
[env:mkrvidor4000-debug]
22+
platform = atmelsam
23+
framework = arduino
24+
board = mkrvidor4000
25+
debug_tool = atmel-ice
26+
27+
28+
; Debugger (gdb) support
29+
; https://docs.arduino.cc/tutorials/mkr-wifi-1010/mkr-jlink-setup
30+
; https://gojimmypi.blogspot.com/2018/12/swd-debugging-arduino-mkr-wifi-1010.html
31+
32+
build_type = debug
33+
lib_extra_dirs = ../../..
34+
;lib_deps = epsilonrt/Modbus-Serial@^2.0.3
35+
36+
; activate Dual USB just as README says
37+
build_flags =
38+
-DDEBUG # Comment out to disable debugging.
39+
;debug_build_flags = -O0 -g2 -ggdb2
40+
debug_build_flags = -O0 -ggdb3 -g3
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <Arduino.h>
2+
#include <ModbusSerial.h>
3+
4+
ModbusSerial mb (Serial, 10);
5+
6+
const uint8_t NbOfCoil = 19;
7+
const uint16_t FirstCoil = 20;
8+
const uint32_t CoilValues = 0x056BCD;
9+
10+
void setup() {
11+
12+
Serial.begin (38400);
13+
mb.config (38400);
14+
15+
for (uint8_t i = 0; i < NbOfCoil; i++) {
16+
17+
mb.addCoil (FirstCoil -1 + i, (CoilValues & (1 << i)) != 0);
18+
}
19+
}
20+
21+
void loop() {
22+
23+
mb.task();
24+
}
25+

0 commit comments

Comments
 (0)