Skip to content

Commit fa84815

Browse files
committed
change how callback funtions are assigned to cb struct - use direct assignment statements in startup - not *non-trivial designated inits - not supported for some boards?!
1 parent ec0ed8b commit fa84815

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

examples/Example03_NavigationUART/Example03_NavigationUART.ino

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,9 @@ static void on_navigation(uint16_t gesture)
146146
}
147147
}
148148

149-
// Define our command callbacks the library will call on events from the sensor
150-
static const sfDevFPC2534Callbacks_t cmd_cb = {.on_error = on_error,
151-
.on_version = on_version,
152-
.on_navigation = on_navigation,
153-
.on_is_ready_change = on_is_ready_change};
149+
// Define our command callback structure - initialize to 0/null.
150+
// assigin our callback methods in setup
151+
static sfDevFPC2534Callbacks_t cmd_cb = {0};
154152

155153
//------------------------------------------------------------------------------------
156154
// reset_sensor()
@@ -186,6 +184,12 @@ void setup()
186184
Serial.println("----------------------------------------------------------------");
187185
Serial.println();
188186

187+
// Setup our callback functions structure
188+
cmd_cb.on_error = on_error;
189+
cmd_cb.on_version = on_version;
190+
cmd_cb.on_navigation = on_navigation;
191+
cmd_cb.on_is_ready_change = on_is_ready_change;
192+
189193
// Initialize the UART/Serial communication
190194

191195
// The internal UART buffer can fill up quickly and overflow. As such, increase its size.

0 commit comments

Comments
 (0)