act0..4
Simple acts to try first
MWSDK/Act_Samples directory contains sample programs for act.Below are acts introduced by purpose.
act0..4These are very simple examples that do not use wireless functions. You can understand the basic structure of act.
This is an example of a wireless sensor implementation that connects an I2C sensor and sends wireless packets while operating simply with sleep.
BRD_I2C_TEMPHUMIDIncludes typical elements for implementing wireless sensors with TWELITE (use of simple relay network <NWK_SIMPLE>, interactive mode <STG_STD>, handling of I2C sensor Wire, intermittent operation by sleep, etc.).
These are samples that send or send/receive wireless packets, each implemented from slightly different perspectives.
ScratchA simple code that receives a 1-byte command from UART and performs transmission etc.
Slp_Wk_and_TxUses a state machine and intermittent operation with sleep, repeating sleep wake-up → wireless transmission → sleep.
PingPongA sample that sends packets from one side to the other, and the receiver sends back packets. It includes basic procedures for sending and receiving.
WirelessUARTInterprets ASCII format using serparser from UART input and then transmits it.
Please refer when implementing your own receiving parent application.
Parent-MONOSTICKOnly receives and outputs the reception result to the serial port. It can receive wireless packets addressed to the parent device (0x00) or child broadcast (0xFE). It also includes procedures to add interactive mode <STG_STD> to act.
Rcv_UnivslSample code for a universal packet receiver (TWENET layer tree network, App_Twelite, act, etc.). It also uses the EASTL library for containers and algorithms.
The explanation of acts using interactive mode describes the general flow (here quoting the above BRD_I2C_TEMPHUMID). There is not much difference in the explanation of any sample.
BRD_I2C_TEMPHUMIDExecutes read/write commands for I2C sensor devices and wirelessly transmits measurement values obtained from the I2C sensor. It also includes procedures to add interactive mode <STG_STD> to act.
SettingsPerforms more advanced customization of interactive mode <STG_STD>. Please refer to the code for details.
Samples that obtain sensor information from built-in peripherals or external sensor devices.
BRD_APPTWELITEPerforms two-way communication using digital input, analog input, digital output, and analog output. It also includes procedures to add interactive mode <STG_STD> to act.
BRD_I2C_TEMPHUMIDExecutes read/write commands for I2C sensor devices and wirelessly transmits measurement values obtained from the I2C sensor. It also includes procedures to add interactive mode <STG_STD> to act.
PulseCounterUses the pulse counter function to count pulses detected at the input port, including during sleep, and wirelessly transmits them.
PAL_AMB_behaviorAn example using behavior. In PAL_AMB, the temperature and humidity sensor is called inside the library code, but this sample includes its own procedures for accessing the temperature and humidity sensor.
TWELITE PAL has standard PAL apps written, but you can also write acts without using PAL apps. The MWX library provides standard procedures for operating sensors used in PAL.
Samples for various PAL boards. They obtain sensor values on PAL boards, transmit, and sleep.
PAL_AMBPAL_MOT-singlePAL_MAGThe following are advanced examples with slightly more complex descriptions than the above acts.
PAL_AMB_usenap is a sample aiming for lower power by putting the TWELITE microcontroller to sleep briefly during the tens of milliseconds sensor operation time.PAL_AMB_behavior is an example using behavior. In PAL_AMB, the temperature and humidity sensor is called inside the library code, but this sample includes its own procedures for accessing the temperature and humidity sensor.PAL_MOT_fifo is a sample that continuously acquires and wirelessly transmits acceleration sensor FIFO data and FIFO interrupts without interrupting the sample.The PAL_MOT act is available. Minor modifications may be required.
PAL_MOT-singlePAL_MOT_fifo is a sample that continuously acquires and wirelessly transmits acceleration sensor FIFO data and FIFO interrupts without interrupting the sample.BRD_ARIA is an act for operating TWELITE ARIA.BRD_I2C_TEMPHUMID is a template for using I2C sensors, but includes code for the SHT40 sensor used with TWELITE ARIA as an implementation example.PAL_AMB.Unit-* are intended to introduce functions and APIs.
The latest code and change history between MWSDK versions are placed on Github for reference. Please see the following link.
The following items are common settings in act samples and are explained below.
const uint32_t APP_ID = 0x1234abcd;
const uint8_t CHANNEL = 13;
const char APP_FOURCHAR[] = "BAT1";
Common settings for sample acts are as follows:
Both the application ID and channel are mechanisms to avoid mixing with other networks.
Systems with different application IDs will not interfere even if they use the same channel. However, if another system with a different application ID frequently transmits wirelessly, it may interfere.
Channels determine the frequency used for communication. TWELITE wireless modules can use 16 channels in principle, and except for extremely rare cases, communication with other channels is not possible.
As a common specification for sample acts, the first 4 bytes of the packet payload (data part) store a string (APP_FOURCHAR[]). One byte is sufficient for type identification, but this is for explanation. Including such system-specific identifiers and data structures is also a measure against interference.
Simple acts to try first
Template code
Transmits a packet upon waking from sleep
Parent application (for MONOSTICK)
Send and receive packets
Digital and Analog Signal Transmission
Transmit data from I2C sensor devices
Sample using TWELITE ARIA
Sample using the environmental sensor PAL
Sample using the environmental sensor Pal
Sample using the environmental sensor PAL
Sample using magnetic sensor pal
Sample using motion sensor pal
Sample using motion sensor pal
Sample using pulse counter
Performs serial communication.
Receives various types of packets
Sample for verifying the operation of single functions