STM32F0 CPAL I2C bibliotheek
1.0
ST Microelectronics CPALv2 bibliotheek documentatie
|
This file contains all the functions prototypes for the I2C firmware layer. More...
Go to the source code of this file.
Data Structures | |
struct | CPAL_TransferTypeDef |
struct | CPAL_InitTypeDef |
Macros | |
#define | __STM32F0XX_I2C_CPAL_H |
#define | CPAL_OPT_I2C_DUALADDR ((uint32_t)0x00000001) |
#define | CPAL_OPT_DMATX_TCIT ((uint32_t)0x00000100) |
#define | CPAL_OPT_DMATX_HTIT ((uint32_t)0x00000200) |
#define | CPAL_OPT_DMATX_TEIT ((uint32_t)0x00000400) |
#define | CPAL_OPT_DMARX_TCIT ((uint32_t)0x00000800) |
#define | CPAL_OPT_DMARX_HTIT ((uint32_t)0x00001000) |
#define | CPAL_OPT_DMARX_TEIT ((uint32_t)0x00002000) |
#define | CPAL_OPT_DMATX_CIRCULAR ((uint32_t)0x00004000) |
#define | CPAL_OPT_DMARX_CIRCULAR ((uint32_t)0x00008000) |
#define | CPAL_OPT_NO_MEM_ADDR ((uint32_t)0x00010000) |
#define | CPAL_OPT_16BIT_REG ((uint32_t)0x00020000) |
#define | CPAL_OPT_I2C_GENCALL ((uint32_t)0x00100000) |
#define | CPAL_OPT_I2C_AUTOMATIC_END ((uint32_t)0x00200000) |
#define | CPAL_OPT_I2C_ERRIT_DISABLE ((uint32_t)0x00400000) |
#define | CPAL_OPT_I2C_NOSTOP ((uint32_t)0x00800000) |
#define | CPAL_OPT_I2C_NOSTOP_MODE ((uint32_t)0x01000000) |
#define | CPAL_OPT_I2C_OA2_MASK ((uint32_t)0x0E000000) |
#define | CPAL_OPT_I2C_10BIT_HEADR ((uint32_t)0x10000000) |
#define | CPAL_OPT_I2C_WAKEUP_STOP ((uint32_t)0x20000000) |
#define | CPAL_OPT_I2C_NACK_ADD ((uint32_t)0x40000000) |
#define | CPAL_PASS ((uint32_t)0x00000000) |
#define | CPAL_FAIL ((uint32_t)0x00000001) |
#define | pNULL (void*)0 |
Enumerations | |
enum | CPAL_DevTypeDef { CPAL_I2C1 = 0x00, CPAL_I2C2 = 0x01 } |
enum | CPAL_DirectionTypeDef { CPAL_DIRECTION_TX = 0x01, CPAL_DIRECTION_RX = 0x02, CPAL_DIRECTION_TXRX = 0x03 } |
enum | CPAL_ModeTypeDef { CPAL_MODE_MASTER = 0x00, CPAL_MODE_SLAVE = 0x01 } |
enum | CPAL_ProgModelTypeDef { CPAL_PROGMODEL_INTERRUPT = 0x01, CPAL_PROGMODEL_DMA = 0x02 } |
enum | CPAL_StateTypeDef { CPAL_STATE_DISABLED = 0x00, CPAL_STATE_READY = 0x01, CPAL_STATE_READY_TX = 0x03, CPAL_STATE_READY_RX = 0x05, CPAL_STATE_BUSY = 0x02, CPAL_STATE_BUSY_TX = 0x06, CPAL_STATE_BUSY_RX = 0x0A, CPAL_STATE_ERROR = 0x10 } |
enum | CPAL_I2CErrorTypeDef { CPAL_I2C_ERR_NONE = 0x00000000, CPAL_I2C_ERR_TIMEOUT = 0x000000FF, CPAL_I2C_ERR_BERR = 0x00000100, CPAL_I2C_ERR_ARLO = 0x00000200, CPAL_I2C_ERR_AF = 0x00000010, CPAL_I2C_ERR_OVR = 0x00000400 } |
Functions | |
uint32_t | CPAL_I2C_Init (CPAL_InitTypeDef *pDevInitStruct) |
Initialize the peripheral and all related clocks, GPIOs, DMA and Interrupts according to the specified parameters in the CPAL_InitTypeDef structure. More... | |
uint32_t | CPAL_I2C_DeInit (CPAL_InitTypeDef *pDevInitStruct) |
Deinitialize the peripheral and all related clocks, GPIOs, DMA and NVIC to their reset values. More... | |
uint32_t | CPAL_I2C_StructInit (CPAL_InitTypeDef *pDevInitStruct) |
Initialize the peripheral structure with default values according to the specified parameters in the CPAL_I2CDevTypeDef structure. More... | |
uint32_t | CPAL_I2C_Write (CPAL_InitTypeDef *pDevInitStruct) |
Allows to send a data or a buffer of data through the peripheral to a selected device in a selected location address. More... | |
uint32_t | CPAL_I2C_Read (CPAL_InitTypeDef *pDevInitStruct) |
Allows to receive a data or a buffer of data through the peripheral from a selected device in a selected location address. More... | |
uint32_t | CPAL_I2C_IsDeviceReady (CPAL_InitTypeDef *pDevInitStruct) |
Wait until target device is ready for communication (This function is used with Memory devices). More... | |
uint32_t | CPAL_I2C_EV_IRQHandler (CPAL_InitTypeDef *pDevInitStruct) |
This function handles I2C interrupt request for preparing communication and for transfer phase in case of using Interrupt Programming Model. More... | |
uint32_t | CPAL_I2C_ER_IRQHandler (CPAL_InitTypeDef *pDevInitStruct) |
Allows to handle errors occurred during initialization or communication in order to recover the correct communication status or call specific user functions. More... | |
uint32_t | CPAL_TIMEOUT_UserCallback (CPAL_InitTypeDef *pDevInitStruct) |
void | CPAL_I2C_TX_UserCallback (CPAL_InitTypeDef *pDevInitStruct) |
void | CPAL_I2C_RX_UserCallback (CPAL_InitTypeDef *pDevInitStruct) |
void | CPAL_I2C_TXTC_UserCallback (CPAL_InitTypeDef *pDevInitStruct) |
void | CPAL_I2C_RXTC_UserCallback (CPAL_InitTypeDef *pDevInitStruct) |
void | CPAL_I2C_DMATXTC_UserCallback (CPAL_InitTypeDef *pDevInitStruct) |
void | CPAL_I2C_DMATXHT_UserCallback (CPAL_InitTypeDef *pDevInitStruct) |
void | CPAL_I2C_DMATXTE_UserCallback (CPAL_InitTypeDef *pDevInitStruct) |
void | CPAL_I2C_DMARXTC_UserCallback (CPAL_InitTypeDef *pDevInitStruct) |
void | CPAL_I2C_DMARXHT_UserCallback (CPAL_InitTypeDef *pDevInitStruct) |
void | CPAL_I2C_DMARXTE_UserCallback (CPAL_InitTypeDef *pDevInitStruct) |
void | CPAL_I2C_GENCALL_UserCallback (CPAL_InitTypeDef *pDevInitStruct) |
void | CPAL_I2C_DUALF_UserCallback (CPAL_InitTypeDef *pDevInitStruct) |
Variables | |
CPAL_InitTypeDef * | I2C_DevStructures [] |
This file contains all the functions prototypes for the I2C firmware layer.
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.
#define CPAL_FAIL ((uint32_t)0x00000001) |
This value is returned if the last operation failed
#define CPAL_OPT_16BIT_REG ((uint32_t)0x00020000) |
Enable 16-Bit Register/Physical addressing mode (two bytes, MSB first). This option is supported only when CPAL_OPT_NO_MEM_ADDR option is not set
#define CPAL_OPT_DMARX_CIRCULAR ((uint32_t)0x00008000) |
Enable the Circular Mode for DMA Receiver
#define CPAL_OPT_DMARX_HTIT ((uint32_t)0x00001000) |
Enable the Receiver DMA Half Transfer Complete interrupt
#define CPAL_OPT_DMARX_TCIT ((uint32_t)0x00000800) |
Enable the Receiver DMA Transfer Complete interrupt
#define CPAL_OPT_DMARX_TEIT ((uint32_t)0x00002000) |
Enable the Receiver DMA Half Transfer Error interrupt
#define CPAL_OPT_DMATX_CIRCULAR ((uint32_t)0x00004000) |
Enable the Circular Mode for DMA Transmitter
#define CPAL_OPT_DMATX_HTIT ((uint32_t)0x00000200) |
Enable the Transmitter DMA Half Transfer Complete interrupt
#define CPAL_OPT_DMATX_TCIT ((uint32_t)0x00000100) |
Enable the Transmitter DMA Transfer Complete interrupt
#define CPAL_OPT_DMATX_TEIT ((uint32_t)0x00000400) |
Enable the Transmitter DMA Transfer Error interrupt
#define CPAL_OPT_I2C_10BIT_HEADR ((uint32_t)0x10000000) |
Enable the send of slave address-10bit-header only when switching from master transmitter to master receiver mode with No stop generation option enabled
#define CPAL_OPT_I2C_AUTOMATIC_END ((uint32_t)0x00200000) |
Enable Automatic end mode for master
#define CPAL_OPT_I2C_DUALADDR ((uint32_t)0x00000001) |
Use Dual Address Mode (available in Slave Mode only). To use this option enable it by affecting this define and own address2 to wCPAL_Options
#define CPAL_OPT_I2C_ERRIT_DISABLE ((uint32_t)0x00400000) |
Disable I2C Errors interrupt (Bus Error, Arbitration Loss, Acknowledge Failure and Overrun/Underrun Errors). By default, errors interrupt is enabled to manage errors efficiently
#define CPAL_OPT_I2C_GENCALL ((uint32_t)0x00100000) |
Use General Call Address Mode (available in Slave Mode only) (General Call Address = 0x00)
#define CPAL_OPT_I2C_NACK_ADD ((uint32_t)0x40000000) |
Initialize the I2C Slave device without enabling the acknowledgement of its own address. This option must not be used with No Stop generation mode
#define CPAL_OPT_I2C_NOSTOP ((uint32_t)0x00800000) |
Use communication mode with no STOP generation at the end of data transfer (for multi-read/write operations)
#define CPAL_OPT_I2C_NOSTOP_MODE ((uint32_t)0x01000000) |
Start communication in No STOP generation mode and close communication by Generating stop
#define CPAL_OPT_I2C_OA2_MASK ((uint32_t)0x0E000000) |
Contain Own Address 2 Mask (OA2MSK is coded on 3 bit)
#define CPAL_OPT_I2C_WAKEUP_STOP ((uint32_t)0x20000000) |
Enable the WakeUp from stop capability for the I2C slave device
#define CPAL_OPT_NO_MEM_ADDR ((uint32_t)0x00010000) |
Enable No Memory addressing mode: only slave device address sent No Register/Physical address to be sent after slave address
#define CPAL_PASS ((uint32_t)0x00000000) |
This value is returned if the last operation succeed
#define pNULL (void*)0 |
This Value is used to initialise a null pointer
enum CPAL_DevTypeDef |
enum CPAL_I2CErrorTypeDef |
enum CPAL_ModeTypeDef |
enum CPAL_StateTypeDef |
uint32_t CPAL_I2C_DeInit | ( | CPAL_InitTypeDef * | pDevInitStruct | ) |
Deinitialize the peripheral and all related clocks, GPIOs, DMA and NVIC to their reset values.
pDevInitStruct,: | Pointer to the peripheral configuration structure. |
CPAL_PASS | or CPAL_FAIL |
uint32_t CPAL_I2C_ER_IRQHandler | ( | CPAL_InitTypeDef * | pDevInitStruct | ) |
Allows to handle errors occurred during initialization or communication in order to recover the correct communication status or call specific user functions.
pDevInitStruct,: | Pointer to the peripheral configuration structure. |
CPAL_PASS. |
uint32_t CPAL_I2C_EV_IRQHandler | ( | CPAL_InitTypeDef * | pDevInitStruct | ) |
This function handles I2C interrupt request for preparing communication and for transfer phase in case of using Interrupt Programming Model.
pDevInitStruct,: | Pointer to the peripheral configuration structure. |
CPAL_PASS. |
uint32_t CPAL_I2C_Init | ( | CPAL_InitTypeDef * | pDevInitStruct | ) |
Initialize the peripheral and all related clocks, GPIOs, DMA and Interrupts according to the specified parameters in the CPAL_InitTypeDef structure.
pDevInitStruct | : Pointer to the peripheral configuration structure. |
CPAL_PASS | or CPAL_FAIL |
uint32_t CPAL_I2C_IsDeviceReady | ( | CPAL_InitTypeDef * | pDevInitStruct | ) |
Wait until target device is ready for communication (This function is used with Memory devices).
pDevInitStruct,: | Pointer to the peripheral configuration structure. |
CPAL_PASS | or CPAL_FAIL. |
uint32_t CPAL_I2C_Read | ( | CPAL_InitTypeDef * | pDevInitStruct | ) |
Allows to receive a data or a buffer of data through the peripheral from a selected device in a selected location address.
pDevInitStruct,: | Pointer to the peripheral configuration structure. |
CPAL_PASS | or CPAL_FAIL. |
uint32_t CPAL_I2C_StructInit | ( | CPAL_InitTypeDef * | pDevInitStruct | ) |
Initialize the peripheral structure with default values according to the specified parameters in the CPAL_I2CDevTypeDef structure.
pDevInitStruct,: | Pointer to the peripheral configuration structure. |
CPAL_PASS | or CPAL_FAIL. |
uint32_t CPAL_I2C_Write | ( | CPAL_InitTypeDef * | pDevInitStruct | ) |
Allows to send a data or a buffer of data through the peripheral to a selected device in a selected location address.
pDevInitStruct,: | Pointer to the peripheral configuration structure. |
CPAL_PASS | or CPAL_FAIL. |