Reads and writes two-wire serial (I2C) master.
The mwx::periph_wire<MWX_TWOWIRE_RCVBUFF> can be referred as TwoWire.
The following definition types describe the types of arguments and return values.
Some APIs make calls where the STOP bit is not strictly handled.
write(), writer::operator() () has several arguments defined in addition to the ones described here.
uint8_t cmds[]={11,12};...Wire.write(cmds);initializer_list<> 型Wire.write({11,12})Instance creation and necessary initialization is done in the library. In user code, it is made available by calling Wire.begin().
When using the requestFrom() method, you can specify the size of the FIFO queue for temporary data storage. At compile time, compile the macro MWX_TWOWIRE_BUFF with the required number of bytes. The default is 32 bytes.
Example:
-DMWX_TWOWIRE_BUFF=16
Initialize hardware.
Performing any Wire operation without initialization will cause the TWELITE radio module to hang.
When waking from sleep, if the module was operating just before sleep, it will return to the previous state.
| Parameters | Description |
|---|---|
u8mode |
Specifies the bus frequency. Default is 100Khz (WIRE_CONF::WIRE_100KHZ)The frequency is specified by WIRE_CONF::WIRE_? KHZ and ? KHZ can be 50,66,80,100,133,160,200,266,320,400. |
b_portalt |
Change hardware pin assignments. |
There are two types of read/write procedures. Select and use one of them.
requestFrom(), beginTransmission(), endTransmission(), write()reader, writerChecks if the device specified by address is responding. If the device exists, true is returned.
The procedure is originally intended to change the bus frequency, but no action is taken.