io.cpp 400 B

123456789101112131415161718
  1. #include "stm32l0xx_hal.h"
  2. #include "io.h"
  3. //
  4. void io_init(void)
  5. {
  6. GPIO_InitTypeDef GPIO_InitStruct;
  7. __HAL_RCC_GPIOA_CLK_ENABLE();
  8. // switch
  9. GPIO_InitStruct.Pin = GPIO_PIN_7;
  10. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  11. GPIO_InitStruct.Pull = GPIO_PULLUP;
  12. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
  13. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  14. }