eeManager_Interface.c 4.07 KB
Newer Older
李俭双's avatar
李俭双 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
#include "Components.h"
#include "RTE.h"

#define EE_SDA RTE_GPIO_PORT06_PIN01
#define EE_SCL RTE_GPIO_PORT06_PIN00

/*-------------------------------------------------------------------------
* Function Name  : eeprom_StoreInfo_Init
* Description    :
* Input          :
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void eeprom_StoreInfo_Init(void)
{
    eeprom_SetParameter(AT24C16, distance_100m);
    EE_SCL_OutConfig();
    EE_SDA_OutConfig();
}

/*-------------------------------------------------------------------------
* Function Name  : eeprom_comm_DelayUs
* Description    :
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void eeprom_comm_DelayUs(ee_uint32_t time)
{
    ee_uint32_t i;
    ee_uint32_t dalayCnt = 0;
    dalayCnt = time;
    EE_FeedDog();
    for (i = 0; i < dalayCnt; i++)
    {
        EE_NOP();
    }
    EE_FeedDog();
}

/*-------------------------------------------------------------------------
* Function Name  : EE_SDA_InConfig
* Description    :
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void EE_SDA_InConfig(void)
{
    RTE_GPIO_Config(EE_SDA, RTE_GPIO_DIR_IN);
}
/*-------------------------------------------------------------------------
* Function Name  : EE_SDA_OutConfig
* Description    :
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void EE_SDA_OutConfig(void)
{
65
    RTE_GPIO_Config(EE_SDA, RTE_GPIO_DIR_OUT);
李俭双's avatar
李俭双 committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
}
/*-------------------------------------------------------------------------
* Function Name  : EE_SDA_GetValue
* Description    :
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
ee_uint8_t EE_SDA_GetValue(void)
{
    uint8_t SDA_INPUT = 2;
    SDA_INPUT = RTE_GPIO_Get_Level(EE_SDA);
    return SDA_INPUT;
}

/*-------------------------------------------------------------------------
* Function Name  : EE_SDA_OUT
* Description    :
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void EE_SDA_OUT(ee_uint8_t data)
{
92 93
    // RTE_GPIO_Config(EE_SDA, RTE_GPIO_DIR_OUT | data);
    RTE_GPIO_Set_Level(EE_SDA, data);
李俭双's avatar
李俭双 committed
94 95 96 97 98 99 100 101 102 103 104 105
}

/*-------------------------------------------------------------------------
* Function Name  : EE_SDA_OutConfig
* Description    :
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void EE_SCL_OutConfig(void)
{
106
    RTE_GPIO_Config(EE_SCL, RTE_GPIO_DIR_OUT);
李俭双's avatar
李俭双 committed
107 108 109 110 111 112 113 114 115 116 117
}
/*-------------------------------------------------------------------------
* Function Name  : EE_SCL_OUT
* Description    :
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void EE_SCL_OUT(ee_uint8_t data)
{
118 119
    // RTE_GPIO_Config(EE_SCL, RTE_GPIO_DIR_OUT | data);
    RTE_GPIO_Set_Level(EE_SCL, data);
李俭双's avatar
李俭双 committed
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
}

/*-------------------------------------------------------------------------
* Function Name  : EE_FeedDog
* Description    : 清零 DOG
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void EE_FeedDog(void)
{
    RTE_WDT_Clear();
}

/*-------------------------------------------------------------------------
* Function Name  : EE_NOP
* Description    : nop 指令
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void EE_NOP(void)
{
    __NOP();
}