2015-02-14 12:31 PM
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 !2015-02-17 12:05 AM
And what's wrong with the documentation?
This is what I read in STM32F417xx_User_Manual.chm under Modules->GPIO->GPIO Exported Functions->IO operation functions->Functions->HAL_GPIO_WritePin. IMO, it's crystal clear:
void ( GPIO_TypeDef * GPIOx,
uint16_t GPIO_Pin,
PinState
)
Sets or clears the selected data port bit.
Note:
This function uses GPIOx_BSRR register to allow atomic read/modify accesses. In this way, there is no risk of an IRQ occurring between the read and the modify access.Parameters:
GPIOx,: where x can be (A..K) to select the GPIO peripheral for STM32F429X device or x can be (A..I) to select the GPIO peripheral for STM32F40XX and STM32F427X devices.
GPIO_Pin,: specifies the port bit to be written. This parameter can be one of GPIO_PIN_x where x can be (0..15).
PinState,: specifies the value to be written to the selected bit. This parameter can be one of the GPIO_PinState enum values:
Return values:
None
Definition at line of file .
2015-02-18 3:09 PM
Thanks for the reply
2015-02-18 9:54 PM
Isn't this an eye-opener experience for you? Why do you stick to using a ''library'' with all its implications and overhead for something that really ought to be a simple macro?
JW