generated from hulk/gd32e23x_template
添加board_config.h作为全部板上IO的宏定义位置,独立soft_i2c为单独文件
This commit is contained in:
37
inc/soft_i2c.h
Normal file
37
inc/soft_i2c.h
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// Created by dell on 24-12-28.
|
||||
//
|
||||
|
||||
#ifndef SOFT_I2C_H
|
||||
#define SOFT_I2C_H
|
||||
|
||||
#include "gd32e23x_it.h"
|
||||
#include "gd32e23x.h"
|
||||
#include "systick.h"
|
||||
#include "main.h"
|
||||
|
||||
#include "board_config.h"
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
#define I2C_SCL_HIGH() gpio_bit_set(I2C_SCL_PORT, I2C_SCL_PIN)
|
||||
#define I2C_SCL_LOW() gpio_bit_reset(I2C_SCL_PORT, I2C_SCL_PIN)
|
||||
#define I2C_SDA_HIGH() gpio_bit_set(I2C_SDA_PORT, I2C_SDA_PIN)
|
||||
#define I2C_SDA_LOW() gpio_bit_reset(I2C_SDA_PORT, I2C_SDA_PIN)
|
||||
#define I2C_SDA_READ() gpio_input_bit_get(I2C_SDA_PORT, I2C_SDA_PIN)
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
void i2c_delay(void);
|
||||
|
||||
void soft_i2c_config(void);
|
||||
|
||||
void soft_i2c_start(void);
|
||||
void soft_i2c_stop(void);
|
||||
void soft_i2c_send_ack(void);
|
||||
void soft_i2c_send_nack(void);
|
||||
uint8_t soft_i2c_wait_ack(void);
|
||||
void soft_i2c_send_byte(uint8_t data);
|
||||
uint8_t soft_i2c_receive_byte(uint8_t ack);
|
||||
|
||||
#endif //SOFT_I2C_H
|
Reference in New Issue
Block a user