mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-08-06 07:00:05 +08:00
feat(driver): Use standard typedef
This commit is contained in:
@ -20,18 +20,18 @@
|
||||
|
||||
#include "i2c_master.h"
|
||||
|
||||
static uint8 m_nLastSDA;
|
||||
static uint8 m_nLastSCL;
|
||||
static uint8_t m_nLastSDA;
|
||||
static uint8_t m_nLastSCL;
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : i2c_master_setDC
|
||||
* Description : Internal used function -
|
||||
* set i2c SDA and SCL bit value for half clk cycle
|
||||
* Parameters : uint8 SDA
|
||||
* uint8 SCL
|
||||
* Parameters : uint8_t SDA
|
||||
* uint8_t SCL
|
||||
* Returns : NONE
|
||||
*******************************************************************************/
|
||||
static void i2c_master_setDC(uint8 SDA, uint8 SCL)
|
||||
static void i2c_master_setDC(uint8_t SDA, uint8_t SCL)
|
||||
{
|
||||
SDA &= 0x01;
|
||||
SCL &= 0x01;
|
||||
@ -57,11 +57,11 @@ static void i2c_master_setDC(uint8 SDA, uint8 SCL)
|
||||
* Description : Internal used function -
|
||||
* get i2c SDA bit value
|
||||
* Parameters : NONE
|
||||
* Returns : uint8 - SDA bit value
|
||||
* Returns : uint8_t - SDA bit value
|
||||
*******************************************************************************/
|
||||
static uint8 i2c_master_getDC(void)
|
||||
static uint8_t i2c_master_getDC(void)
|
||||
{
|
||||
uint8 sda_out;
|
||||
uint8_t sda_out;
|
||||
ETS_INTR_LOCK();
|
||||
sda_out = GPIO_INPUT_GET(GPIO_ID_PIN(I2C_MASTER_SDA_GPIO));
|
||||
ETS_INTR_UNLOCK();
|
||||
@ -76,7 +76,7 @@ static uint8 i2c_master_getDC(void)
|
||||
*******************************************************************************/
|
||||
void i2c_master_init(void)
|
||||
{
|
||||
uint8 i;
|
||||
uint8_t i;
|
||||
|
||||
i2c_master_setDC(1, 0);
|
||||
i2c_master_wait(5);
|
||||
@ -165,10 +165,10 @@ void i2c_master_stop(void)
|
||||
/******************************************************************************
|
||||
* FunctionName : i2c_master_setAck
|
||||
* Description : set ack to i2c bus as level value
|
||||
* Parameters : uint8 level - 0 or 1
|
||||
* Parameters : uint8_t level - 0 or 1
|
||||
* Returns : NONE
|
||||
*******************************************************************************/
|
||||
void i2c_master_setAck(uint8 level)
|
||||
void i2c_master_setAck(uint8_t level)
|
||||
{
|
||||
i2c_master_setDC(m_nLastSDA, 0);
|
||||
i2c_master_wait(5);
|
||||
@ -186,11 +186,11 @@ void i2c_master_setAck(uint8 level)
|
||||
* FunctionName : i2c_master_getAck
|
||||
* Description : confirm if peer send ack
|
||||
* Parameters : NONE
|
||||
* Returns : uint8 - ack value, 0 or 1
|
||||
* Returns : uint8_t - ack value, 0 or 1
|
||||
*******************************************************************************/
|
||||
uint8 i2c_master_getAck(void)
|
||||
uint8_t i2c_master_getAck(void)
|
||||
{
|
||||
uint8 retVal;
|
||||
uint8_t retVal;
|
||||
i2c_master_setDC(m_nLastSDA, 0);
|
||||
i2c_master_wait(5);
|
||||
i2c_master_setDC(1, 0);
|
||||
@ -247,12 +247,12 @@ void i2c_master_send_nack(void)
|
||||
* FunctionName : i2c_master_readByte
|
||||
* Description : read Byte from i2c bus
|
||||
* Parameters : NONE
|
||||
* Returns : uint8 - readed value
|
||||
* Returns : uint8_t - readed value
|
||||
*******************************************************************************/
|
||||
uint8 i2c_master_readByte(void)
|
||||
uint8_t i2c_master_readByte(void)
|
||||
{
|
||||
uint8 retVal = 0;
|
||||
uint8 k, i;
|
||||
uint8_t retVal = 0;
|
||||
uint8_t k, i;
|
||||
|
||||
i2c_master_wait(5);
|
||||
i2c_master_setDC(m_nLastSDA, 0);
|
||||
@ -285,13 +285,13 @@ uint8 i2c_master_readByte(void)
|
||||
/******************************************************************************
|
||||
* FunctionName : i2c_master_writeByte
|
||||
* Description : write wrdata value(one byte) into i2c
|
||||
* Parameters : uint8 wrdata - write value
|
||||
* Parameters : uint8_t wrdata - write value
|
||||
* Returns : NONE
|
||||
*******************************************************************************/
|
||||
void i2c_master_writeByte(uint8 wrdata)
|
||||
void i2c_master_writeByte(uint8_t wrdata)
|
||||
{
|
||||
uint8 dat;
|
||||
sint8 i;
|
||||
uint8_t dat;
|
||||
int8_t i;
|
||||
|
||||
i2c_master_wait(5);
|
||||
|
||||
|
Reference in New Issue
Block a user