| Mini51 BSP V3.02.002 The Board Support Package for Mini51 Series

Macros | Typedefs | Functions | Variables
i2c_software_gpio_with_timer.c File Reference

MINI51 series software I2C driver source file. More...

`#include <stdio.h>`
`#include "i2c_software_gpio_with_timer.h"`

Go to the source code of this file.

## Macros
#define | I2C_SW_SDA P34
#define | I2C_SW_CLK P35

## Typedefs
typedef void(* | TIMER_CALLBACK) (void)

## Functions
uint32_t | I2C_SW_I_Open (uint32_t u32BusClock)
| Prepare to start software I2C. More...
void | TMR0_IRQHandler (void)
| ISR to handle TIMER0 interrupt event. More...
void | I2C_SW_I_Send_Stop (void)
| Send I2C STOP signal. More...
void | I2C_SW_I_Get_Byte (void)
| Read a byte. More...
void | I2C_SW_I_Send_Byte (void)
| Send a byte. More...
void | I2C_SW_I_Send_Start (void)
| Send I2C START signal. More...
uint32_t | I2C_SW_I_Send (uint8_t u8Address, uint8_t *p8Data, uint32_t u32ByteSize)
| Send data. More...
uint32_t | I2C_SW_I_IsBZ (void)
| Check if I2C is busy. More...
uint32_t | I2C_SW_I_Count (void)
| Return byte counter. More...
uint32_t | I2C_SW_I_Get (uint8_t u8Address, uint8_t *p8Data, uint32_t u32ByteSize)
| Read data. More...

## Variables
TIMER_CALLBACK | funPtr
I2C_SW_FLAG_T | I2C_SW_STATUS
uint8_t | u8I2C_Buffer
uint8_t * | p8I2C_Data
uint32_t | u32I2C_ByteSize
uint32_t | u32I2C_ByteSizeCount

## Detailed Description

MINI51 series software I2C driver source file.

Version
  V0.10

Revision
  4

Date
  13/09/30 6:48p

Note
  SPDX-License-Identifier: Apache-2.0 Copyright (C) 2013 Nuvoton Technology Corp. All rights reserved.

Definition in file i2c_software_gpio_with_timer.c.

## Macro Definition Documentation

## ◆ I2C_SW_CLK

#define I2C_SW_CLK P35

Definition at line 17 of file i2c_software_gpio_with_timer.c.

## ◆ I2C_SW_SDA

#define I2C_SW_SDA P34

Definition at line 16 of file i2c_software_gpio_with_timer.c.

## Typedef Documentation

## ◆ TIMER_CALLBACK

typedef void(* TIMER_CALLBACK) (void)

Definition at line 19 of file i2c_software_gpio_with_timer.c.

## Function Documentation

## ◆ I2C_SW_I_Count()

uint32_t I2C_SW_I_Count | ( | void |  | ) |

Return byte counter.

Parameters

  - |

Return values

  Byte | counter

Definition at line 271 of file i2c_software_gpio_with_timer.c.

## ◆ I2C_SW_I_Get()

uint32_t I2C_SW_I_Get | ( | uint8_t | u8Address,
|  | uint8_t * | p8Data,
|  | uint32_t | u32ByteSize
| ) |  |

Read data.

Parameters

  u8Address | I2C slave address
  p8Data | data address
  u32ByteSize | data length

Return values

  0 | Success
  1 | Fail

Definition at line 284 of file i2c_software_gpio_with_timer.c.

## ◆ I2C_SW_I_Get_Byte()

void I2C_SW_I_Get_Byte | ( | void |  | ) |

Read a byte.

Parameters

  None |

Returns
  None

Definition at line 105 of file i2c_software_gpio_with_timer.c.

## ◆ I2C_SW_I_IsBZ()

uint32_t I2C_SW_I_IsBZ | ( | void |  | ) |

Check if I2C is busy.

Parameters

  None |

Return values

  0 | Not Busy
  1 | Busy

Definition at line 261 of file i2c_software_gpio_with_timer.c.

## ◆ I2C_SW_I_Open()

uint32_t I2C_SW_I_Open | ( | uint32_t | u32BusClock | ) |

Prepare to start software I2C.

Parameters

  u32BusClock | I2C Bus Clock (Hz)

Return values

  0 | Success

Definition at line 33 of file i2c_software_gpio_with_timer.c.

## ◆ I2C_SW_I_Send()

uint32_t I2C_SW_I_Send | ( | uint8_t | u8Address,
|  | uint8_t * | p8Data,
|  | uint32_t | u32ByteSize
| ) |  |

Send data.

Parameters

  u8Address | I2C slave address
  p8Data | data address
  u32ByteSize | data length

Return values

  1 | I2C is busy
  0 | Success

Definition at line 232 of file i2c_software_gpio_with_timer.c.

## ◆ I2C_SW_I_Send_Byte()

void I2C_SW_I_Send_Byte | ( | void |  | ) |

Send a byte.

Parameters

  None |

Returns
  None

Definition at line 149 of file i2c_software_gpio_with_timer.c.

## ◆ I2C_SW_I_Send_Start()

void I2C_SW_I_Send_Start | ( | void |  | ) |

Send I2C START signal.

Parameters

  None |

Returns
  None

Definition at line 210 of file i2c_software_gpio_with_timer.c.

## ◆ I2C_SW_I_Send_Stop()

void I2C_SW_I_Send_Stop | ( | void |  | ) |

Send I2C STOP signal.

Parameters

  None |

Returns
  None

Definition at line 81 of file i2c_software_gpio_with_timer.c.

## ◆ TMR0_IRQHandler()

void TMR0_IRQHandler | ( | void |  | ) |

ISR to handle TIMER0 interrupt event.

Parameters

  None |

Returns
  None

Definition at line 65 of file i2c_software_gpio_with_timer.c.

## Variable Documentation

## ◆ funPtr

TIMER_CALLBACK funPtr

Definition at line 21 of file i2c_software_gpio_with_timer.c.

## ◆ I2C_SW_STATUS

I2C_SW_FLAG_T I2C_SW_STATUS

Definition at line 22 of file i2c_software_gpio_with_timer.c.

## ◆ p8I2C_Data

uint8_t* p8I2C_Data

Definition at line 25 of file i2c_software_gpio_with_timer.c.

## ◆ u32I2C_ByteSize

uint32_t u32I2C_ByteSize

Definition at line 26 of file i2c_software_gpio_with_timer.c.

## ◆ u32I2C_ByteSizeCount

uint32_t u32I2C_ByteSizeCount

Definition at line 26 of file i2c_software_gpio_with_timer.c.

## ◆ u8I2C_Buffer

uint8_t u8I2C_Buffer

Definition at line 24 of file i2c_software_gpio_with_timer.c.