generated from hulk/gd32e23x_template
IIC scan
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define LDC1612_ADDR (0x2B << 1)
|
||||
|
||||
/*Register Rddr*/
|
||||
/***************************************************************************/
|
||||
#define CONVERTION_RESULT_REG_START 0X00
|
||||
@@ -33,9 +35,6 @@
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
#define I2C_TIME_OUT (uint16_t)(10000)
|
||||
#define LDC_I2C I2C0
|
||||
#define I2C_SPEED 400000
|
||||
|
||||
typedef enum {
|
||||
I2C_START = 0,
|
||||
@@ -45,10 +44,7 @@ typedef enum {
|
||||
I2C_STOP
|
||||
} i2c_process_enum;
|
||||
|
||||
#define I2C_OK 1
|
||||
#define I2C_FAIL 0
|
||||
#define I2C_END 1
|
||||
|
||||
#define I2C_SPEED 400000
|
||||
#define RCU_IR_GPIO RCU_GPIOF
|
||||
#define RCU_I2C RCU_I2C0
|
||||
#define I2C_SCL_PORT GPIOF
|
||||
@@ -57,32 +53,13 @@ typedef enum {
|
||||
#define I2C_SDA_PIN GPIO_PIN_0
|
||||
#define I2C_GPIO_AF GPIO_AF_1
|
||||
|
||||
#define LDC1612_ADDR (0x2B << 1)
|
||||
|
||||
// LDC1612 寄存器地址
|
||||
#define RCOUNT0_ADDR 0x08
|
||||
#define SETTLECOUNT0_ADDR 0x10
|
||||
#define CLOCK_DIVIDERS0_ADDR 0x14
|
||||
#define ERROR_CONFIG_ADDR 0x19
|
||||
#define MUX_CONFIG_ADDR 0x1B
|
||||
#define DRIVE_CURRENT0_ADDR 0x1E
|
||||
#define CONFIG_ADDR 0x1A
|
||||
|
||||
|
||||
#define I2C_TIME_OUT (uint16_t)(10000)
|
||||
|
||||
void I2C_config(void);
|
||||
void I2C_scan(void);
|
||||
uint8_t IIC_read_16bit(uint8_t reg, uint16_t *value);
|
||||
void LDC1612_read_sensor_infomation(void);
|
||||
|
||||
void LDC1612_I2CConfig(void);
|
||||
void LDC1612_Init(void);
|
||||
int LDC1612_read_reg(uint8_t device_address, uint8_t reg_address, uint8_t *data, uint16_t length);
|
||||
int i2c_write_reg(uint8_t device_address, uint8_t *data);
|
||||
|
||||
uint8_t eeprom_byte_write_timeout(uint8_t device_address, uint8_t *data);
|
||||
|
||||
void I2C_Scan(void);
|
||||
|
||||
uint8_t IIC_read_16bit(uint8_t reg, uint16_t *value);
|
||||
|
||||
int LDC_getID(void);
|
||||
|
||||
#endif //LDC1612_H
|
||||
|
Reference in New Issue
Block a user