PHiLIP
i2c.c File Reference

Controls the i2c peripheral. More...

#include <string.h>
#include <errno.h>
#include "stm32f1xx_hal.h"
#include "PHiLIP_typedef.h"
#include "port.h"
#include "app_access.h"
#include "app_common.h"
#include "app_defaults.h"
#include "app_reg.h"
#include "gpio.h"
#include "i2c.h"

Data Structures

struct  i2c_dev
 The parameters for reg control. More...
 

Macros

#define CONVERT_7ADDR(x)   ((x<<1)&0xFF)
 convert 7 but reg address
 
#define CONVERT_10ADDR(x)   ((x<<1)&0x07FF)
 convert 10 but reg address
 
#define IS_STATE_WRITING(x)
 Check all reg writing states. More...
 

Enumerations

enum  I2C_STATE {
  I2C_INITIALIZED, I2C_READING_DATA, I2C_WRITE_ADDRESS_RECEIVED, I2C_WRITE_1ST_REG_BYTE_RECEIVED,
  I2C_WRITING_DATA, I2C_ADDR_NACK, I2C_STOPPED
}
 The state settings of the I2C. More...
 

Functions

void init_dut_i2c (map_t *reg)
 Initializes i2c registers. More...
 
void init_dut_i2c_msp ()
 Only for use with the STM32xxxx_HAL_Driver.
 
void deinit_dut_i2c_msp ()
 Only for use with the STM32xxxx_HAL_Driver.
 
error_t commit_dut_i2c ()
 Commits the i2c registers and executes operations. More...
 
void update_dut_i2c_inputs ()
 Updates the i2c input levels.
 
void DUT_I2C_EV_INT (void)
 This function handles i2c_dut event interrupt.
 
void DUT_I2C_ERR_INT (void)
 This function handles i2c_dut error interrupt.
 

Detailed Description

Controls the i2c peripheral.

Author
Kevin Weiss
Date
13.02.2019

Macro Definition Documentation

#define IS_STATE_WRITING (   x)
Value:

Check all reg writing states.