STM8S/A Standard Peripherals Firmware Library
|
This file provides a set of functions needed to manage the I2C M24CXX EEPROM memory mounted on STM8Sxx-EVAL board (refer to stm8s_eval.h to know about the boards supporting this memory). More...
#include "stm8s_eval_i2c_ee.h"
Go to the source code of this file.
Functions | |
void | sEE_DeInit (void) |
DeInitializes peripherals used by the I2C EEPROM driver. | |
void | sEE_EnterCriticalSection_UserCallback (void) |
Start critical section: this callbacks should be typically used to disable interrupts when entering a critical section of I2C communication You may use default callbacks provided into this driver by uncommenting the define USE_DEFAULT_CRITICAL_CALLBACK. | |
void | sEE_ExitCriticalSection_UserCallback (void) |
End of critical section: this callbacks should be typically used to re-enable interrupts when exiting a critical section of I2C communication You may use default callbacks provided into this driver by uncommenting the define USE_DEFAULT_CRITICAL_CALLBACK. | |
void | sEE_Init (void) |
Initializes peripherals used by the I2C EEPROM driver. | |
uint32_t | sEE_ReadBuffer (uint8_t *pBuffer, uint16_t ReadAddr, uint16_t *NumByteToRead) |
Reads a block of data from the EEPROM. | |
uint32_t | sEE_WaitEepromStandbyState (void) |
Wait for EEPROM Standby state. | |
void | sEE_WriteBuffer (uint8_t *pBuffer, uint16_t WriteAddr, uint16_t NumByteToWrite) |
Writes buffer of data to the I2C EEPROM. | |
uint32_t | sEE_WritePage (uint8_t *pBuffer, uint16_t WriteAddr, uint8_t *NumByteToWrite) |
Writes more than one byte to the EEPROM. | |
Variables | |
__IO uint16_t | sEEAddress = 0 |
__IO uint8_t | sEEDataNum |
__IO uint8_t * | sEEDataWritePointer |
__IO uint32_t | sEETimeout = sEE_LONG_TIMEOUT |
Detailed Description
This file provides a set of functions needed to manage the I2C M24CXX EEPROM memory mounted on STM8Sxx-EVAL board (refer to stm8s_eval.h to know about the boards supporting this memory).
- Author:
- MCD Application Team
- Version:
- V1.0.1
- Date:
- 30-September-2014 =================================================================== Note: This driver is intended for STM8S families devices only. ===================================================================
It implements a high level communication layer for read and write from/to this memory. The needed STM8S hardware resources (I2C and GPIO) are defined in stm8s_eval.h file, and the initialization is performed in sEE_LowLevel_Init() function declared in stm8s_eval.c file. You can easily tailor this driver to any other development board, by just adapting the defines for hardware resources and sEE_LowLevel_Init() function.
- Note:
- In this driver, basic read and write functions (sEE_ReadBuffer() and sEE_WritePage()) use the I2C in polling mode to perform the data transfer to/from EEPROM memory Safe procedure is implemented to handle the read operation, ensuring safe data reception in case of 1, 2, 3 or more bytes The application should then monitor the variable holding the number of data in order to determine when the transfer is completed (variable decremented to 0). For more details on the use of this driver you can refer to the I2C_EEPROM example provided within the STM8SS_StdPeriph_Lib package.
+-----------------------------------------------------------------+ | Pin assignment | +---------------------------------------+-----------+-------------+ | STM8S I2C Pins | sEE | Pin | +---------------------------------------+-----------+-------------+ | . | E0(GND) | 1 (0V) | | . | E1(GND) | 2 (0V) | | . | E2(GND) | 3 (0V) | | . | E0(VSS) | 4 (0V) | | sEE_I2C_SDA_PIN/ SDA | SDA | 5 | | sEE_I2C_SCL_PIN/ SCL | SCL | 6 | | . | /WC(VDD)| 7 (3.3V) | | . | VDD | 8 (3.3V) | +---------------------------------------+-----------+-------------+
Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at:
http://www.st.com/software_license_agreement_liberty_v2
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file stm8s_eval_i2c_ee.c.