Ja ich denke schon:

Main.c
Code:
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32f1xx_hal.h"

/* USER CODE BEGIN Includes */
#include "string.h"
#include <stdio.h>

#include <stdarg.h>
#include <u8g_arm.h>

/* USER CODE BEGIN PV */
/* Private variables ---------------------------------------------------------*/
uint8_t outbuffer[2]={0x40,0xff};

//Display
static u8g_t u8g;

....

int main(void)
{

  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* Configure the system clock */
  SystemClock_Config();

  /* USER CODE BEGIN SysInit */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_ADC1_Init();
  MX_I2C1_Init();

  /* USER CODE BEGIN 2 */
  DisplayInit();
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */
    //SSD1307
    //Slave Adress vom Display = 3C
    //Display Ansteuerung:

 HAL_I2C_Master_Transmit(&hi2c1, 0x3C, outbuffer, sizeof(outbuffer), 1);

   //   u8g_SetFont(&u8g,u8g_font_04b_03b);//set current font
   //   u8g_DrawStr(&u8g, 2, 12, "Hallo!");//write string - you set coordinates and string
   //   u8g_DrawBox(&u8g, 30, 30, 35, 35);//draw some box


/*        while(HAL_I2C_Master_Transmit(&hi2c1, 0x3C,(uint8_t*) outbuffer, sizeof(outbuffer), (uint32_t)1000)!= HAL_OK)
      {
                      if (HAL_I2C_GetError(&hi2c1) != HAL_I2C_ERROR_AF)
                      {
                      //  HAL_printf("i2C Error\n\r");
                        GPIOA -> ODR ^= LD2_Pin;
                      }
      }

    while (HAL_I2C_GetState(&hi2c1) != HAL_I2C_STATE_READY)
                    {

                    }
*/


 GPIOA -> ODR ^= LD2_Pin;
    HAL_Delay(2000);
  }
  /* USER CODE END 3 */

}

/* I2C1 init function */
static void MX_I2C1_Init(void)
{

  hi2c1.Instance = I2C1;
  hi2c1.Init.ClockSpeed = 100000;
  hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_2;
  hi2c1.Init.OwnAddress1 = 0;
  hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
  hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
  hi2c1.Init.OwnAddress2 = 0;
  hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
  hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
  if (HAL_I2C_Init(&hi2c1) != HAL_OK)
  {
    _Error_Handler(__FILE__, __LINE__);
  }

}
stm32f1xx_hal_msp.c
void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c)
{

GPIO_InitTypeDef GPIO_InitStruct;
if(hi2c->Instance==I2C1)
{
/* USER CODE BEGIN I2C1_MspInit 0 */

/* USER CODE END I2C1_MspInit 0 */

/**I2C1 GPIO Configuration
PB6 ------> I2C1_SCL
PB7 ------> I2C1_SDA
*/

GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

/* Peripheral clock enable */
__HAL_RCC_I2C1_CLK_ENABLE();

/* USER CODE BEGIN I2C1_MspInit 1 */

/* USER CODE END I2C1_MspInit 1 */
}

}