STM32F0xx Standard Peripherals Firmware Library: I2C_EEPROM

STM32F0xx Standard Peripherals Library

STM32F0xx Standard Peripherals Firmware Library

Defines

#define BUFFER_SIZE1   (countof(Tx1Buffer)-1)
#define BUFFER_SIZE2   (countof(Tx2Buffer)-1)
#define countof(a)   (sizeof(a) / sizeof(*(a)))
#define ENABLE_LCD_MSG_DISPLAY
#define sEE_READ_ADDRESS1   0x50
#define sEE_READ_ADDRESS2   (sEE_READ_ADDRESS1 + BUFFER_SIZE1)
#define sEE_WRITE_ADDRESS1   0x50
#define sEE_WRITE_ADDRESS2   (sEE_WRITE_ADDRESS1 + BUFFER_SIZE1)

Enumerations

enum  TestStatus {
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 1, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED
}

Functions

static TestStatus Buffercmp (uint8_t *pBuffer1, uint8_t *pBuffer2, uint16_t BufferLength)
 Compares two buffers.
void HardFault_Handler (void)
 This function handles Hard Fault exception.
int main (void)
 Main program.
void NMI_Handler (void)
 This function handles NMI exception.
void PendSV_Handler (void)
 This function handles PendSVC exception.
uint32_t sEE_TIMEOUT_UserCallback (void)
 Example of timeout situation management.
void SVC_Handler (void)
 This function handles SVCall exception.
void SysTick_Handler (void)
 This function handles SysTick Handler.

Variables

volatile uint16_t NumDataRead = 0
uint8_t Rx1Buffer [BUFFER_SIZE1]
uint8_t Rx2Buffer [BUFFER_SIZE2]
volatile TestStatus TransferStatus1 = FAILED
volatile TestStatus TransferStatus2 = FAILED
uint8_t Tx1Buffer []
uint8_t Tx2Buffer []

Define Documentation

#define BUFFER_SIZE1   (countof(Tx1Buffer)-1)

Definition at line 49 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.

Referenced by main().

#define BUFFER_SIZE2   (countof(Tx2Buffer)-1)

Definition at line 50 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.

Referenced by main().

#define countof (   a)    (sizeof(a) / sizeof(*(a)))
#define ENABLE_LCD_MSG_DISPLAY
#define sEE_READ_ADDRESS1   0x50

Definition at line 48 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.

Referenced by main().

#define sEE_READ_ADDRESS2   (sEE_READ_ADDRESS1 + BUFFER_SIZE1)

Definition at line 52 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.

Referenced by main().

#define sEE_WRITE_ADDRESS1   0x50

Definition at line 47 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.

Referenced by main().

#define sEE_WRITE_ADDRESS2   (sEE_WRITE_ADDRESS1 + BUFFER_SIZE1)

Definition at line 51 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.

Referenced by main().


Enumeration Type Documentation

enum TestStatus
Enumerator:
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 

Definition at line 41 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.


Function Documentation

static TestStatus Buffercmp ( uint8_t *  pBuffer1,
uint8_t *  pBuffer2,
uint16_t  BufferLength 
) [static]

Compares two buffers.

Parameters:
pBuffer1,pBuffer2,:buffers to be compared.
BufferLength,:buffer's length
Return values:
PASSED,:pBuffer1 identical to pBuffer2 FAILED: pBuffer1 differs from pBuffer2

Definition at line 220 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.

References FAILED, and PASSED.

Referenced by main().

void HardFault_Handler ( void  )

This function handles Hard Fault exception.

Parameters:
None
Return values:
None

Definition at line 66 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/stm32f0xx_it.c.

int main ( void  )

Main program.

Parameters:
None
Return values:
None

< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32f0xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f0xx.c file

Definition at line 80 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.

References BUFFER_SIZE1, BUFFER_SIZE2, Buffercmp(), NumDataRead, PASSED, Rx1Buffer, Rx2Buffer, sEE_READ_ADDRESS1, sEE_READ_ADDRESS2, sEE_WRITE_ADDRESS1, sEE_WRITE_ADDRESS2, TransferStatus1, TransferStatus2, Tx1Buffer, and Tx2Buffer.

void NMI_Handler ( void  )

This function handles NMI exception.

Parameters:
None
Return values:
None

Definition at line 57 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/stm32f0xx_it.c.

void PendSV_Handler ( void  )

This function handles PendSVC exception.

Parameters:
None
Return values:
None

Definition at line 88 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/stm32f0xx_it.c.

uint32_t sEE_TIMEOUT_UserCallback ( void  )

Example of timeout situation management.

Parameters:
None.
Return values:
None.

Definition at line 189 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.

void SVC_Handler ( void  )

This function handles SVCall exception.

Parameters:
None
Return values:
None

Definition at line 79 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/stm32f0xx_it.c.

void SysTick_Handler ( void  )

This function handles SysTick Handler.

Parameters:
None
Return values:
None

Definition at line 97 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/stm32f0xx_it.c.


Variable Documentation

volatile uint16_t NumDataRead = 0

Definition at line 69 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.

Referenced by main().

uint8_t Rx1Buffer[BUFFER_SIZE1]

Definition at line 67 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.

Referenced by main().

uint8_t Rx2Buffer[BUFFER_SIZE2]

Definition at line 67 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.

Referenced by main().

uint8_t Tx1Buffer[]
Initial value:
"/* STM32F0xx I2C Firmware Library EEPROM driver example: \
                        This firmware provides a basic example of how to use the I2C firmware library and\
                        an associate I2C EEPROM driver to communicate with an I2C EEPROM device \
                        I2C peripheral is configured in Master transmitter during write operation and in\
                        Master receiver during read operation from I2C EEPROM.*/"

Definition at line 58 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.

Referenced by main().

uint8_t Tx2Buffer[]
Initial value:
"/* STM32F0xx I2C Firmware Library EEPROM driver example : \
                        I2C1 interfacing with M24LR64 EEPROM */"

Definition at line 64 of file STM32F0xx_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.

Referenced by main().

STM32L1xx Standard Peripherals Library: Footer

 

 

 For complete documentation on STM32 Microcontrollers visit www.st.com/STM32