pw_i2c_mcuxpresso#
Pigweed AI summary: The "pw_i2c_mcuxpresso" module implements the "pw_i2c" interface using the NXP MCUXpresso SDK. The implementation is based on the i2c driver in the SDK, and I2C transfers use non-blocking driver API. To set up this module, you need to use "pw_build_mcuxpresso" to create a "pw_source_set" for an MCUXpresso SDK, include the i2c driver component in the SDK definition, specify the
pw_i2c_mcuxpresso
implements the pw_i2c
interface using the
NXP MCUXpresso SDK.
The implementation is based on the i2c driver in SDK. I2C transfers use non-blocking driver API.
Setup#
Pigweed AI summary: This module requires specific setup steps, including creating a pw_source_set for an MCUXpresso SDK using pw_build_mcuxpresso, including the i2c driver component, specifying the pw_third_party_mcuxpresso_SDK GN global variable, and using the pw::i2c::McuxpressoInitiator implementation of pw::i2c::Initiator when creating interfaces to access I2C devices on the target.
This module requires following setup:
Use
pw_build_mcuxpresso
to create apw_source_set
for an MCUXpresso SDK.Include the i2c driver component in this SDK definition.
Specify the
pw_third_party_mcuxpresso_SDK
GN global variable to specify the name of this source set.Use
pw::i2c::McuxpressoInitiator
implementation ofpw::i2c::Initiator
while creatingpw::i2c::Device
orpw::i2c::RegisterDevice
interface to access the I2C devices connected to target.
Usage#
Pigweed AI summary: The given code snippet is written in C++ and it defines a constant variable `kI2CBaudRate` with a value of 100000. It also declares a struct variable `kConfig` of type `McuxpressoInitiator::Config` with some initial values. The `flexcomm_address` field is set to `I2C11_BASE`, the `clock_name` field is set to `kCLOCK_Flexcomm11Clk`, and the `baud_rate
constexpr uint32_t kI2CBaudRate = 100000;
constexpr McuxpressoInitiator::Config kConfig = {
.flexcomm_address = I2C11_BASE,
.clock_name = kCLOCK_Flexcomm11Clk,
.baud_rate_bps = kI2CBaudRate,
};
McuxpressoInitiator initiator{kConfig};
initiator.Enable();