generated from hulk/gd32e23x_template
49 lines
1.1 KiB
C
49 lines
1.1 KiB
C
//
|
|
// Created by dell on 24-12-3.
|
|
//
|
|
|
|
#ifndef LDC1612_H
|
|
#define LDC1612_H
|
|
|
|
#include "gd32e23x_it.h"
|
|
#include "gd32e23x.h"
|
|
#include "systick.h"
|
|
#include <stdbool.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#define LED_PORT GPIOA
|
|
#define LED_PIN GPIO_PIN_7
|
|
#define LED_RCU RCU_GPIOA
|
|
#define LED_TIMER_RCU RCU_TIMER16
|
|
#define LED_TIMER TIMER16
|
|
#define LED_IRQ TIMER16_IRQn
|
|
|
|
#define I2C_SPEED 100000
|
|
|
|
#define RCU_IR_GPIO RCU_GPIOF
|
|
#define RCU_I2C RCU_I2C0
|
|
#define I2C_SCL_PORT GPIOF
|
|
#define I2C_SCL_PIN GPIO_PIN_1
|
|
#define I2C_SDA_PORT GPIOF
|
|
#define I2C_SDA_PIN GPIO_PIN_0
|
|
#define I2C_GPIO_AF GPIO_AF_1
|
|
|
|
#define LDC1612_ADDR (0x2A << 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
|
|
|
|
void led_config(void);
|
|
void LDC1612_I2CConfig(void);
|
|
void LDC1612_Init(void);
|
|
|
|
#endif //LDC1612_H
|