@@ -34,16 +34,19 @@ also provided:
3434 TimerOne (https://github.com/PaulStoffregen/TimerOne ) library
3535* [ EpoxyMockFastLED] ( libraries/EpoxyMockFastLED/ ) : mock version of the
3636 FastLED (https://github.com/FastLED/FastLED ) library
37+ * [ EpoxyMockSTM32RTC] ( libraries/EpoxyMockSTM32RTC/ ) : mock version of the
38+ STM32RTC (https://github.com/stm32duino/STM32RTC ) library
3739
3840These mock libraries may be sufficient for a CI pipeline.
3941
4042For actual application development, I have started to build a set of
4143libraries within EpoxyDuino which emulate the versions that run the actual
4244hardware:
4345
44- * EpoxyFS: emulation of the ESP8266 LittleFS or ESP32 LittleFS
45- * EpoxyEepromAvr: emulation of AVR-flavored ` EEPROM `
46- * EpoxyEepromEsp: emulation of ESP-flavored ` EEPROM `
46+ * [ EpoxyFS] ( libraries/EpoxyFS ) : emulation of the ESP8266 LittleFS or
47+ ESP32 LittleFS filesystem
48+ * [ EpoxyEepromAvr] ( libraries/EpoxyEepromAvr ) : emulation of AVR-flavored ` EEPROM `
49+ * [ EpoxyEepromEsp] ( libraries/EpoxyEepromEsp ) : emulation of ESP-flavored ` EEPROM `
4750
4851If your program has limited hardware dependencies so that it is conceptually
4952portable to a vanilla Unix environment, EpoxyDuino may work well for you.
@@ -68,7 +71,7 @@ The disadvantages are:
6871 environments (e.g. 16-bit ` int ` versus 32-bit ` int ` , or 32-bit ` long ` versus
6972 64-bit ` long ` ).
7073
71- ** Version** : 1.2.3 (2022-02-24 )
74+ ** Version** : 1.3.0 (2022-03.28 )
7275
7376** Changelog** : See [ CHANGELOG.md] ( CHANGELOG.md )
7477
@@ -85,14 +88,17 @@ The disadvantages are:
8588 * [ Continuous Integration] ( #ContinuousIntegration )
8689* [ Advanced Usage] ( #AdvancedUsage )
8790 * [ Alternate C++ Compiler] ( #AlternateCompiler )
88- * [ Generated Source Code] ( #GeneratedSourceCode )
91+ * [ Additional Cpp Flags] ( #AdditionalCppFlags )
92+ * [ Additional Compiler Flags] ( #AdditionalCompilerFlags )
8993 * [ Additional Clean Up] ( #AdditionalCleanUp )
9094 * [ Additional Dependencies] ( #AdditionalDependencies )
95+ * [ Generated Source Code] ( #GeneratedSourceCode )
9196 * [ Alternate Arduino Core] ( #AlternateArduinoCore )
9297 * [ PlatformIO] ( #PlatformIO )
9398 * [ Command Line Flags and Arguments] ( #CommandLineFlagsAndArguments )
9499 * [ Debugging] ( #Debugging )
95100 * [ Valgrind] ( #Valgrind )
101+ * [ Controlling digitalRead()] ( #DigitalReadValue )
96102* [ Supported Arduino Features] ( #SupportedArduinoFeatures )
97103 * [ Arduino Functions] ( #ArduinoFunctions )
98104 * [ Serial Port Emulation] ( #SerialPortEmulation )
@@ -449,52 +455,35 @@ Take a look at some of my GitHub Actions YAML config files:
449455### Alternate C++ Compiler
450456
451457Normally the C++ compiler on Linux is ` g++ ` . If you have ` clang++ ` installed
452- you can use that instead by specifying the ` CXX ` environment variable:
458+ you can use that instead by specifying the ` CXX ` makefile variable:
453459```
454- $ CXX=clang++ make
460+ $ make CXX=clang++
455461```
456- (This sets the ` CXX ` shell environment variable temporarily, for the duration of
457- the ` make ` command, which causes ` make ` to set its internal ` CXX ` variable,
458- which causes ` EpoxyDuino.mk ` to use ` clang++ ` over the default ` g++ ` .)
462+ (This tells ` make ` to set the ` CXX ` variable to ` clang++ ` within the context of
463+ ` EpoxyDuino.mk ` which causes ` clang++ ` to be used over the default ` g++ ` .)
459464
460- The ` clang++ ` compiler will sometimes catch a different set of programming
461- errors.
465+ One reason to use ` clang++ ` instead of ` g++ ` is that the ` clang++ ` compiler will
466+ sometimes catch a different set of programming errors.
462467
463- <a name =" GeneratedSourceCode " ></a >
464- ### Generated Source Code
468+ <a name =" AdditionalCppFlags " ></a >
469+ ### Additional Cpp Flags
465470
466- If a source file is generated dynamically through a code generation script,
467- and the source file is * not* checked into the repository because it is too
468- dynamic, then you can include the generated files using the ` GENERATED `
469- and the ` OBJS ` variables.
470-
471- First add the list of generated files ` *.cpp ` or ` *.c ` to the ` GENERATED `
472- variable. Then add the corresponding ` *.o ` files to the ` OBJS ` variable, like
473- this:
471+ You can pass additional flags to the C preprocessor through the ` EXTRA_CPPFLAGS `
472+ variable, like this:
474473
475474```
476- GENERATED := foo.cpp bar.cpp
477- OBJS := foo.o bar.o
478- APP_NAME := {name of project}
479- ARDUINO_LIBS := {list of dependent Arduino libraries}
480- include {path/to/EpoxyDuino.mk}
475+ $ make EXTRA_CPPFLAGS='-D DEBUG=2'
476+ ```
481477
482- foo.cpp: foo.h generate_foo.sh
483- ./generate_foo.sh # creates 'foo.cpp'
478+ < a name = " AdditionalCompilerFlags " ></ a >
479+ ### Additional Compiler Flags
484480
485- bar.cpp: bar.h generate_bar.sh
486- ./generate_bar.sh # creates 'bar.cpp'
481+ You can pass additional flags to the C++ compiler through the ` EXTRA_CXXFLAGS `
482+ variable, like this:
487483
488- ...
489484```
490-
491- The ` *.o ` files in ` OJBS ` are passed to the linker when the ` app.out ` binary
492- file is created.
493-
494- The ` GENERATED ` is not strictly required, since the default rules already know
495- how to compile the ` *.o ` files from the ` *.cpp ` or ` *.c ` files. The primary
496- effect of ` GENERATED ` currently is to cause the generated files to be removed
497- when ` make clean ` is called.
485+ $ make EXTRA_CXXFLAGS='-g'
486+ ```
498487
499488<a name =" AdditionalCleanUp " ></a >
500489### Additional Clean Up
@@ -535,6 +524,42 @@ DEPS := header1.h header2.h
535524include {path/to/EpoxyDuino.mk}
536525```
537526
527+ <a name =" GeneratedSourceCode " ></a >
528+ ### Generated Source Code
529+
530+ If a source file is generated dynamically through a code generation script,
531+ and the source file is * not* checked into the repository because it is too
532+ dynamic, then you can include the generated files using the ` GENERATED `
533+ and the ` OBJS ` variables.
534+
535+ First add the list of generated files ` *.cpp ` or ` *.c ` to the ` GENERATED `
536+ variable. Then add the corresponding ` *.o ` files to the ` OBJS ` variable, like
537+ this:
538+
539+ ```
540+ GENERATED := foo.cpp bar.cpp
541+ OBJS := foo.o bar.o
542+ APP_NAME := {name of project}
543+ ARDUINO_LIBS := {list of dependent Arduino libraries}
544+ include {path/to/EpoxyDuino.mk}
545+
546+ foo.cpp: foo.h generate_foo.sh
547+ ./generate_foo.sh # creates 'foo.cpp'
548+
549+ bar.cpp: bar.h generate_bar.sh
550+ ./generate_bar.sh # creates 'bar.cpp'
551+
552+ ...
553+ ```
554+
555+ The ` *.o ` files in ` OJBS ` are passed to the linker when the ` app.out ` binary
556+ file is created.
557+
558+ The ` GENERATED ` is not strictly required, since the default rules already know
559+ how to compile the ` *.o ` files from the ` *.cpp ` or ` *.c ` files. The primary
560+ effect of ` GENERATED ` currently is to cause the generated files to be removed
561+ when ` make clean ` is called.
562+
538563<a name =" AlternateArduinoCore " ></a >
539564### Alternate Arduino Core
540565
@@ -694,6 +719,45 @@ start:
694719When the program crashes because of a ` nullptr ` dereference, Valgrind will show
695720exactly where that happened in the source code.
696721
722+ <a name =" DigitalReadValue " ></a >
723+ ### Controlling digitalRead()
724+
725+ By default, the ` digitalRead(pin) ` function simply returns a 0, because
726+ EpoxyDuino does not actually have any hardware pins. For testing purposes, it
727+ can be useful to control the value that will be returned by a ` digitalRead() ` .
728+
729+ The ` digitalReadValue(pin, val) ` function sets the value that will be returned
730+ by the corresponding ` digitalRead(pin) ` . Here is an example of how this can be
731+ used:
732+
733+ ``` C++
734+ #include < Arduino.h>
735+
736+ ...
737+ const uint8_t PIN = 8 ;
738+
739+ void something () {
740+ uint8_t val = digitalRead(PIN); // val == 0
741+
742+ #if defined(EPOXY_DUINO)
743+ digitalReadValue (PIN, 1);
744+ #endif
745+ val = digitalRead(PIN); // val == 1
746+
747+ #if defined(EPOXY_DUINO)
748+ digitalReadValue (PIN, 0);
749+ #endif
750+ val = digitalRead(PIN); // val == 0
751+ }
752+ ```
753+
754+ The ` #if defined(EPOXY_DUINO) ` is recommended because ` digitalReadValue() ` is
755+ not a standard Arduino function. It is defined only in EpoxyDuino.
756+
757+ The ` pin ` parameter should satisfy ` 0 <= pin < 32 ` . If ` pin >= 32 ` , then
758+ ` digitalReadValue() ` is a no-op and the corresponding ` digitalRead(pin) ` will
759+ always return 0.
760+
697761<a name =" SupportedArduinoFeatures " ></a >
698762## Supported Arduino Features
699763
@@ -799,8 +863,6 @@ worth the trade-off.
799863<a name =" UnixLineMode " ></a >
800864#### Unix Line Mode
801865
802- (Added in v1.2.0)
803-
804866The ` Print ` class in the Arduino API implements the ` Print::println() ` function
805867by printing the DOS line terminator characters ` \r\n ` . This decision make sense
806868when the serial port of the microcontroller is connected to a serial terminal,
@@ -873,8 +935,6 @@ test(myTest) {
873935<a name="EnableTerminalEcho"></a>
874936#### Enable Terminal Echno
875937
876- (Added in v1.2.3)
877-
878938By default, the `stdin` of the terminal is set to `NOECHO` mode for consistency
879939with the actual serial port of an Arduino microcontroller. However when running
880940a command line utility on a Unix terminal emulator using EpoxyDuino, it is often
@@ -1004,6 +1064,9 @@ intended. This limitation may be sufficient for Continuous Integration purposes.
10041064 library.
10051065* [ EpoxyMockFastLED] ( libraries/EpoxyMockFastLED/ )
10061066 * Mock version of the FastLED (https://github.com/FastLED/FastLED ) library.
1067+ * [ EpoxyMockSTM32RTC] ( libraries/EpoxyMockSTM32RTC/ )
1068+ * Mock version of the STM32RTC (https://github.com/stm32duino/STM32RTC )
1069+ library.
10071070* EspMock (https://github.com/hsaturn/EspMock )
10081071 * This is a separate project that provides various mocks for functions and
10091072 libraries included with the ESP8266 and the ESP32 processors.
@@ -1015,18 +1078,18 @@ intended. This limitation may be sufficient for Continuous Integration purposes.
10151078
10161079This library has Tier 1 support on:
10171080
1018- * Ubuntu 18.04
1019- * g++ (Ubuntu 7.5.0-3ubuntu1~ 18.04) 7.5.0
1020- * clang++ 8.0.0-3~ ubuntu18.04.2
1021- * clang++ 6.0.0-1ubuntu2
1022- * GNU Make 4.1
1023- * Ubuntu 20.04
1024- * g++ (Ubuntu 9.3.0-10ubuntu2) 9.3.0
1081+ * Ubuntu 20.04.4 LTS
1082+ * g++ (Ubuntu 9.4.0-1ubuntu1~ 20.04.1) 9.4.0
10251083 * clang++ version 10.0.0-4ubuntu1
10261084 * GNU Make 4.2.1
10271085
10281086The following environments are Tier 2 because I do not test them often enough:
10291087
1088+ * Ubuntu 18.04 LTS
1089+ * g++ (Ubuntu 7.5.0-3ubuntu1~ 18.04) 7.5.0
1090+ * clang++ 8.0.0-3~ ubuntu18.04.2
1091+ * clang++ 6.0.0-1ubuntu2
1092+ * GNU Make 4.1
10301093* Raspbian GNU/Linux 10 (buster)
10311094 * On Raspberry Pi Model 3B
10321095 * g++ (Raspbian 8.3.0-6+rpi1) 8.3.0
@@ -1136,3 +1199,6 @@ people ask similar questions later.
11361199 see [ PR #32 ] ( https://github.com/bxparks/EpoxyDuino/pull/32 ) .
11371200* Simplify ` StdioSerial ` by Bernhard (@felias-fogg ),
11381201 [ Issue #43 ] ( https://github.com/bxparks/EpoxyDuino/issues/43 ) .
1202+ * Add ` digitalReadValue(pin, val) ` to control the return value of
1203+ ` digitalRead(pin) ` by @CaioPellicani . See
1204+ [ PR #61 ] ( https://github.com/bxparks/EpoxyDuino/pull/61 ) .
0 commit comments