u8g2_template_stm32f103c8t6
u8g2_template_stm32f103c8t6 copied to clipboard
Printing things to the lcd
Hey nikola-v,
I am using your library or downloaded it from your github and it does not print when I try to use it in STM32cubeIDE. I am trying to print a simple line and box.
Have you come across this issue? If you have, could you let me know how to solve it?
I think I am using it correctly. I will send you sample code to demonstrate how I am using it (my main loop):
int main(void) { /* USER CODE BEGIN 1 / u8g2_t u8g2; / USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
HAL_ACC_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_USART2_UART_Init();
MX_I2C1_Init();
MX_SPI1_Init();
MX_I2C3_Init();
/* USER CODE BEGIN 2 */
u8g2_Setup_st7920_p_128x64_1(&u8g2, U8G2_R0, u8x8_byte_3wire_sw_spi, u8g2_gpio_and_delay_stm32);
u8g2_InitDisplay(&u8g2); // send init sequence to the display, display is in sleep mode after this,
u8g2_SetPowerSave(&u8g2, 0); // wake up display
HAL_GPIO_WritePin(LCD_RESET_GPIO_Port, LCD_RESET_Pin, RESET);
HAL_Delay(100);
HAL_GPIO_WritePin(LCD_RESET_GPIO_Port, LCD_RESET_Pin, SET);
HAL_Delay(200);
HAL_Delay(1000);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
HAL_ACC_Init();
//int16_t val_accel[3];
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
//u8g2_DrawLine(&u8g2, 50,50, 100, 100);
u8g2_DrawBox(&u8g2, 100, 50, 50, 40);
u8g2_SendBuffer(&u8g2);
TEST_ACC_GetVal();
//TEST_UART_Blinky();
}
/* USER CODE END 3 */
}
.
i am having similar trouble as well. This might help you. https://github.com/olikraus/u8g2/issues/840