Skip to content

Commit e3a4261

Browse files
committed
Provide workarounds for inot as classes
1 parent 7d503b2 commit e3a4261

File tree

6 files changed

+34
-6
lines changed

6 files changed

+34
-6
lines changed

examples/Breaks_1/Thread.inot

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
* resulting in a compile error.
55
*/
66

7-
int myFunc(int const a, int const b);
7+
/* To fix this in the "class-wrapping" method, don't write
8+
* forward declarations.
9+
*/
10+
11+
//int myFunc(int const a, int const b);
812

913
void setup()
1014
{

examples/Breaks_2/Thread.inot

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
* 'void myEventHandler(void)'
66
*/
77

8-
void myEventHandler()
8+
/* To fix this in the "class-wrapping" method, add `static`
9+
* in front of the callback declaration.
10+
*/
11+
12+
static void myEventHandler()
913
{
1014
/* Do something. */
1115
}

examples/Breaks_3/Thread.inot

+12-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@
22
* a static member variable is forbidden.
33
*/
44

5-
static int my_global_variable = 0;
5+
/* To fix this in the "class-wrapping" method, remove `static`
6+
* or remove the initialization.
7+
*/
8+
9+
/*static*/ int my_global_variable = 0;
10+
11+
#if ANOTHER_WAY
12+
static int my_global_variable;
13+
#endif
614

715
void setup()
816
{
9-
17+
#if ANOTHER_WAY
18+
// my_global_variable = 0;
19+
#endif
1020
}
1121

1222
void loop()

examples/Breaks_4/Thread.inot

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
/* Breaks for all kind of stuff ...
22
*/
33

4+
/* To fix this in the "class-wrapping" method, remove `static`
5+
* and change objects declarations
6+
* from `Classname obj(args...)`
7+
* to `Classname obj = Classname{args..}`
8+
*/
9+
410
/**************************************************************************************
511
* CONSTANTS
612
**************************************************************************************/
@@ -12,7 +18,8 @@ static byte constexpr LSM6DSOX_WHO_AM_I_REG = 0x0F;
1218
* GLOBAL VARIABLES
1319
**************************************************************************************/
1420

15-
BusDevice lsm6dsox(Wire, LSM6DSOX_ADDRESS);
21+
// BusDevice lsm6dsox(Wire, LSM6DSOX_ADDRESS);
22+
BusDevice lsm6dsox = BusDevice{Wire, LSM6DSOX_ADDRESS};
1623

1724
/**************************************************************************************
1825
* FUNCTIONS

examples/Breaks_5/Thread.inot

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void loop()
1313

1414
}
1515

16-
void myEventHandler()
16+
static void myEventHandler()
1717
{
1818
/* Do something. */
1919
}

examples/Breaks_6/Thread.inot

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/* Break here is intentional
2+
*/
3+
14
void setup()
25
{
36

0 commit comments

Comments
 (0)