stm32 lcd图片显示

全局变量  定义图片数组
const unsigned char gImage_1[32776] = { 0X00,0X10,0X80,0X00,0X80,0X00,0X01,0X1B,
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_USART1_UART_Init();
  MX_TIM3_Init();
  /* USER CODE BEGIN 2 */
	HAL_TIM_Base_Start_IT(&htim3);
	HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);
	__HAL_TIM_SET_COMPARE(&htim3, TIM_CHANNEL_3, 50);
	Lcd_Init();           //lcd³õʼ»¯
	Lcd_Clear(BLUE);      //lcdÇåÆÁÏÔʾÀ¶É«
	showimage(gImage_1);  //lcdÏÔʾͼƬ
  /* USER CODE END 2 */

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

  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */
		
		/*uint8_t data = 0;
		HAL_UART_Receive(&huart1, &data, 1, 0);
		
		if(data == 'l')
		{
			HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2, GPIO_PIN_RESET);
			HAL_UART_Transmit(&huart1, &data, 1, 0);
		}
		else if(data == 'h')
		{
			HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2, GPIO_PIN_SET);
			HAL_UART_Transmit(&huart1, &data, 1, 0);
		}		*/	
		
		int j;	
		for(j=100;j>=50;j--)
		{
			__HAL_TIM_SET_COMPARE(&htim3, TIM_CHANNEL_3, j);
			HAL_Delay(15);
		}
		for(j=50;j<=100;j++)
		{
			__HAL_TIM_SET_COMPARE(&htim3, TIM_CHANNEL_3, j);
			HAL_Delay(15);
		}
			
		
  }
  /* USER CODE END 3 */

}


你可能感兴趣的:(stm32)