DO输出初始化默认低电平
This commit is contained in:
parent
f024bf625f
commit
75e2c0c116
|
@ -22,18 +22,17 @@
|
|||
#define __GPIO_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
/* USER CODE BEGIN Private defines */
|
||||
typedef enum
|
||||
{
|
||||
DI_1,
|
||||
|
@ -53,16 +52,17 @@ extern "C"
|
|||
DO_EN,
|
||||
DO_MAX,
|
||||
} gpio_do_e;
|
||||
/* USER CODE END Private defines */
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_GPIO_Init(void);
|
||||
void MX_GPIO_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
extern void gpio_do_test(uint8_t gpio_num, GPIO_PinState state);
|
||||
extern GPIO_PinState gpio_di_test(uint8_t gpio_num);
|
||||
/* USER CODE END Prototypes */
|
||||
/* USER CODE END Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /*__ GPIO_H__ */
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
* Output
|
||||
* EVENT_OUT
|
||||
* EXTI
|
||||
*/
|
||||
*/
|
||||
void MX_GPIO_Init(void)
|
||||
{
|
||||
|
||||
|
@ -56,22 +56,24 @@ void MX_GPIO_Init(void)
|
|||
HAL_GPIO_WritePin(ETH_RESET_GPIO_Port, ETH_RESET_Pin, GPIO_PIN_SET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOB, LED3_R_Pin | LED3_G_Pin | DAC1_CS_Pin | DAC2_CS_Pin, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(GPIOB, LED3_R_Pin|LED3_G_Pin|DAC1_CS_Pin|DAC2_CS_Pin, GPIO_PIN_SET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOE, LED3_Y_Pin | LED2_R_Pin | LED2_G_Pin | LED2_Y_Pin | ADC_CS_Pin | AD7124_SYNC_Pin, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(GPIOE, LED3_Y_Pin|LED2_R_Pin|LED2_G_Pin|LED2_Y_Pin
|
||||
|ADC_CS_Pin|AD7124_SYNC_Pin, GPIO_PIN_SET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOD, DO_CH4_Pin | DO_CH3_Pin | DO_CH1_Pin | DO_CH2_Pin | DO_EN_Pin | HART1_RTS_Pin | HART2_RTS_Pin, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(GPIOD, DO_CH4_Pin|DO_CH3_Pin|DO_CH1_Pin|DO_CH2_Pin
|
||||
|HART2_RST_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOD, DO_EN_Pin|HART1_RTS_Pin|HART2_RTS_Pin, GPIO_PIN_SET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(HART1_RST_GPIO_Port, HART1_RST_Pin, GPIO_PIN_SET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(HART2_RST_GPIO_Port, HART2_RST_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pins : PEPin PEPin */
|
||||
GPIO_InitStruct.Pin = DI_CH5_Pin | DI_CH6_Pin;
|
||||
GPIO_InitStruct.Pin = DI_CH5_Pin|DI_CH6_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||
|
@ -84,35 +86,35 @@ void MX_GPIO_Init(void)
|
|||
HAL_GPIO_Init(ETH_RESET_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PBPin PBPin */
|
||||
GPIO_InitStruct.Pin = LED3_R_Pin | LED3_G_Pin;
|
||||
GPIO_InitStruct.Pin = LED3_R_Pin|LED3_G_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PEPin PEPin PEPin PEPin */
|
||||
GPIO_InitStruct.Pin = LED3_Y_Pin | LED2_R_Pin | LED2_G_Pin | LED2_Y_Pin;
|
||||
GPIO_InitStruct.Pin = LED3_Y_Pin|LED2_R_Pin|LED2_G_Pin|LED2_Y_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
|
||||
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PDPin PDPin PDPin PDPin */
|
||||
GPIO_InitStruct.Pin = DO_CH4_Pin | DO_CH3_Pin | DO_CH1_Pin | DO_CH2_Pin;
|
||||
GPIO_InitStruct.Pin = DO_CH4_Pin|DO_CH3_Pin|DO_CH1_Pin|DO_CH2_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PDPin PDPin PDPin PDPin */
|
||||
GPIO_InitStruct.Pin = DO_EN_Pin | HART1_RTS_Pin | HART2_RTS_Pin | HART2_RST_Pin;
|
||||
GPIO_InitStruct.Pin = DO_EN_Pin|HART1_RTS_Pin|HART2_RTS_Pin|HART2_RST_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PCPin PCPin */
|
||||
GPIO_InitStruct.Pin = DI_CH1_Pin | DI_CH2_Pin;
|
||||
GPIO_InitStruct.Pin = DI_CH1_Pin|DI_CH2_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
@ -125,19 +127,19 @@ void MX_GPIO_Init(void)
|
|||
HAL_GPIO_Init(HART1_RST_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PAPin PAPin */
|
||||
GPIO_InitStruct.Pin = DI_CH3_Pin | DI_CH4_Pin;
|
||||
GPIO_InitStruct.Pin = DI_CH3_Pin|DI_CH4_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PDPin PDPin */
|
||||
GPIO_InitStruct.Pin = HART1_OCD_Pin | HART2_OCD_Pin;
|
||||
GPIO_InitStruct.Pin = HART1_OCD_Pin|HART2_OCD_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PBPin PBPin */
|
||||
GPIO_InitStruct.Pin = DAC1_CS_Pin | DAC2_CS_Pin;
|
||||
GPIO_InitStruct.Pin = DAC1_CS_Pin|DAC2_CS_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
|
@ -163,6 +165,7 @@ void MX_GPIO_Init(void)
|
|||
|
||||
HAL_NVIC_SetPriority(EXTI3_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(EXTI3_IRQn);
|
||||
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
|
|
@ -98,6 +98,7 @@ int main(void)
|
|||
|
||||
/* USER CODE END Init */
|
||||
|
||||
|
||||
/* Configure the system clock */
|
||||
SystemClock_Config();
|
||||
|
||||
|
@ -177,7 +178,8 @@ void SystemClock_Config(void)
|
|||
|
||||
/** Initializes the CPU, AHB and APB buses clocks
|
||||
*/
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
|
||||
|
@ -268,8 +270,7 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
|
|||
/* USER CODE BEGIN Callback 0 */
|
||||
|
||||
/* USER CODE END Callback 0 */
|
||||
if (htim->Instance == TIM1)
|
||||
{
|
||||
if (htim->Instance == TIM1) {
|
||||
HAL_IncTick();
|
||||
}
|
||||
/* USER CODE BEGIN Callback 1 */
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
// File: STM32F405_415_407_417_427_437_429_439.dbgconf
|
||||
// Version: 1.0.0
|
||||
// Note: refer to STM32F405/415 STM32F407/417 STM32F427/437 STM32F429/439 reference manual (RM0090)
|
||||
// refer to STM32F40x STM32F41x datasheets
|
||||
// refer to STM32F42x STM32F43x datasheets
|
||||
|
||||
// <<< Use Configuration Wizard in Context Menu >>>
|
||||
|
||||
// <h> Debug MCU configuration register (DBGMCU_CR)
|
||||
// <o.2> DBG_STANDBY <i> Debug Standby Mode
|
||||
// <o.1> DBG_STOP <i> Debug Stop Mode
|
||||
// <o.0> DBG_SLEEP <i> Debug Sleep Mode
|
||||
// </h>
|
||||
DbgMCU_CR = 0x00000007;
|
||||
|
||||
// <h> Debug MCU APB1 freeze register (DBGMCU_APB1_FZ)
|
||||
// <i> Reserved bits must be kept at reset value
|
||||
// <o.26> DBG_CAN2_STOP <i> CAN2 stopped when core is halted
|
||||
// <o.25> DBG_CAN1_STOP <i> CAN2 stopped when core is halted
|
||||
// <o.23> DBG_I2C3_SMBUS_TIMEOUT <i> I2C3 SMBUS timeout mode stopped when core is halted
|
||||
// <o.22> DBG_I2C2_SMBUS_TIMEOUT <i> I2C2 SMBUS timeout mode stopped when core is halted
|
||||
// <o.21> DBG_I2C1_SMBUS_TIMEOUT <i> I2C1 SMBUS timeout mode stopped when core is halted
|
||||
// <o.12> DBG_IWDG_STOP <i> Independent watchdog stopped when core is halted
|
||||
// <o.11> DBG_WWDG_STOP <i> Window watchdog stopped when core is halted
|
||||
// <o.10> DBG_RTC_STOP <i> RTC stopped when core is halted
|
||||
// <o.8> DBG_TIM14_STOP <i> TIM14 counter stopped when core is halted
|
||||
// <o.7> DBG_TIM13_STOP <i> TIM13 counter stopped when core is halted
|
||||
// <o.6> DBG_TIM12_STOP <i> TIM12 counter stopped when core is halted
|
||||
// <o.5> DBG_TIM7_STOP <i> TIM7 counter stopped when core is halted
|
||||
// <o.4> DBG_TIM6_STOP <i> TIM6 counter stopped when core is halted
|
||||
// <o.3> DBG_TIM5_STOP <i> TIM5 counter stopped when core is halted
|
||||
// <o.2> DBG_TIM4_STOP <i> TIM4 counter stopped when core is halted
|
||||
// <o.1> DBG_TIM3_STOP <i> TIM3 counter stopped when core is halted
|
||||
// <o.0> DBG_TIM2_STOP <i> TIM2 counter stopped when core is halted
|
||||
// </h>
|
||||
DbgMCU_APB1_Fz = 0x00000000;
|
||||
|
||||
// <h> Debug MCU APB2 freeze register (DBGMCU_APB2_FZ)
|
||||
// <i> Reserved bits must be kept at reset value
|
||||
// <o.18> DBG_TIM11_STOP <i> TIM11 counter stopped when core is halted
|
||||
// <o.17> DBG_TIM10_STOP <i> TIM10 counter stopped when core is halted
|
||||
// <o.16> DBG_TIM9_STOP <i> TIM9 counter stopped when core is halted
|
||||
// <o.1> DBG_TIM8_STOP <i> TIM8 counter stopped when core is halted
|
||||
// <o.0> DBG_TIM1_STOP <i> TIM1 counter stopped when core is halted
|
||||
// </h>
|
||||
DbgMCU_APB2_Fz = 0x00000000;
|
||||
|
||||
// <<< end of configuration section >>>
|
File diff suppressed because one or more lines are too long
|
@ -339,7 +339,7 @@
|
|||
<MiscControls></MiscControls>
|
||||
<Define>USE_HAL_DRIVER,STM32F407xx</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>../Core/Inc;../LWIP/App;../LWIP/Target;../Middlewares/Third_Party/LwIP/src/include;../Middlewares/Third_Party/LwIP/system;../Drivers/STM32F4xx_HAL_Driver/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy;../Middlewares/Third_Party/FreeRTOS/Source/include;../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS;../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F;../Drivers/BSP/Components/lan8742;../Middlewares/Third_Party/LwIP/src/include/netif/ppp;../Drivers/CMSIS/Device/ST/STM32F4xx/Include;../Middlewares/Third_Party/LwIP/src/include/lwip;../Middlewares/Third_Party/LwIP/src/include/lwip/apps;../Middlewares/Third_Party/LwIP/src/include/lwip/priv;../Middlewares/Third_Party/LwIP/src/include/lwip/prot;../Middlewares/Third_Party/LwIP/src/include/netif;../Middlewares/Third_Party/LwIP/src/include/compat/posix;../Middlewares/Third_Party/LwIP/src/include/compat/posix/arpa;../Middlewares/Third_Party/LwIP/src/include/compat/posix/net;../Middlewares/Third_Party/LwIP/src/include/compat/posix/sys;../Middlewares/Third_Party/LwIP/src/include/compat/stdc;../Middlewares/Third_Party/LwIP/system/arch;../Drivers/CMSIS/Include;..\User\application\inc;..\User\board\inc;..\User\driver;..\User\system</IncludePath>
|
||||
<IncludePath>../Core/Inc;../LWIP/App;../LWIP/Target;../Middlewares/Third_Party/LwIP/src/include;../Middlewares/Third_Party/LwIP/system;../Drivers/STM32F4xx_HAL_Driver/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy;../Middlewares/Third_Party/FreeRTOS/Source/include;../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS;../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F;../Drivers/BSP/Components/lan8742;../Middlewares/Third_Party/LwIP/src/include/netif/ppp;../Drivers/CMSIS/Device/ST/STM32F4xx/Include;../Middlewares/Third_Party/LwIP/src/include/lwip;../Middlewares/Third_Party/LwIP/src/include/lwip/apps;../Middlewares/Third_Party/LwIP/src/include/lwip/priv;../Middlewares/Third_Party/LwIP/src/include/lwip/prot;../Middlewares/Third_Party/LwIP/src/include/netif;../Middlewares/Third_Party/LwIP/src/include/compat/posix;../Middlewares/Third_Party/LwIP/src/include/compat/posix/arpa;../Middlewares/Third_Party/LwIP/src/include/compat/posix/net;../Middlewares/Third_Party/LwIP/src/include/compat/posix/sys;../Middlewares/Third_Party/LwIP/src/include/compat/stdc;../Middlewares/Third_Party/LwIP/system/arch;../Drivers/CMSIS/Include;../User/application/inc;../User/board/inc;../User/driver;../User/system</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
[EXTDLL]
|
||||
Count=0
|
|
@ -403,25 +403,25 @@ PD11.GPIO_Label=DO_CH4
|
|||
PD11.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_PP
|
||||
PD11.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
|
||||
PD11.Locked=true
|
||||
PD11.PinState=GPIO_PIN_SET
|
||||
PD11.PinState=GPIO_PIN_RESET
|
||||
PD11.Signal=GPIO_Output
|
||||
PD12.GPIOParameters=GPIO_Speed,PinState,GPIO_Label
|
||||
PD12.GPIO_Label=DO_CH3
|
||||
PD12.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
|
||||
PD12.Locked=true
|
||||
PD12.PinState=GPIO_PIN_SET
|
||||
PD12.PinState=GPIO_PIN_RESET
|
||||
PD12.Signal=GPIO_Output
|
||||
PD13.GPIOParameters=GPIO_Speed,PinState,GPIO_Label
|
||||
PD13.GPIO_Label=DO_CH1
|
||||
PD13.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
|
||||
PD13.Locked=true
|
||||
PD13.PinState=GPIO_PIN_SET
|
||||
PD13.PinState=GPIO_PIN_RESET
|
||||
PD13.Signal=GPIO_Output
|
||||
PD14.GPIOParameters=GPIO_Speed,PinState,GPIO_Label
|
||||
PD14.GPIO_Label=DO_CH2
|
||||
PD14.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
|
||||
PD14.Locked=true
|
||||
PD14.PinState=GPIO_PIN_SET
|
||||
PD14.PinState=GPIO_PIN_RESET
|
||||
PD14.Signal=GPIO_Output
|
||||
PD15.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label
|
||||
PD15.GPIO_Label=DO_EN
|
||||
|
|
Loading…
Reference in New Issue