#include "stm32c0xx_hal.h"
void setup() {
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitTypeDef GPIO_LedStruct = {0};
GPIO_LedStruct.Pin = GPIO_PIN_6 | GPIO_PIN_7;
GPIO_LedStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_LedStruct.Pull = GPIO_NOPULL;
GPIO_LedStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_LedStruct);
GPIO_InitTypeDef GPIO_ButtonStruct = {0};
GPIO_ButtonStruct.Pin = GPIO_PIN_0;
GPIO_ButtonStruct.Mode = GPIO_MODE_INPUT;
GPIO_ButtonStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOA, &GPIO_ButtonStruct);
}
void loop() {
if (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_0) == GPIO_PIN_RESET) {
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6 | GPIO_PIN_7, GPIO_PIN_SET);
} else {
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6 | GPIO_PIN_7, GPIO_PIN_RESET);
}
}