Шаблон проекта с моей расширенной библиотекой MyLibs

This commit is contained in:
2025-12-25 10:36:35 +03:00
commit c6e1dc049f
69 changed files with 40782 additions and 0 deletions

149
Core/App/gpio.h Normal file
View File

@@ -0,0 +1,149 @@
/*==============================================================================
* Конфигурация портов с использованием бибилотеки PLIB035
*------------------------------------------------------------------------------
* ЦНИИ СЭТ, Разваляев Алексей <wot890089@mail.ru>
*==============================================================================
* Реализация функций инициализации портов находится в gpio.c
* ЦНИИ СЭТ
*==============================================================================
*/
#ifndef __GPIO_H
#define __GPIO_H
//-- Includes ------------------------------------------------------------------
#include "main.h"
//-- Defines -------------------------------------------------------------------
// Дефайны для режима пина OutEnable, AltFuncEnable, DigitalEnable
#define GPIO_PinMode_Unused DISABLE, DISABLE, DISABLE
#define GPIO_PinMode_Input DISABLE, DISABLE, ENABLE
#define GPIO_PinMode_Output ENABLE, DISABLE, ENABLE
#define GPIO_PinMode_AltFunc DISABLE, ENABLE, ENABLE
//#define GPIO_PinMode_Analog DISABLE, DISABLE, DISABLE
static GPIO_Init_TypeDef gpioa_config[] = {
// Пин, Режим, Выходной режим, Входной режим, Подтяжка, Нагрузка/Скорость
{ GPIO_Pin_0, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_1, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_2, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_3, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_4, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_5, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_6, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_7, GPIO_PinMode_Output, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_8, GPIO_PinMode_Output, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_9, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_10, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_11, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_12, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_13, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_14, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_15, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
};
static GPIO_Init_TypeDef gpiob_config[] = {
{ GPIO_Pin_0, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_1, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_2, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_3, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_4, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_5, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_6, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_7, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_8, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_9, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_10, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_11, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_12, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_13, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_14, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
{ GPIO_Pin_15, GPIO_PinMode_Unused, GPIO_OutMode_PP, GPIO_InMode_Schmitt, GPIO_PullMode_Disable, GPIO_DriveMode_HighFast },
};
// Другой вариант
//#define GPIO_OUT_PP_PA_PINS /* GPIO_Pin_0 | */ \
// /* GPIO_Pin_1 | */ \
// /* GPIO_Pin_2 | */ \
// /* GPIO_Pin_3 | */ \
// /* GPIO_Pin_4 | */ \
// /* GPIO_Pin_5 | */ \
// /* GPIO_Pin_6 | */ \
// GPIO_Pin_7 | \
// GPIO_Pin_8 | \
// /* GPIO_Pin_9 | */ \
// /* GPIO_Pin_10 | */ \
// /* GPIO_Pin_11 | */ \
// /* GPIO_Pin_12 | */ \
// /* GPIO_Pin_13 | */ \
// /* GPIO_Pin_14 | */ \
// /* GPIO_Pin_15 | */ \
// 0
//#define GPIO_OUT_PP_PB_PINS /* GPIO_Pin_0 | */ \
// /* GPIO_Pin_1 | */ \
// /* GPIO_Pin_2 | */ \
// /* GPIO_Pin_3 | */ \
// /* GPIO_Pin_4 | */ \
// /* GPIO_Pin_5 | */ \
// /* GPIO_Pin_6 | */ \
// /* GPIO_Pin_7 | */ \
// /* GPIO_Pin_8 | */ \
// /* GPIO_Pin_9 | */ \
// /* GPIO_Pin_10 | */ \
// /* GPIO_Pin_11 | */ \
// /* GPIO_Pin_12 | */ \
// /* GPIO_Pin_13 | */ \
// /* GPIO_Pin_14 | */ \
// /* GPIO_Pin_15 | */ \
// 0
//
//
//#define GPIO_OUT_OD_PA_PINS /* GPIO_Pin_0 | */ \
// /* GPIO_Pin_1 | */ \
// /* GPIO_Pin_2 | */ \
// /* GPIO_Pin_3 | */ \
// /* GPIO_Pin_4 | */ \
// /* GPIO_Pin_5 | */ \
// /* GPIO_Pin_6 | */ \
// /* GPIO_Pin_7 | */ \
// /* GPIO_Pin_8 | */ \
// /* GPIO_Pin_9 | */ \
// /* GPIO_Pin_10 | */ \
// /* GPIO_Pin_11 | */ \
// /* GPIO_Pin_12 | */ \
// /* GPIO_Pin_13 | */ \
// /* GPIO_Pin_14 | */ \
// /* GPIO_Pin_15 | */ \
// 0
//
//#define GPIO_OUT_OD_PB_PINS /* GPIO_Pin_0 | */ \
// /* GPIO_Pin_1 | */ \
// /* GPIO_Pin_2 | */ \
// /* GPIO_Pin_3 | */ \
// /* GPIO_Pin_4 | */ \
// /* GPIO_Pin_5 | */ \
// /* GPIO_Pin_6 | */ \
// /* GPIO_Pin_7 | */ \
// /* GPIO_Pin_8 | */ \
// /* GPIO_Pin_9 | */ \
// /* GPIO_Pin_10 | */ \
// /* GPIO_Pin_11 | */ \
// /* GPIO_Pin_12 | */ \
// /* GPIO_Pin_13 | */ \
// /* GPIO_Pin_14 | */ \
// /* GPIO_Pin_15 | */ \
// 0
//-- Exported functions prototypes ---------------------------------------------
void gpio_init(void);
#endif /*__GPIO_H*/