LLD for I2C (STM32F4)

Issue #190 new
Patryk Kubiak created an issue

General Description

The goal of the task is to provide support for I2C driver in the LLD of STM32F4 target.

The related task on the trello board: https://trello.com/c/NDZWA4wF

Required LLD interface

#!c
// STANDARD LLD FUNCTIONS (AUTO-GENERATED - can be copied from the other architecture, for example from STM32F7)
extern bool oC_I2C_LLD_IsChannelCorrect( oC_I2C_Channel_t Channel );
extern bool oC_I2C_LLD_IsChannelIndexCorrect( oC_I2C_LLD_ChannelIndex_t ChannelIndex );
extern oC_I2C_LLD_ChannelIndex_t oC_I2C_LLD_ChannelToChannelIndex( oC_I2C_Channel_t Channel );
extern oC_I2C_Channel_t oC_I2C_LLD_ChannelIndexToChannel( oC_I2C_LLD_ChannelIndex_t Channel );
extern oC_I2C_Channel_t oC_I2C_LLD_GetChannelOfModulePin( oC_I2C_Pin_t ModulePin );

oC_ErrorCode_t oC_I2C_LLD_TurnOnDriver( void );
oC_ErrorCode_t oC_I2C_LLD_TurnOffDriver( void );

// I2C specific functions (have to be implemented manual)
extern oC_ErrorCode_t oC_I2C_LLD_ConfigureAsMaster(
    oC_I2C_Channel_t                Channel ,
    oC_I2C_LLD_SpeedMode_t          SpeedMode ,
    oC_I2C_LLD_AddressMode_t        AddressMode ,
    oC_Time_t                       DataHoldTime ,
    oC_Time_t                       DataSetupTime ,
    oC_Time_t                       ClockLowTime ,
    oC_Time_t                       ClockHighTime ,
    oC_Frequency_t                  ClockFrequency ,
    oC_I2C_LLD_InterruptSource_t    EnabledInterrupts
    );

extern oC_ErrorCode_t oC_I2C_LLD_ConfigureAsSlave(
    oC_I2C_Channel_t                Channel ,
    oC_I2C_LLD_SpeedMode_t          SpeedMode ,
    oC_I2C_LLD_AddressMode_t        AddressMode ,
    oC_I2C_LLD_Address_t            OwnAddress ,
    bool                            GeneralCallEnabled ,
    bool                            ClockStretchingEnabled,
    oC_I2C_LLD_InterruptSource_t    EnabledInterrupts
    );
extern oC_ErrorCode_t oC_I2C_LLD_UnconfigureChannel( oC_I2C_Channel_t Channel );

extern oC_ErrorCode_t oC_I2C_LLD_StartAsMaster( oC_I2C_Channel_t Channel, bool StartForRead, oC_I2C_LLD_Address_t SlaveAddress, oC_MemorySize_t Size );
extern oC_ErrorCode_t oC_I2C_LLD_StopAsMaster ( oC_I2C_Channel_t Channel );
extern oC_ErrorCode_t oC_I2C_LLD_WriteAsMaster( oC_I2C_Channel_t Channel, const uint8_t * Data, oC_MemorySize_t * Size );
extern oC_ErrorCode_t oC_I2C_LLD_ReadAsMaster ( oC_I2C_Channel_t Channel, uint8_t *    outData, oC_MemorySize_t * Size );
extern oC_ErrorCode_t oC_I2C_LLD_WriteAsSlave ( oC_I2C_Channel_t Channel, const uint8_t * Data, oC_MemorySize_t * Size );
extern oC_ErrorCode_t oC_I2C_LLD_ReadAsSlave  ( oC_I2C_Channel_t Channel, uint8_t *    outData, oC_MemorySize_t * Size );
extern oC_ErrorCode_t oC_I2C_LLD_SetInterruptHandler( oC_I2C_LLD_InterruptHandler_t Handler );
extern oC_ErrorCode_t oC_I2C_LLD_ConnectModulePin( oC_I2C_Pin_t ModulePin );
extern oC_ErrorCode_t oC_I2C_LLD_DisconnectModulePin( oC_I2C_Pin_t ModulePin );

Comments (6)

  1. Log in to comment