Files
@ 2ee6c8e67f32
Branch filter:
Location: windsonde/Source/system/gpio.c - annotation
2ee6c8e67f32
1.8 KiB
text/plain
Add error handling and vim modelines
02d3447dac18 02d3447dac18 02d3447dac18 02d3447dac18 02d3447dac18 02d3447dac18 02d3447dac18 02d3447dac18 02d3447dac18 02d3447dac18 02d3447dac18 02d3447dac18 02d3447dac18 02d3447dac18 02d3447dac18 02d3447dac18 02d3447dac18 02d3447dac18 02d3447dac18 02d3447dac18 02d3447dac18 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 7ff1c5a59571 7ff1c5a59571 7ff1c5a59571 7ff1c5a59571 7ff1c5a59571 7ff1c5a59571 7ff1c5a59571 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 2ee6c8e67f32 2ee6c8e67f32 2ee6c8e67f32 | /*
* FeatherHAB
*
* This file is part of FeatherHAB.
*
* FeatherHab is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FeatherHab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with FeatherHAB. If not, see <http://www.gnu.org/licenses/>.
*
* Ethan Zonca
*
*/
#include "config.h"
#include "system/gpio.h"
#include "stm32f0xx_hal.h"
// Private variables
static uint8_t shutdown_triggered = 0;
static uint32_t shutdown_triggered_time = 0;
// Initialize GPIOs
void gpio_init(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
// Enable clocks
__GPIOC_CLK_ENABLE();
__GPIOF_CLK_ENABLE();
__GPIOA_CLK_ENABLE();
__GPIOB_CLK_ENABLE();
// LEDs 1/2
GPIO_InitStruct.Pin = PIN_LED_POWER;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
HAL_GPIO_Init(PORT_LED_POWER, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPS_NOTEN_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
HAL_GPIO_Init(GPS_NOTEN_PORT, &GPIO_InitStruct);
HAL_GPIO_WritePin(GPS_NOTEN, 1); // yes, keep the chip disabled
// Toggle the power LED
HAL_GPIO_TogglePin(LED_POWER);
}
// vim:softtabstop=4 shiftwidth=4 expandtab
|