我今天在使用
STM32G474RE来使用SPI+DMA发送给OLED屏时,在启动SPI+DMA发送时,如果使用如下代码:
/**
* @brief Updates buffer from internal RAM to OLED with SSD1306 in horizontal addressing mode (blocks un
til interrupt function initialized)
* @note This function must be called each time you do some changes to OLED, to update buffer from RAM to OLED
*/
uint8_t SSD1306_UpdateScreen(void)
{
/* Writing data to display buffer - non-blocking function with SPI and DMA */
uint8_t i,n,state;
for(i= 0; i<8;i++)
{
ssd1306_SPI_WriteCmd(0xb0+i);
ssd1306_SPI_WriteCmd(0x00);
ssd1306_SPI_WriteCmd(0x10);
state = ssd1306_SPI_WriteDisp( SSD1306_Buffer[SSD1306_WIDTH*i],SSD1306_WIDTH);
if(state == SSD1306_SPI_ERROR)
{
break;
}
}
return state;
}
0