You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
249 lines
3.3 KiB
249 lines
3.3 KiB
#pragma once
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#include "main.h"
|
|
|
|
#ifdef __STM32F4xx_HAL_H
|
|
#include "stm32f4xx.h"
|
|
#endif
|
|
|
|
#ifdef HAL_CRYP_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_ADC_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_CAN_MODULE_ENABLED
|
|
#include "can.h"
|
|
#endif
|
|
#ifdef HAL_CRC_MODULE_ENABLED
|
|
#include "crc.h"
|
|
#endif
|
|
#ifdef HAL_CAN_LEGACY_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_DAC_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_DCMI_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_DMA2D_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_ETH_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_NAND_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_NOR_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_PCCARD_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_SRAM_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_SDRAM_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_HASH_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_I2C_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_I2S_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_IWDG_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_LTDC_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_RNG_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_RTC_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_SAI_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_SD_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_MMC_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_SPI_MODULE_ENABLED
|
|
#include "spi.h"
|
|
#endif
|
|
#ifdef HAL_TIM_MODULE_ENABLED
|
|
#include "tim.h"
|
|
#endif
|
|
#ifdef HAL_UART_MODULE_ENABLED
|
|
#include "usart.h"
|
|
#endif
|
|
#ifdef HAL_USART_MODULE_ENABLED
|
|
#include "usart.h"
|
|
#endif
|
|
#ifdef HAL_IRDA_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_SMARTCARD_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_SMBUS_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_WWDG_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_PCD_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_HCD_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_DSI_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_QSPI_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_QSPI_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_CEC_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_FMPI2C_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_FMPSMBUS_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_SPDIFRX_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_DFSDM_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_LPTIM_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_GPIO_MODULE_ENABLED
|
|
#include "gpio.h"
|
|
#endif
|
|
#ifdef HAL_EXTI_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_DMA_MODULE_ENABLED
|
|
#endif
|
|
#ifdef HAL_RCC_MODULE_ENABLED
|
|
#endif
|
|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14,
|
|
PF15,
|
|
PG0 = 0x70,
|
|
PG1,
|
|
PG2,
|
|
PG3,
|
|
PG4,
|
|
PG5,
|
|
PG6,
|
|
PG7,
|
|
PG8,
|
|
PG9,
|
|
PG10,
|
|
PG11,
|
|
PG12,
|
|
PG13,
|
|
PG14,
|
|
PG15,
|
|
} Pin_t;
|
|
|
|
// GPIO_TypeDef *gpio, uint16_t pin
|
|
|
|
GPIO_TypeDef* chip_get_gpio(Pin_t pin);
|
|
uint16_t chip_get_pinoff(Pin_t pin);
|
|
|
|
void chip_critical_enter(void);
|
|
void chip_critical_exit(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|