/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : main.h
  * @brief          : Header for main.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2024 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 __MAIN_H
#define __MAIN_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */

//#define PIN_adr0(x) HAL_GPIO_WritePin(GPIOA, GPIO_PIN_2, x)
//#define PIN_adr1(x) HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3, x)
//#define PIN_adr2(x) HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, x)
//#define PIN_data0(x) HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, x)
//#define PIN_data1(x) HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, x)
//#define PIN_data2(x) HAL_GPIO_WritePin(GPIOA, GPIO_PIN_7, x)
//#define PIN_data3(x) HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, x)
//#define PIN_data4(x) HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, x)
//#define PIN_data5(x) HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, x)
//#define PIN_data6(x) HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, x)
//#define PIN_data7(x) HAL_GPIO_WritePin(GPIOB, GPIO_PIN_11, x)



#define PIN_adr0(x) GPIOA->ODR |= (x)<<2;
#define PIN_adr1(x) GPIOA->ODR |= (x)<<3;
#define PIN_adr2(x) GPIOA->ODR |= (x)<<4;
#define PIN_data0(x) GPIOA->ODR |= (x)<<5;
#define PIN_data1(x) GPIOA->ODR |= (x)<<6;
#define PIN_data2(x) GPIOA->ODR |= (x)<<7;
#define PIN_data3(x) GPIOB->ODR |= (x);
#define PIN_data4(x) GPIOB->ODR |= (x)<<1;
#define PIN_data5(x) GPIOB->ODR |= (x)<<3;
#define PIN_data6(x) GPIOB->ODR |= (x)<<10;
#define PIN_data7(x) GPIOB->ODR |= (x)<<11;

#define PIN_CLR GPIOA->ODR = 0x00; GPIOB->ODR &= 1<<4;


/* USER CODE END Includes */

/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */
struct sensor
{
	unsigned sens0:5;
	unsigned sens1:5;
	unsigned sens2:5;
	unsigned sens3:5;
	unsigned sens4:5;
	unsigned sens5:5;
	unsigned sens6:5;
	unsigned sens7:5;
};
extern struct sensor sensors;

struct flags
{
	unsigned LCD_debug:1;
	unsigned position : 1;
	unsigned Recieve_On : 1;
	unsigned tim_flag : 1;
	unsigned Start_of_recieve : 1;
};
extern struct flags flag;
/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */

/* USER CODE END EC */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */

/* USER CODE END EM */

//void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);

/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);

/* USER CODE BEGIN EFP */

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/

/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __MAIN_H */
