/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file    gpio.h
  * @brief   This file contains all the function prototypes for
  *          the gpio.c file
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2023 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __GPIO_H__
#define __GPIO_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "main.h"

/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* USER CODE BEGIN Private defines */

#define LOW                     GPIO_PIN_RESET
#define HIGH                    GPIO_PIN_SET

#define MODE_OFF                -1
#define INPUT                   0
#define OUTPUT                  1
#define INPUT_PULLUP            2
#define INPUT_PULLDOWN          3
#define OUTPUT_PULLUP           4
#define OUTPUT_PULLDOWN         5
#define OUTPUT_OPENDRAIN        6
#define LAST_MODE               OUTPUT_OPENDRAIN

#define GPIO_PIN_TOGGLE         -1

void pinMode(uint8_t pin, int8_t mode);       //pin     [1~144]pin number of IC
void digitalWrite(uint8_t pin, int8_t state); //state   [0]GPIO_PIN_RESET   [1]GPIO_PIN_SET   [-1]GPIO_PIN_TOGGLE
GPIO_PinState digitalRead(uint8_t pin);       //return  [0]GPIO_PIN_RESET   [1]GPIO_PIN_SET

extern uint8_t stop_flag;

/* USER CODE END Private defines */

void MX_GPIO_Init(void);

/* USER CODE BEGIN Prototypes */
/**
  * @param  GPIOx       GPIOA GPIOB GPIOC GPIOD GPIOE GPIOF GPIOG GPIOH
  * @param  GPIO_Pin    GPIO_PIN_0  GPIO_PIN_1  ... GPIO_PIN_9  GPIO_PIN_10 ... GPIO_PIN_15 GPIO_PIN_All
  * @param  PinState    GPIO_PIN_RESET  GPIO_PIN_SET
  */
GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
void HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState);
void HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);

/* USER CODE END Prototypes */

#ifdef __cplusplus
}
#endif
#endif /*__ GPIO_H__ */

