Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Functions
System functions (time, random numbers)
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Act/behavior Programming Interface
The MWX library API may be subject to specification changes in the future for the purpose of improvement.
PulseCounter (mwx::periph_pulse_counter)
The pulse counter is a circuit that reads and counts pulses even when the microcontroller CPU is not running. There are two systems of pulse counters: PC0 is assigned to PulseCounter0
and PC1 to PulseCounter1
.
PC0 is assigned to PulseCounter0
and PC1 is assigned to PulseCounter1
.
Initializes the object and starts counting. the first parameter refct
is the count number on which interrupts and available decisions are based. When this number is exceeded, it is reported to the application. You can also set refct
to 0. In this case, it is not a sleep wake-up factor.
The second parameter edge
specifies whether the interrupt is rising (PIN_INT_MODE::RISING
) or falling (PIN_INT_MODE::FALLING
).
The third debounce
takes the values 0, 1, 2, or 3. 1, 2, or 3 settings require the same consecutive value to detect a change in value to reduce the effect of noise.
Discontinue detection.
If the specified count (refct
in begin()
) is 0, true
is returned when the count exceeds 1.
If the specified count (refct
in begin()
) is 1 or more, true
is returned when the number of detections exceeds the specified count.
Reads the count value. Resets the count value to 0 after reading.
setting | number of consecutive samples | maximum detection frequency |
---|---|---|
0
-
100Khz
1
2
3.7Khz
2
4
2.2Khz
3
8
1.2Khz
EEPROM
TWELITE Reads and writes to the built-in EEPROM of the wireless microcontroller.
The built-in EEPROM has 3480 bytes available from address 0x000 to 0xEFF.
The first part is Settings (Interactive settings mode), so it is recommended to use the second half of the address when used together. The amount of space consumed by the settings (Interactive settings mode) depends on its implementation. Even with minimal settings, up to 256 bytes are used from the beginning, so use of the later addresses is recommended.
Read the data corresponding to address
from EEPROM.
No error detection.
Write value
from EEPROM to address
.
No error detection.
This function is used when you want to reduce the number of rewrites in consideration of the rewrite life of EEPROM.
Obtain a helper object to read and write using mwx::stream
described below.
stream_helper helper object mwx::stream
operators and methods. Using mwx::stream
, you can read and write integer types such as uint16_t
and uint32_t
types, read and write fixed-length array types such as uint8_t
, and format them using format()
objects.
Interfaces defined in mwx::stream
, such as the <<
operator, can be used on this object.
.seek()
is used to move the EEPROM address to 1024.
The above writes an 8-byte string (00bc614e
), a 4-byte integer (0x12ab34cd
), a 16-byte byte string (HELLO WORLD!....
), and a 1-byte terminating character.
Move the EEPROM address to 1024 using .seek()
.
Reads the data sequence written out earlier. In order, 8-byte characters, 4-byte integers, and 16-byte strings are read out using the >>
operator.
format input parser for serial input (mwx::serial_parser)
This built-in class is defined as a built-in object, intended to be used for format input via serial port.
It is defined as a mwx::serial_parser<mwx::alloc_heap<uint8_t>>
type that allocates buffer space for internal use from the heap at initialization (begin()
).
For details, see class for details.