5_STM32cubeIDE_設置代碼優化等級,設置Debug水平和github簡單代碼託管,IIC

1_設置代碼優化等級


2_設置Debug水平和github簡單代碼託管


設置Debug水平 git

github簡單代碼託管
請參考這個視頻github

3_IIC


3.1_OLED顯示

請參考這個視頻
github.com/modi12jin/S…bash

fonts.c
fonts.h
ssd1306.c
ssd1306.happ

/* Includes ------------------------------------------------------------------*/
#include "main.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "fonts.h"
#include "ssd1306.h"
/* USER CODE END Includes */

/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */

/* USER CODE END PTD */

/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */

/* USER CODE END PD */

/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */

/* USER CODE END PM */

/* Private variables ---------------------------------------------------------*/
I2C_HandleTypeDef hi2c1;

/* USER CODE BEGIN PV */

/* USER CODE END PV */

/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_I2C1_Init(void);
/* USER CODE BEGIN PFP */

/* USER CODE END PFP */

/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */

/* USER CODE END 0 */

/**
  * @brief  The application entry point.
  * @retval int
  */
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_I2C1_Init();
  /* USER CODE BEGIN 2 */

  SSD1306_Init();  // initialise

    SSD1306_GotoXY (0,0);
    SSD1306_Puts ("HAL_OLED", &Font_11x18, 1);
    SSD1306_GotoXY (0,20);
    SSD1306_Puts ("cubeIDE", &Font_11x18, 1);
    SSD1306_GotoXY (0,40);
    SSD1306_Puts ("stm32f103c8", &Font_11x18, 1);
    SSD1306_UpdateScreen(); //display
  /* USER CODE END 2 */

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

    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}
複製代碼

相關文章
相關標籤/搜索