47 lines
947 B
C
47 lines
947 B
C
#ifndef __CHRG_IRQ_H__
|
|
#define __CHRG_IRQ_H__
|
|
|
|
#include <rtthread.h>
|
|
#include <rtdevice.h>
|
|
|
|
#include "drv_gpio.h"
|
|
|
|
#define NAME_INTR_I2C1 "i2c1irq"
|
|
#define NAME_INTR_I2C2 "i2c2irq"
|
|
#define NAME_INTR_I2C3 "i2c3irq"
|
|
#define NAME_INTR_I2C4 "i2c4irq"
|
|
#define NAME_INTR_KEY "keyirq"
|
|
|
|
#define PIN_INTR_I2C1 GET_PIN(C, 8) //GET_PIN(C, 1)
|
|
#define PIN_INTR_I2C2 GET_PIN(C, 9) //GET_PIN(A, 1)
|
|
#define PIN_INTR_I2C3 GET_PIN(A, 7)
|
|
#define PIN_INTR_I2C4 GET_PIN(B, 13)
|
|
#define PIN_INTR_KEY GET_PIN(A, 0) //GET_PIN(B, 6)
|
|
|
|
typedef enum {
|
|
IDX_INTR_I2C1 = 0,
|
|
IDX_INTR_I2C2 = 1,
|
|
IDX_INTR_I2C3 = 2,
|
|
IDX_INTR_I2C4 = 3,
|
|
IDX_INTR_KEY = 4,
|
|
|
|
TOTAL_INTR
|
|
} eIDX_INTR;
|
|
|
|
struct chrg_intr_t {
|
|
const char *name;
|
|
rt_int32_t pin;
|
|
rt_uint8_t mode;
|
|
rt_uint8_t pulse;
|
|
rt_uint16_t delay; // 消抖延时 ms
|
|
rt_ssize_t value; // 当前值
|
|
rt_timer_t tmr_fd;
|
|
eIDX_INTR index;
|
|
};
|
|
|
|
extern struct chrg_intr_t chrgintr[TOTAL_INTR];
|
|
|
|
#endif
|
|
|
|
|