Clean up DWIN code
This commit is contained in:
committed by
Scott Lahteine
parent
2d33a9fd7c
commit
e78f19bc87
@@ -30,11 +30,11 @@
|
||||
|
||||
/******************** IIC ********************/
|
||||
|
||||
//IO方向设置
|
||||
//IO direction setting
|
||||
#define SDA_IN() do{ PIN_MAP[IIC_EEPROM_SDA].gpio_device->regs->CRH &= 0XFFFF0FFF; PIN_MAP[IIC_EEPROM_SDA].gpio_device->regs->CRH |= 8 << 12; }while(0)
|
||||
#define SDA_OUT() do{ PIN_MAP[IIC_EEPROM_SDA].gpio_device->regs->CRH &= 0XFFFF0FFF; PIN_MAP[IIC_EEPROM_SDA].gpio_device->regs->CRH |= 3 << 12; }while(0)
|
||||
|
||||
//IO操作函数
|
||||
//IO operation function
|
||||
#define IIC_SCL_0() WRITE(IIC_EEPROM_SCL, LOW)
|
||||
#define IIC_SCL_1() WRITE(IIC_EEPROM_SCL, HIGH)
|
||||
#define IIC_SDA_0() WRITE(IIC_EEPROM_SDA, LOW)
|
||||
@@ -43,18 +43,18 @@
|
||||
|
||||
class BL24CXX;
|
||||
|
||||
// IIC所有操作函数
|
||||
// All operation functions of IIC
|
||||
class IIC {
|
||||
friend class BL24CXX;
|
||||
protected:
|
||||
static void init(); // 初始化IIC的IO口
|
||||
static void start(); // 发送IIC开始信号
|
||||
static void stop(); // 发送IIC停止信号
|
||||
static void send_byte(uint8_t txd); // IIC发送一个字节
|
||||
static uint8_t read_byte(unsigned char ack); // IIC读取一个字节
|
||||
static uint8_t wait_ack(); // IIC等待ACK信号
|
||||
static void ack(); // IIC发送ACK信号
|
||||
static void nAck(); // IIC不发送ACK信号
|
||||
static void init(); // Initialize the IO port of IIC
|
||||
static void start(); // Send IIC start signal
|
||||
static void stop(); // Send IIC stop signal
|
||||
static void send_byte(uint8_t txd); // IIC sends a byte
|
||||
static uint8_t read_byte(unsigned char ack); // IIC reads a byte
|
||||
static uint8_t wait_ack(); // IIC waits for ACK signal
|
||||
static void ack(); // IIC sends ACK signal
|
||||
static void nAck(); // IIC does not send ACK signal
|
||||
|
||||
static void write_one_byte(uint8_t daddr, uint8_t addr, uint8_t data);
|
||||
static uint8_t read_one_byte(uint8_t daddr, uint8_t addr);
|
||||
@@ -75,12 +75,12 @@ protected:
|
||||
|
||||
class BL24CXX {
|
||||
public:
|
||||
static void init(); //初始化IIC
|
||||
static uint8_t check(); //检查器件
|
||||
static uint8_t readOneByte(uint16_t ReadAddr); //指定地址读取一个字节
|
||||
static void writeOneByte(uint16_t WriteAddr, uint8_t DataToWrite); //指定地址写入一个字节
|
||||
static void writeLenByte(uint16_t WriteAddr, uint32_t DataToWrite, uint8_t Len);//指定地址开始写入指定长度的数据
|
||||
static uint32_t readLenByte(uint16_t ReadAddr, uint8_t Len); //指定地址开始读取指定长度数据
|
||||
static void write(uint16_t WriteAddr, uint8_t *pBuffer, uint16_t NumToWrite); //从指定地址开始写入指定长度的数据
|
||||
static void read(uint16_t ReadAddr, uint8_t *pBuffer, uint16_t NumToRead); //从指定地址开始读出指定长度的数据
|
||||
static void init(); // Initialize IIC
|
||||
static uint8_t check(); // Check the device
|
||||
static uint8_t readOneByte(uint16_t ReadAddr); // Read a byte at the specified address
|
||||
static void writeOneByte(uint16_t WriteAddr, uint8_t DataToWrite); // Write a byte at the specified address
|
||||
static void writeLenByte(uint16_t WriteAddr, uint32_t DataToWrite, uint8_t Len);// The specified address begins to write the data of the specified length
|
||||
static uint32_t readLenByte(uint16_t ReadAddr, uint8_t Len); // The specified address starts to read the data of the specified length
|
||||
static void write(uint16_t WriteAddr, uint8_t *pBuffer, uint16_t NumToWrite); // Write the specified length of data from the specified address
|
||||
static void read(uint16_t ReadAddr, uint8_t *pBuffer, uint16_t NumToRead); // Read the data of the specified length from the specified address
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user