/**
  ******************************************************************************
  * @file    gpio.c
  * @brief   This file provides code for the configuration
  *          of all used GPIO pins.
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright (c) Puya Semiconductor Co.
  * All rights reserved.</center></h2>
  *
  * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
  * All rights reserved.</center></h2>
  *
  * This software component is licensed by ST under BSD 3-Clause license,
  * the "License"; You may not use this file except in compliance with the
  * License. You may obtain a copy of the License at:
  *                        opensource.org/licenses/BSD-3-Clause
  *
  ******************************************************************************
  */

/* Includes ------------------------------------------------------------------*/
#include "gpio.h"
#include "ds18b20_driver.h"
/* Private define ------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private user code ---------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/** Configure pins as
        * Analog
        * Input
        * Output
        * EVENT_OUT
        * EXTI
*/
void MX_GPIO_Init(void)
{

  GPIO_InitTypeDef GPIO_InitStruct = {0};

  /* GPIO Ports Clock Enable */
  __HAL_RCC_GPIOA_CLK_ENABLE();
  __HAL_RCC_GPIOB_CLK_ENABLE();

  
  /* Настройка пина PB0 (OneWire) */
  DS_GPIO_Port->MODER &= ~(GPIO_MODER_MODE0);
  DS_GPIO_Port->MODER |= (GPIO_MODE_OUTPUT_PP << GPIO_MODER_MODE0_Pos);
  DS_GPIO_Port->PUPDR &= ~(GPIO_PUPDR_PUPD0);
  DS_GPIO_Port->PUPDR |= (GPIO_NOPULL << GPIO_PUPDR_PUPD0_Pos);
  DS_GPIO_Port->OSPEEDR |= (GPIO_SPEED_FREQ_VERY_HIGH << GPIO_OSPEEDR_OSPEED0_Pos);
  
  /* Установка PA1, PA4, PA5 в высокий уровень */
  GPIOA->BSRR = GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5;
  
  /*Configure LED GPIO pin : PA1 PA4 PA5 */
  /* Настройка пинов PA1, PA4, PA5 */
  GPIOA->MODER &= ~(GPIO_MODER_MODE1 | GPIO_MODER_MODE4 | GPIO_MODER_MODE5);
  GPIOA->MODER |= (GPIO_MODE_OUTPUT_PP << GPIO_MODER_MODE1_Pos) |
                  (GPIO_MODE_OUTPUT_PP << GPIO_MODER_MODE4_Pos) |
                  (GPIO_MODE_OUTPUT_PP << GPIO_MODER_MODE5_Pos);
  GPIOA->PUPDR &= ~(GPIO_PUPDR_PUPD1 | GPIO_PUPDR_PUPD4 | GPIO_PUPDR_PUPD5);
  GPIOA->PUPDR |= (GPIO_NOPULL << GPIO_PUPDR_PUPD1_Pos) |
                  (GPIO_NOPULL << GPIO_PUPDR_PUPD4_Pos) |
                  (GPIO_NOPULL << GPIO_PUPDR_PUPD5_Pos);
  GPIOA->OSPEEDR |= (GPIO_SPEED_FREQ_LOW << GPIO_OSPEEDR_OSPEED1_Pos) |
                    (GPIO_SPEED_FREQ_LOW << GPIO_OSPEEDR_OSPEED4_Pos) |
                    (GPIO_SPEED_FREQ_LOW << GPIO_OSPEEDR_OSPEED5_Pos);
}
/************************ (C) COPYRIGHT Puya *****END OF FILE******************/
