#ifndef I2C_H
#define I2C_H

  #include <stdbool.h>
  #include <stdint.h>
  #include "stm32l1xx_hal.h"

  typedef enum
  {
      eI2CPinMode_Default,
      eI2CPinMode_KeepPullUp,
      eI2CPinMode_KeepPullDown,
  }
  eI2CPinMode_t;

  typedef struct
  { 
      bool (*Init)( eI2CPinMode_t pinmode );
      HAL_StatusTypeDef (*Transmit)( uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout);
      HAL_StatusTypeDef (*Receive)( uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout);
      void (*DeInit)( eI2CPinMode_t pinmode );
  }
  I2C_Handle_t;
  #ifdef STM32L1XX_IT_C
  extern I2C_HandleTypeDef i2c_handle;  // for stm32l1xx_it.c
  #endif
  extern const I2C_Handle_t I2C_Handle;

#endif
