Files
AC-Controller/STM32_2021-1-15/Device/interface_595.c
T
kevin c70a004b2a 添加MDK工程
程序存在一个问题:开机没有自检
添加立创PCB

Signed-off-by: kevin <kevin@lmve.net>
2021-03-12 04:45:11 +08:00

24 lines
604 B
C

#include "interface_595.h"
void ds_in_or_out(char a)//0in 1out //ÔOÖÃÒýÄ_Ý”ÈëÝ”³ö
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
GPIO_InitStruct.Pin = HC595_DS_Pin;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
if(a==0)
{
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
}
if(a==1)
{
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
}
HAL_GPIO_Init(HC595_DS_GPIO_Port, &GPIO_InitStruct);
}
uint8_t Read_Ds()
{
ds_in_or_out(0);
if(read_hc595_ds){return 0;}else{return 1;}
}