hi, I am trying to use it in the same pin for two different purposes. I'm setting 4 pins for SPI comm and after I finish using them as SPIpins I need them as normal gpio. I tried to toggle them with set and reset but didn't go so well. what should I
for exmple, this is a part of the code:
void DAC_AD5621_Write ( uint64_t DAC_Data)
{
HAL_GPIO_WritePin(dac_cs_GPIO_Port, dac_cs_Pin, GPIO_PIN_RESET);////Select SPI
DAC_Data = (DAC_Data&0x0FFF)<<2 ;
uint8_t DAC_Data1= (uint8_t)((DAC_Data>>8)&0x00FF);
uint8_t DAC_Data2= (uint8_t)(DAC_Data&0x00FF);
HAL_SPI_Transmit(&hspi1,DAC_Data1,10,100);
HAL_SPI_Transmit(&hspi1,DAC_Data2,10,100);
HAL_GPIO_WritePin(dac_cs_GPIO_Port, dac_cs_Pin, GPIO_PIN_SET);//Deselect SPI
}
while (1)
{
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5,GPIO_PIN_RESET);
delay_1u(10);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5,GPIO_PIN_SET);
}