![]() |
CHGame 0.3.0
Libraries for the CHGame handheld
|
The Arduino Wire API: I2C master (and slave) on I2C1. More...
Classes | |
| class | TwoWire |
| An I2C bus: the Arduino Wire API on one of the chip's I2C peripherals (the global Wire on this board). More... | |
Macros | |
| #define | BUFFER_LENGTH 32 |
| The smallest size of the receive and transmit buffers, in bytes (they grow on the heap when a transfer needs more). | |
| #define | WIRE_MAX_TX_BUFF_LENGTH 1024U |
| The most bytes one transmission (beginTransmission() ... endTransmission()) can hold; write() returns 0 past it. | |
| #define | WIRE_HAS_END 1 |
| Defined to 1: this Wire has end(). | |
Variables | |
| TwoWire | Wire |
| The I2C bus: I2C1 on PC18 (SDA, header H1.2) and PC19 (SCL, H1.1). | |
The Arduino Wire API: I2C master (and slave) on I2C1.
On the CHGame board (rev0) the global Wire uses SDA = PC18 (PIN_WIRE_SDA) and SCL = PC19 (PIN_WIRE_SCL), which come out on the expansion header H1: SDA on H1.2, SCL on H1.1. The board has no pull-up resistors on them, so the device or the wiring must provide them. (They are also the chip's two-wire debug pins, DIO and DCK.) The stock CH32X035 defaults, PC17 and PC16, are the board's USB D+ and D-: never pass them to begin(sda, scl) or setSDA() / setSCL().
Transfers are polled (slave mode uses the I2C interrupt) and each step gives up after about 3 ms (I2C_TIMEOUT_TICK). The transmit and receive buffers live on the heap: they start at BUFFER_LENGTH bytes, grow as needed, and a transmission holds at most WIRE_MAX_TX_BUFF_LENGTH bytes.
| #define BUFFER_LENGTH 32 |
The smallest size of the receive and transmit buffers, in bytes (they grow on the heap when a transfer needs more).
| #define WIRE_MAX_TX_BUFF_LENGTH 1024U |
The most bytes one transmission (beginTransmission() ... endTransmission()) can hold; write() returns 0 past it.
Default 1024.
| #define WIRE_HAS_END 1 |
Defined to 1: this Wire has end().
|
extern |
The I2C bus: I2C1 on PC18 (SDA, header H1.2) and PC19 (SCL, H1.1).