Hello I have a problem STM32 . In my library I wrote for eeprom, I want to use the pins and ports in the struct and then use them in the HAL_GPIO_Write_Pin function, but I could not succeed. ERROR: incompatible type for argument 2 of 'HAL_GPIO_WritePin' Eeprom.
(Sorry if I didn't ask the question properly, it's my first time using it.)
EEPROM.h
typedef struct
{
SPI_HandleTypeDef* SPI_EEPROM ;
uint16_t CS_PIN ;
GPIO_TypeDef* CS_PORT ;
uint32_t Write_Protect ;
GPIO_PinState CS_LOW ;
GPIO_PinState CS_HIGH ;
}EEPROM;
/*****************************************************************/
EEPROM.c
SPI_HandleTypeDef* hspi1 ;
EEPROM EEPROM_1 ;
void Eeprom_Init( )
{
EEPROM_1.SPI_EEPROM = hspi1 ;
EEPROM_1.Write_Protect = EEPROM_WRITE ;
EEPROM_1.CS_PIN = SPI2_SS_Pin ;
EEPROM_1.CS_PORT = SPI2_SS_GPIO_Port ;
EEPROM_1.CS_LOW = GPIO_PIN_RESET ;
EEPROM_1.CS_HIGH = GPIO_PIN_SET ;
}
void EEPROM_1_CS_HIGH (EEPROM CS_PORT, EEPROM CS_PIN, EEPROM CS_HIGH)
{
HAL_GPIO_WritePin( &CS_PORT, CS_PIN, CS_HIGH ) ;
}
void EEPROM_1_CS_LOW (EEPROM CS_PORT, EEPROM CS_PIN, EEPROM CS_LOW)
{
HAL_GPIO_WritePin( &CS_PORT, CS_PIN, CS_LOW ) ;
}