Cześć,
Próbuje przeanalizować kod linia po linii i się czegoś nauczyć. Do pełni szczęścia potrzebuje pomocy.
W funkcji pojawia się dla mnie magiczne (GPIO_PinState). I tu nie rozumiem co się dzieje od strony języka c.
Prawy nawias jest dla mnie zrozumiały, ale (GPIO_PinState)(nibbleToWrite & 0x01) w całości już nie.
Nie daje mi to spokoju.
typedef enum
{
GPIO_PIN_RESET = 0U,
GPIO_PIN_SET
} GPIO_PinState;
void LCD_WriteNibble(char nibbleToWrite)
{
HAL_GPIO_WritePin(LCD_GPIO, LCD_EN, GPIO_PIN_SET);
HAL_GPIO_WritePin(LCD_GPIO, LCD_D4, (GPIO_PinState)(nibbleToWrite & 0x01));
HAL_GPIO_WritePin(LCD_GPIO, LCD_D5, (GPIO_PinState)(nibbleToWrite & 0x02));
HAL_GPIO_WritePin(LCD_GPIO, LCD_D6, (GPIO_PinState)(nibbleToWrite & 0x04));
HAL_GPIO_WritePin(LCD_GPIO, LCD_D7, (GPIO_PinState)(nibbleToWrite & 0x08));
HAL_GPIO_WritePin(LCD_GPIO, LCD_EN, GPIO_PIN_RESET);
}