Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Usually not used.
Called at the re-initialization of code execution, with no peripheral API or initialization.
This callback function definition is optional.
Call back functions describing an application.
This is a callback function that describes the application. Callback means called by the system (library). The user defines several callback functions to describe the behavior of the system.
The following callback functions are mandatory definitions.
setup()
loop()
If no other functions are defined, an empty function that does nothing is linked instead.
Please refer to the source code mwx_appcore.cpp
if you want to see the exact behavior.
Please refer to the source code mwx_appcore.cpp
if you want to see the exact behavior.
DESC
Usually not used.
Called in re-initialization when the peripheral API is not initialized after returning from sleep.
This function can be used to detect interrupt factors.
This callback function definition is optional.
the main loop function.
This is the main loop of the application. After the loop ends, the CPU transitions to DOZE mode and waits for the next interrupt with low current consumption.
In the Act description, most of the processing is described in this loop.
The back function definition is optional.
on_tx_comp()
Called when transmission is complete.
This function is called from within the MWX library with data stored in ev
as packet_ev_tx
when the wireless packet transmission is finished. If this function is not defined in the application, a weak function that does nothing is linked.
ev.u8CbId
is the ID at the time of transmission and ev.bStatus
is a flag indicating success (1) or failure (0) of the transmission.
Setting b_handled
to true in this function tells the MWX library that the incoming packet has been processed in the application. If set to processed, it suppresses unnecessary processing. (Do not call event callback functions for the_twelite.app
, .board
, or .settings
)
It is called only once before the first call to the loop()
function; since TWENET is already initialized, there is no need to consider constraints such as setup()
.
The main usage is to
Displaying startup messages
Writing code for testing
Sleep transition immediately after startup
Processing that is inconvenient for setup()
(radio packet processing, timer operation, etc.)
This callback function definition is optional.
the setup function to initialize an application.
Called at the beginning of code execution to write initialization code.
TWENET initialization is also executed after the setup()
function exits. Do not do anything other than initialization here, since most of the processing is done after TWENET exits.
Items to be noted are listed below.
Sleep the_twenet.sleep()
cannot be executed. If you want to sleep immediately after initialization, write the first sleep process in the begin()
function.
The delay()
function is replaced by the processing described below. In this case, the parameter ms
does not specify milliseconds. \frz
* Alternative processing for delay()
.
the function called when waking up from sleep.
Called before loop()
when waking up from sleep, and includes procedures for initialization after returning from sleep and for branching processing depending on the state of return.
If there is no processing in loop()
but only reading of sensors, etc., sleep can be performed again in this function.
This callback function definition is optional.
on_rx_packet()
Receives incoming packets.
When a wireless packet is received, this function is called from within the MWX library with the data stored in pkt
as packet_rx. If this function is not defined in the application, a weak function that does nothing is linked.
Setting b_handled
to true in this function tells the MWX library that the incoming packet has been processed in the application. If set to processed', it suppresses unnecessary processing. (Do not process
the_twelite.receiver`)
When using BEHAVIOR, use the callback function in BEHAVIOR.
The the_twelite.receiver
is not recommended.
The receiver was previously processed by the_twelite.receiver
with the intention of describing it in loop()
. However, on_rx_packet()
was added because it is a delayed processing by a queue, which in principle causes overflow, and also because it tends to be complicated to describe.