AnsweredAssumed Answered

GPIO_WriteBit() in HAL ??? (32f407)

Question asked by nazarov.aleksey on Feb 14, 2015
Latest reply on Feb 19, 2015 by waclawek.jan
Hi there!

Who knows how to implement the function of GPIO SPL -
GPIO_WriteBit (GPIO_TypeDef * GPIOx, uint16_t GPIO_Pin, BitAction BitVal)

on the library HAL?

In the HAL library
I can see only
HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)

:(
-----------------------------------------
If you can
- Give a short example PLEASE !


I need this, for
programming character LCD 16x2 (KS 0066 or Equivalent HD4478)

On the SPL I did like this :

(in lcd.h)
#define DB0(a)        GPIO_WriteBit(DB0_PORT, DB0_PIN, (BitAction)a)
#define DB1(a)        GPIO_WriteBit(DB1_PORT, DB1_PIN, (BitAction)a)
#define DB2(a)        GPIO_WriteBit(DB2_PORT, DB2_PIN, (BitAction)a)
etc

(in lcd.c)

void LCD_Set_Data(uint8_t data)
{
    if ( ((data >> 7)&0x01) == 1 ) {DB7(1);} else {DB7(0);}
    if ( ((data >> 6)&0x01) == 1 ) {DB6(1);} else {DB6(0);}            
    if ( ((data >> 5)&0x01) == 1 ) {DB5(1);} else {DB5(0);}
    if ( ((data >> 4)&0x01) == 1 ) {DB4(1);} else {DB4(0);}
    if ( ((data >> 3)&0x01) == 1 ) {DB3(1);} else {DB3(0);}
    if ( ((data >> 2)&0x01) == 1 ) {DB2(1);} else {DB2(0);}
    if ( ((data >> 1)&0x01) == 1 ) {DB1(1);} else {DB1(0);}
    if ( ((data >> 0)&0x01) == 1 ) {DB0(1);} else {DB0(0);}   
}


================================================

maybe me need
insert ready function
GPIO_WriteBit from stm32f4xx_gpio.c (SPL)
to stm32f4xx_hal_gpio.c ??? (HAL)     :))

But I want to do like that on the new (fully only on HAL!)

Help me please !

Outcomes