I2C_EEPROM
[STM32F10x_StdPeriph_Examples]

Defines

#define BUFFER_SIZE1   (countof(Tx1_Buffer)-1)
#define BUFFER_SIZE2   (countof(Tx2_Buffer)-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 = 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 = 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 = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED
}

Functions

TestStatus Buffercmp (uint8_t *pBuffer1, uint8_t *pBuffer2, uint16_t BufferLength)
 Compares two buffers.
void BusFault_Handler (void)
 This function handles Bus Fault exception.
void DebugMon_Handler (void)
 This function handles Debug Monitor exception.
void HardFault_Handler (void)
 This function handles Hard Fault exception.
int main (void)
 Main program.
void MemManage_Handler (void)
 This function handles Memory Manage exception.
void NMI_Handler (void)
 This function handles NMI exception.
void PendSV_Handler (void)
 This function handles PendSV_Handler 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.
void UsageFault_Handler (void)
 This function handles Usage Fault exception.

Variables

volatile uint16_t NumDataRead = 0
uint8_t Rx1_Buffer [BUFFER_SIZE1]
uint8_t Rx2_Buffer [BUFFER_SIZE2]
volatile TestStatus TransferStatus1 = FAILED
volatile TestStatus TransferStatus2 = FAILED
uint8_t Tx1_Buffer []
uint8_t Tx2_Buffer []

Define Documentation

#define BUFFER_SIZE1   (countof(Tx1_Buffer)-1)

Definition at line 54 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/main.c.

Referenced by main().

#define BUFFER_SIZE2   (countof(Tx2_Buffer)-1)

Definition at line 55 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/main.c.

Referenced by main().

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

Definition at line 53 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/main.c.

Referenced by main().

#define sEE_READ_ADDRESS2   (sEE_READ_ADDRESS1 + BUFFER_SIZE1)

Definition at line 57 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/main.c.

Referenced by main().

#define sEE_WRITE_ADDRESS1   0x50

Definition at line 52 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/main.c.

Referenced by main().

#define sEE_WRITE_ADDRESS2   (sEE_WRITE_ADDRESS1 + BUFFER_SIZE1)

Definition at line 56 of file STM32F10x_StdPeriph_Examples/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 
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 46 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/main.c.


Function Documentation

TestStatus Buffercmp ( uint8_t *  pBuffer1,
uint8_t *  pBuffer2,
uint16_t  BufferLength 
)

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 297 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/main.c.

References FAILED, and PASSED.

void BusFault_Handler ( void   ) 

This function handles Bus Fault exception.

Parameters:
None 
Return values:
None 

Definition at line 85 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/stm32f10x_it.c.

void DebugMon_Handler ( void   ) 

This function handles Debug Monitor exception.

Parameters:
None 
Return values:
None 

Definition at line 120 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/stm32f10x_it.c.

void HardFault_Handler ( void   ) 

This function handles Hard Fault exception.

Parameters:
None 
Return values:
None 

Definition at line 59 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/stm32f10x_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_stm32f10x_xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f10x.c file

Definition at line 115 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/main.c.

References BUFFER_SIZE1, BUFFER_SIZE2, Buffercmp(), LCD_Clear(), LCD_COLOR_BLUE, LCD_COLOR_WHITE, LCD_DisplayStringLine(), LCD_LINE_0, LCD_LINE_1, LCD_LINE_3, LCD_LINE_5, LCD_LINE_7, LCD_SetBackColor(), LCD_SetTextColor(), NumDataRead, PASSED, Rx1_Buffer, Rx2_Buffer, sEE_DeInit(), sEE_Init(), sEE_READ_ADDRESS1, sEE_READ_ADDRESS2, sEE_ReadBuffer(), sEE_WRITE_ADDRESS1, sEE_WRITE_ADDRESS2, sEE_WriteBuffer(), STM32100B_LCD_Init(), STM32100E_LCD_Init(), STM3210B_LCD_Init(), STM3210C_LCD_Init(), STM3210E_LCD_Init(), TransferStatus1, TransferStatus2, Tx1_Buffer, and Tx2_Buffer.

void MemManage_Handler ( void   ) 

This function handles Memory Manage exception.

Parameters:
None 
Return values:
None 

Definition at line 72 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/stm32f10x_it.c.

void NMI_Handler ( void   ) 

This function handles NMI exception.

Parameters:
None 
Return values:
None 

Definition at line 50 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/stm32f10x_it.c.

void PendSV_Handler ( void   ) 

This function handles PendSV_Handler exception.

Parameters:
None 
Return values:
None 

Definition at line 129 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/stm32f10x_it.c.

uint32_t sEE_TIMEOUT_UserCallback ( void   ) 

Example of timeout situation management.

Parameters:
None. 
Return values:
None. 

Definition at line 266 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/main.c.

References LCD_Clear(), LCD_COLOR_RED, LCD_DisplayStringLine(), LCD_LINE_4, LCD_LINE_5, and LCD_LINE_6.

Referenced by sEE_I2C_DMA_TX_IRQHandler(), sEE_ReadBuffer(), sEE_WaitEepromStandbyState(), sEE_WriteBuffer(), and sEE_WritePage().

void SVC_Handler ( void   ) 

This function handles SVCall exception.

Parameters:
None 
Return values:
None 

Definition at line 111 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/stm32f10x_it.c.

void SysTick_Handler ( void   ) 

This function handles SysTick Handler.

Parameters:
None 
Return values:
None 

Definition at line 138 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/stm32f10x_it.c.

void UsageFault_Handler ( void   ) 

This function handles Usage Fault exception.

Parameters:
None 
Return values:
None 

Definition at line 98 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/stm32f10x_it.c.


Variable Documentation

volatile uint16_t NumDataRead = 0

Definition at line 105 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/main.c.

Referenced by main().

uint8_t Rx1_Buffer[BUFFER_SIZE1]

Definition at line 103 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/main.c.

Referenced by main().

uint8_t Rx2_Buffer[BUFFER_SIZE2]

Definition at line 103 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/main.c.

Referenced by main().

volatile TestStatus TransferStatus1 = FAILED
volatile TestStatus TransferStatus2 = FAILED
uint8_t Tx1_Buffer[]

Definition at line 63 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/main.c.

Referenced by main().

uint8_t Tx2_Buffer[]
Initial value:
 "/* STM32F10xx I2C Firmware Library EEPROM driver example: \
                        buffer 2 transfer into address sEE_WRITE_ADDRESS2 */"

Definition at line 101 of file STM32F10x_StdPeriph_Examples/I2C/EEPROM/main.c.

Referenced by main().

STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32