Arduino ATmega (w/ Arduino-CMake-Toolchain) driver.
More...
This driver is known to work with the following MCUs:
- ATmega328P (Arduino Uno)
- ATmega2560 (Arduino Mega)
- Usage
- Link the
pbdrv-mod
library with your main executable
- Note
- This driver is automatically enabled if the variable
ARDUINO
is defined in your CMakeLists.txt (it is by default when using Arduino-CMake-Toolchain).
-
This driver automatically includes the FreeRTOS extension for deferring calls to
pb_i2c_recv()
from the I²C ISR.
A complete example for this driver is available in the puzzle/dummy folder.
|
__weak void | pb_i2c_send (i2c_addr_t i2c_addr, const uint8_t *buf, size_t sz) |
| Send a message in master-mode on the I²C bus (puzzle bus)
|
|
int | main (void) |
| Application entrypoint.
|
|
◆ main()
This function overrides the default (weak) implementation of the main()
function in the Arduino framework. No additional setup is required to use this driver.
- Note
- I should really be able to use Arduino's initVariant function for this, but I can't seem to get it to link properly using the CMake setup in this repository. Overriding the main() function seems to work, and the USBCON thing in the default Arduino main() function isn't needed because puzzle modules are likely not using USB.
◆ pb_i2c_send()
__weak void pb_i2c_send |
( |
i2c_addr_t | i2c_addr, |
|
|
const uint8_t * | buf, |
|
|
size_t | sz ) |
- Warning
- In the Arduino driver, this function includes a hard-coded 10ms delay before sending. This is to work around a weird issue where the Arduino pulls both SDA and SCL low while attempting to initiate an I²C transmission. We were able to verify that the Arduino correctly handles bus arbitration under a test scenario with 2 Uno's, but ran into issues while integrating the Arduino's with the RP2040.