constexpr const pll_cfg* rcc::pll_main_configuration_check ( const pll_cfg* const cfg, uint8_t count ) {
// Проверяем все имеющиеся структуры конфигурации основного PLL.
for ( int loop = 0; loop < count; loop++ ) {
// Ошибка в одной из структур pll_cfg, параметр M.
if ( ( cfg[loop].m < 2 ) || ( cfg[loop].m > 63 ) )
throw("Structure has an invalid parameter M! M >= 2 and M <= 63!");
error: expression '<throw-expression>' is not a constant-expression
// Ошибка в одной из структур pll_cfg, параметр M.
if ( ( cfg[loop].m < 2 ) || ( cfg[loop].m > 63 ) )
static_assert(false, "Structure has an invalid parameter M! M >= 2 and M <= 63!");
constexpr const pll_cfg* rcc::pll_main_configuration_check ( const pll_cfg* const cfg, uint8_t count ) {
// Проверяем все имеющиеся структуры конфигурации основного PLL.
for ( int loop = 0; loop < count; loop++ ) {
// Ошибка в одной из структур pll_cfg, параметр M.
static_assert(( cfg[loop].m < 2 ) || ( cfg[loop].m > 63 ), "Structure has an invalid parameter M! M >= 2 and M <= 63!");
error: non-constant condition for static assertion
и вы используете GCC (и только его, как я понял, ничего для кейла и прочих друзей я пока не узрел). А GCC прекрасно умеет в #pragma once. Так вот вопрос, почему вы выбрали вариант с #ifndef abracadabra?когда-то просто где-то увидел, что делают так. Думал, иначе нельзя. Сейчас посмотрел, действительно очень удобно. Везде обновлю это. Спасибо.
typedef typename T cfg_type;. Но не суть. Сам подход уловил.
/*
* Структура конфигурации вывода.
*/
struct __attribute__((packed)) pin_config_t {
EC_PORT_NAME port; // Имя порта ( пример: EC_PORT_NAME::A ).
EC_PORT_PIN_NAME pin_name; // Номер вывода ( пример: EC_PORT_PIN_NAME::PIN_0 ).
EC_PIN_MODE mode; // Режим вывода ( пример: EC_PIN_MODE::OUTPUT ).
EC_PIN_OUTPUT_CFG output_config; // Режим выхода ( пример: EC_PIN_OUTPUT_CFG::NOT_USE ).
EC_PIN_SPEED speed; // Скорость вывода ( пример: EC_PIN_SPEED::MEDIUM ).
EC_PIN_PULL pull; // Подтяжка вывода ( пример: EC_PIN_PULL::NO ).
EC_PIN_AF af; // Альтернативная функция вывода ( пример: EC_PIN_AF::NOT_USE ).
EC_LOCKED locked; // Заблокировать ли настройку данного
// вывода во время инициализации global_port объекта ( пример EC_LOCKED::NOT_LOCKED ).
EC_PIN_STATE_AFTER_INIT state_after_init; // Состояние на выходе после инициализации
// ( в случае, если вывод настроен как выход ).
// (пример EC_PIN_STATE_AFTER_INIT::NO_USE).
};
/**********************************************************************
* Область template оболочек.
**********************************************************************/
template <EC_PORT_NAME PORT,
EC_PORT_PIN_NAME PIN_NAME,
EC_PIN_MODE MODE,
EC_PIN_OUTPUT_CFG OUTPUT_CONFIG,
EC_PIN_SPEED SPEED,
EC_PIN_PULL PULL,
EC_PIN_AF AF,
EC_LOCKED LOCKED,
EC_PIN_STATE_AFTER_INIT STATE_AFTER_INIT>
class pin_config_check_param : public pin_config_t {
public:
constexpr pin_config_check_param(): pin_config_t({
.port = PORT,
.pin_name = PIN_NAME,
.mode = MODE,
.output_config = OUTPUT_CONFIG,
.speed = SPEED,
.pull = PULL,
.af = AF,
.locked = LOCKED,
.state_after_init = STATE_AFTER_INIT
}) {
if (PORT == EC_PORT_NAME::A) {
static_assert(PORT >= EC_PORT_NAME::A && PORT <= EC_PORT_NAME::B, "pll_config<M> expects M between 2 and 63");
};
};
};
const pin_config_check_param<EC_PORT_NAME::A, EC_PORT_PIN_NAME::PIN_1, EC_PIN_MODE::OUTPUT, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::LOW, EC_PIN_PULL::UP, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE>led;
const constexpr pin_config_t ayplayer_global_port_pin_cfg_1[] = {
led
};
const constexpr global_port ayplayer_global_port( ayplayer_global_port_pin_cfg_1, 1 );
constexpr global_port ( const pin_config_t* const pin_cfg_array, const uint32_t pin_count );
#pragma once
#include "stm32_f20x_f21x_port.h"
/*
* Структура инициализации всех выводов порта.
*/
/*
* ADC.
*/
M_OBJ_PIN_CFG_ADC(adc_bat, EC_PORT_NAME::A, EC_PORT_PIN_NAME::PIN_0); // ADC_BAT.
M_OBJ_PIN_CFG_ADC(adc_right, EC_PORT_NAME::A, EC_PORT_PIN_NAME::PIN_4); // ADC_RIGHT.
M_OBJ_PIN_CFG_ADC(adc_left, EC_PORT_NAME::B, EC_PORT_PIN_NAME::PIN_1); // ADC_LEFT.
/*
* EXTI кнопки.
*/
const pin_config_check_param<EC_PORT_NAME::A, EC_PORT_PIN_NAME::PIN_1, EC_PIN_MODE::INPUT, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::LOW, EC_PIN_PULL::UP, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> b_v_up;
const pin_config_check_param<EC_PORT_NAME::A, EC_PORT_PIN_NAME::PIN_2, EC_PIN_MODE::INPUT, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::LOW, EC_PIN_PULL::UP, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> b_v_down;
/*
* MIDI (USART2).
*/
const pin_config_check_param<EC_PORT_NAME::A, EC_PORT_PIN_NAME::PIN_3, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::USART2, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> midi_uart_rx;
/*
* LCD (SPI1 + TIMx).
*/
const pin_config_check_param<EC_PORT_NAME::A, EC_PORT_PIN_NAME::PIN_5, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::SPI1, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> lcd_clk;
const pin_config_check_param<EC_PORT_NAME::A, EC_PORT_PIN_NAME::PIN_6, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::SPI1, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> lcd_miso;
const pin_config_check_param<EC_PORT_NAME::A, EC_PORT_PIN_NAME::PIN_7, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::SPI1, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> lcd_mosi;
const pin_config_check_param<EC_PORT_NAME::C, EC_PORT_PIN_NAME::PIN_4, EC_PIN_MODE::OUTPUT, EC_PIN_OUTPUT_CFG::PUSH_PULL, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::SET> lcd_res;
const pin_config_check_param<EC_PORT_NAME::C, EC_PORT_PIN_NAME::PIN_5, EC_PIN_MODE::OUTPUT, EC_PIN_OUTPUT_CFG::PUSH_PULL, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::RESET> lcd_dc;
const pin_config_check_param<EC_PORT_NAME::B, EC_PORT_PIN_NAME::PIN_2, EC_PIN_MODE::OUTPUT, EC_PIN_OUTPUT_CFG::PUSH_PULL, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::RESET> lcd__cs;
/*
* micro-sd (SDIO + GPIO).
*/
const pin_config_check_param<EC_PORT_NAME::A, EC_PORT_PIN_NAME::PIN_8, EC_PIN_MODE::INPUT, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::LOW, EC_PIN_PULL::UP, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> sd1_push;
const pin_config_check_param<EC_PORT_NAME::D, EC_PORT_PIN_NAME::PIN_2, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::FAST, EC_PIN_PULL::NO_USE, EC_PIN_AF::SDIO, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> sd1_smd;
const pin_config_check_param<EC_PORT_NAME::C, EC_PORT_PIN_NAME::PIN_8, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::FAST, EC_PIN_PULL::NO_USE, EC_PIN_AF::SDIO, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> sd1_d0;
const pin_config_check_param<EC_PORT_NAME::C, EC_PORT_PIN_NAME::PIN_9, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::FAST, EC_PIN_PULL::NO_USE, EC_PIN_AF::SDIO, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> sd1_d1;
const pin_config_check_param<EC_PORT_NAME::C, EC_PORT_PIN_NAME::PIN_10, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::FAST, EC_PIN_PULL::NO_USE, EC_PIN_AF::SDIO, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> sd1_d2;
const pin_config_check_param<EC_PORT_NAME::C, EC_PORT_PIN_NAME::PIN_11, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::FAST, EC_PIN_PULL::NO_USE, EC_PIN_AF::SDIO, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> sd1_d3;
const pin_config_check_param<EC_PORT_NAME::C, EC_PORT_PIN_NAME::PIN_12, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::FAST, EC_PIN_PULL::NO_USE, EC_PIN_AF::SDIO, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> sd1_clk;
/*
* USB (USB_FS + GPIO).
*/
const pin_config_check_param<EC_PORT_NAME::A, EC_PORT_PIN_NAME::PIN_9, EC_PIN_MODE::INPUT, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::LOW, EC_PIN_PULL::NO_USE, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> otg_fs_vbus;
const pin_config_check_param<EC_PORT_NAME::A, EC_PORT_PIN_NAME::PIN_11, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::HIGH, EC_PIN_PULL::NO_USE, EC_PIN_AF::OTG_FS, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> usb_dm;
const pin_config_check_param<EC_PORT_NAME::A, EC_PORT_PIN_NAME::PIN_12, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::HIGH, EC_PIN_PULL::NO_USE, EC_PIN_AF::OTG_FS, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> usb_dp;
/*
* AY (GPIO + TIM1 + SPI3)
*/
const pin_config_check_param<EC_PORT_NAME::A, EC_PORT_PIN_NAME::PIN_10, EC_PIN_MODE::OUTPUT, EC_PIN_OUTPUT_CFG::PUSH_PULL, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::RESET> bdir;
const pin_config_check_param<EC_PORT_NAME::A, EC_PORT_PIN_NAME::PIN_15, EC_PIN_MODE::OUTPUT, EC_PIN_OUTPUT_CFG::PUSH_PULL, EC_PIN_SPEED::LOW, EC_PIN_PULL::NO_USE, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::RESET> ay_1_res;
const pin_config_check_param<EC_PORT_NAME::B, EC_PORT_PIN_NAME::PIN_15, EC_PIN_MODE::OUTPUT, EC_PIN_OUTPUT_CFG::PUSH_PULL, EC_PIN_SPEED::LOW, EC_PIN_PULL::NO_USE, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::RESET> ay_2_res;
const pin_config_check_param<EC_PORT_NAME::C, EC_PORT_PIN_NAME::PIN_6, EC_PIN_MODE::OUTPUT, EC_PIN_OUTPUT_CFG::PUSH_PULL, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::RESET> bc1;
const pin_config_check_param<EC_PORT_NAME::B, EC_PORT_PIN_NAME::PIN_0, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::PUSH_PULL, EC_PIN_SPEED::FAST, EC_PIN_PULL::NO_USE, EC_PIN_AF::TIM1, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> ay_clk;
const pin_config_check_param<EC_PORT_NAME::B, EC_PORT_PIN_NAME::PIN_3, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::SPI3, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> spi_audio_clk;
const pin_config_check_param<EC_PORT_NAME::B, EC_PORT_PIN_NAME::PIN_5, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::SPI3, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> spi_audio_tx;
const pin_config_check_param<EC_PORT_NAME::B, EC_PORT_PIN_NAME::PIN_6, EC_PIN_MODE::INPUT, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::LOW, EC_PIN_PULL::NO_USE, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> shdn;
const pin_config_check_param<EC_PORT_NAME::B, EC_PORT_PIN_NAME::PIN_8, EC_PIN_MODE::OUTPUT, EC_PIN_OUTPUT_CFG::PUSH_PULL, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::RESET> spi_audio_st_reg;
const pin_config_check_param<EC_PORT_NAME::B, EC_PORT_PIN_NAME::PIN_14, EC_PIN_MODE::OUTPUT, EC_PIN_OUTPUT_CFG::PUSH_PULL, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::RESET> cs_res;
/*
* SPI клавиатура (SPI общий AY, тут только вход).
*/
const pin_config_check_param<EC_PORT_NAME::C, EC_PORT_PIN_NAME::PIN_7, EC_PIN_MODE::INPUT, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::LOW, EC_PIN_PULL::UP, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> button_in;
/*
* SWD.
*/
const pin_config_check_param<EC_PORT_NAME::A, EC_PORT_PIN_NAME::PIN_13, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::PUSH_PULL, EC_PIN_SPEED::LOW, EC_PIN_PULL::UP, EC_PIN_AF::SYS, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> swd_io;
const pin_config_check_param<EC_PORT_NAME::A, EC_PORT_PIN_NAME::PIN_14, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::PUSH_PULL, EC_PIN_SPEED::LOW, EC_PIN_PULL::DOWN, EC_PIN_AF::SYS, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> swd_clk;
/*
* PWR.
*/
const pin_config_check_param<EC_PORT_NAME::C, EC_PORT_PIN_NAME::PIN_0, EC_PIN_MODE::OUTPUT, EC_PIN_OUTPUT_CFG::PUSH_PULL, EC_PIN_SPEED::LOW, EC_PIN_PULL::NO_USE, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::RESET> on_5v;
const pin_config_check_param<EC_PORT_NAME::C, EC_PORT_PIN_NAME::PIN_1, EC_PIN_MODE::OUTPUT, EC_PIN_OUTPUT_CFG::PUSH_PULL, EC_PIN_SPEED::LOW, EC_PIN_PULL::NO_USE, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::SET> power_on;
const pin_config_check_param<EC_PORT_NAME::C, EC_PORT_PIN_NAME::PIN_14, EC_PIN_MODE::INPUT, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::LOW, EC_PIN_PULL::NO_USE, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> tp_st;
const pin_config_check_param<EC_PORT_NAME::C, EC_PORT_PIN_NAME::PIN_15, EC_PIN_MODE::INPUT, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::LOW, EC_PIN_PULL::NO_USE, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> tp_ch;
const pin_config_check_param<EC_PORT_NAME::B, EC_PORT_PIN_NAME::PIN_4, EC_PIN_MODE::OUTPUT, EC_PIN_OUTPUT_CFG::PUSH_PULL, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::RESET> ay1_on;
const pin_config_check_param<EC_PORT_NAME::B, EC_PORT_PIN_NAME::PIN_12, EC_PIN_MODE::OUTPUT, EC_PIN_OUTPUT_CFG::PUSH_PULL, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::RESET> ay2_on;
/*
* MICRO-SD SPI2 (SPI2 + GPIO).
*/
const pin_config_check_param<EC_PORT_NAME::C, EC_PORT_PIN_NAME::PIN_2, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::SPI2, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> sd2_rx;
const pin_config_check_param<EC_PORT_NAME::C, EC_PORT_PIN_NAME::PIN_3, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::SPI2, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> sd2_tx;
const pin_config_check_param<EC_PORT_NAME::B, EC_PORT_PIN_NAME::PIN_13, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::SPI2, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> sd2__clk;
const pin_config_check_param<EC_PORT_NAME::B, EC_PORT_PIN_NAME::PIN_7, EC_PIN_MODE::OUTPUT, EC_PIN_OUTPUT_CFG::PUSH_PULL, EC_PIN_SPEED::MEDIUM, EC_PIN_PULL::NO_USE, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::RESET> sd2_cs;
const pin_config_check_param<EC_PORT_NAME::B, EC_PORT_PIN_NAME::PIN_9, EC_PIN_MODE::INPUT, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::LOW, EC_PIN_PULL::UP, EC_PIN_AF::NO_USE, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> sd2_push;
/*
* BOOT-USART (USART3)
*/
const pin_config_check_param<EC_PORT_NAME::B, EC_PORT_PIN_NAME::PIN_10, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::MEDIUM,EC_PIN_PULL::NO_USE, EC_PIN_AF::USART3, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> boot_tx;
const pin_config_check_param<EC_PORT_NAME::B, EC_PORT_PIN_NAME::PIN_11, EC_PIN_MODE::AF, EC_PIN_OUTPUT_CFG::NO_USE, EC_PIN_SPEED::MEDIUM,EC_PIN_PULL::NO_USE, EC_PIN_AF::USART3, EC_LOCKED::LOCKED, EC_PIN_STATE_AFTER_INIT::NO_USE> boot_rx;
int ayplayer_port_init ( void );
#include "ayplayer_port.h"
const constexpr pin_config_t ayplayer_global_port_pin_cfg_1[] = {
adc_bat, adc_right, adc_left, // ADC.
midi_uart_rx, // MIDI (USART2).
lcd_clk, lcd_miso, lcd_mosi, lcd_res, lcd_dc, lcd__cs, // LCD (SPI1 + TIMx).
sd1_push, sd1_smd, sd1_d0, sd1_d1, sd1_d2, sd1_d3, sd1_clk, // micro-sd (SDIO + GPIO).
otg_fs_vbus, usb_dm, usb_dp, // USB (USB_FS + GPIO).
bdir, ay_1_res, ay_2_res, bc1, ay_clk, spi_audio_clk, spi_audio_tx, shdn, spi_audio_st_reg, cs_res, // AY (GPIO + TIM1 + SPI3)
button_in, // SPI клавиатура (SPI общий AY, тут только вход).
swd_io, swd_clk, // SWD.
on_5v, power_on, tp_st, tp_ch, ay1_on, ay2_on, // PWR.
sd2_rx, sd2_tx, sd2__clk, sd2_cs, sd2_push, // MICRO-SD SPI2 (SPI2 + GPIO).
boot_tx, boot_rx // BOOT-USART (USART3).
};
const constexpr global_port ayplayer_global_port( ayplayer_global_port_pin_cfg_1, M_SIZE_ARRAY(ayplayer_global_port_pin_cfg_1) );
int ayplayer_port_init ( void ) {
return ( ayplayer_global_port.reinit_all_ports() == E_ANSWER_GP::SUCCESS )?0:-1;
}