"convert" STM32 I2C to arduino I2C

Ok, newby to Arduino I2C, my question is this, I have a simple function from an STM32 project that initializes an LCD driver...like this...

void LCD_Driver_Init(void)
{
  uint8_t data[2];

  data[0] = 0x80;     // Command byte to be sent next
  data[1] = 0xC9;     // Command byte = [7:4] - fixed, [3] En, [2] X - N/A to static disp, [1:0] 01 - Static 

  HAL_I2C_Master_Transmit(&hi2c1, display_Addr, data, 2, 100);
  
}

My question is how would you do

 HAL_I2C_Master_Transmit(&hi2c1, display_Addr, data, 2, 100);

but useing the arduino method of Wire.write etc.

Thanks

Joe

So you have picked the STM32 board that you will be using in board manager. You will want to have one of these printed out. I make lots of notes on mine.

. Finally, using the code you did not post, adjust your pins to corrospond to either the STM32 pinout numbers; such as PB6 or, if those don't work, use the pin number.

Hi,

it's not the pin numbers that's the issue for me, I was asking if anyone knew how to send the data in the code posted

 HAL_I2C_Master_Transmit(&hi2c1, display_Addr, data, 2, 100);

but send it using Wire.write...rather than...

 HAL_I2C_Master_Transmit

STM32 I2C Tutorial: How to use I2C Communication in STM32F103C8 Microcontroller Found by using the words "stm32 using wire" in a internet search engine.

Thanks I shall have a read!

:slight_smile: