Skyward boardcore
Loading...
Searching...
No Matches
miosix::I2C1Driver Class Reference

#include <stm32f2_f4_i2c.h>

Public Member Functions

void init ()
 
bool send (unsigned char address, const void *data, int len, bool sendStop=true)
 
bool recv (unsigned char address, void *data, int len)
 

Static Public Member Functions

static I2C1Driverinstance ()
 

Detailed Description

Driver for the I2C1 peripheral in STM32F2 and STM32F4 under Miosix

Definition at line 35 of file stm32f2_f4_i2c.h.

Member Function Documentation

◆ init()

void miosix::I2C1Driver::init ( )

Initializes the peripheral. The only supported mode is 100KHz, master, 7bit address. Note that there is no need to manually call this member function as the constructor already inizializes the I2C peripheral. The only use of this member function is to reinitialize the peripheral if the microcontroller clock frequency or the APB prescaler is changed.

Definition at line 201 of file stm32f2_f4_i2c.cpp.

◆ instance()

I2C1Driver & miosix::I2C1Driver::instance ( )
static
Returns
an instance of this class (singleton)

Definition at line 195 of file stm32f2_f4_i2c.cpp.

◆ recv()

bool miosix::I2C1Driver::recv ( unsigned char address,
void * data,
int len )

Receive data from a device connected to the I2C bus

Parameters
addressdevice address (bit 0 is forced at 1)
datapointer to a buffer where data will be received
lenlength of data to receive
Returns
true on success, false on failure

Definition at line 359 of file stm32f2_f4_i2c.cpp.

◆ send()

bool miosix::I2C1Driver::send ( unsigned char address,
const void * data,
int len,
bool sendStop = true )

Send data to a device connected to the I2C bus

Parameters
addressdevice address (bit 0 is forced at 0)
datapointer with data to send
lenlength of data to send
sendStopif set to false disables the sending of a stop condition after data transmission has finished
Returns
true on success, false on failure

Definition at line 254 of file stm32f2_f4_i2c.cpp.


The documentation for this class was generated from the following files: