24 lines
604 B
C
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;}
|
|
} |