ESP8266 RTOS 筆記(一)-GPIO(1)

    此章節為 記錄ESP8266的gpio設定筆記
從gpio.h可以看到GPIO的結構參數,定義很簡單:

typedef enum {
    GPIO_PIN_INTR_DISABLE = 0,      /**< disable GPIO interrupt */
    GPIO_PIN_INTR_POSEDGE = 1,      /**< GPIO interrupt type : rising edge */
    GPIO_PIN_INTR_NEGEDGE = 2,      /**< GPIO interrupt type : falling edge */
    GPIO_PIN_INTR_ANYEDGE = 3,      /**< GPIO interrupt type : bothe rising and falling edge */
    GPIO_PIN_INTR_LOLEVEL = 4,      /**< GPIO interrupt type : low level */
    GPIO_PIN_INTR_HILEVEL = 5       /**< GPIO interrupt type : high level */
} GPIO_INT_TYPE;

typedef enum {
    GPIO_Mode_Input = 0x0,          /**< GPIO mode : Input */
    GPIO_Mode_Out_OD,               /**< GPIO mode : Output_OD */
    GPIO_Mode_Output ,              /**< GPIO mode : Output */
    GPIO_Mode_Sigma_Delta ,         /**< GPIO mode : Sigma_Delta */
} GPIOMode_TypeDef;

typedef enum {
    GPIO_PullUp_DIS = 0x0,      /**< disable GPIO pullup */
    GPIO_PullUp_EN  = 0x1,      /**< enable GPIO pullup */
} GPIO_Pullup_IF;



typedef struct {
    uint16           GPIO_Pin;      /**< GPIO pin */
    GPIOMode_TypeDef GPIO_Mode;     /**< GPIO mode */
    GPIO_Pullup_IF   GPIO_Pullup;   /**< GPIO pullup */
    GPIO_INT_TYPE    GPIO_IntrType; /**< GPIO interrupt type */
}GPIO_ConfigTypeDef;

就是用一個結構體來記錄GPIO的 INIT相關參數

留言

這個網誌中的熱門文章

FreeRTOS學習筆記 (二)-任務創建和刪除(xTaskCreate及vTaskDelete)

FreeRTOS學習筆記 (三)-時間管理vTaskDelay()及vTaskDelayUntil()

C語言筆記-文本處理(1) 善用 asprintf取代sprintf