刚开始也不行,我就听了一会儿歌曲,又重新选择配置了一次,烧录后,听个歌,然后一看,好了。
论坛的几位兄弟快来看看。
void OLED_Write_cmd(uint8_t cmd)
{
// HAL_I2C_Mem_Write(&hi2c2, 0x78, 0x00, I2C_MEMADD_SIZE_8BIT, &cmd, 1, 0x100);
/*
IIC_Start();
Write_IIC_Byte(0x78); //D/C#=0; R/W#=0
IIC_Wait_Ack();
Write_IIC_Byte(0x00); //write cmd
IIC_Wait_Ack();
Write_IIC_Byte(cmd);
IIC_Wait_Ack();
IIC_Stop();
*/
uint8_t cmd2[2];
cmd2[0] = 0x00;
cmd2[1] = cmd;
bool flag = 0;
flag = I2C1_Write(0x3C, cmd2, 2);
if(flag == true) LED_SetLow();
else LED_SetHigh();
}
void OLED_Write_data(uint8_t data)
{
// HAL_I2C_Mem_Write(&hi2c2, 0x78, 0x40, I2C_MEMADD_SIZE_8BIT, &data, 1, 0x100);
/*
IIC_Start();
Write_IIC_Byte(0x78); //D/C#=0; R/W#=0
IIC_Wait_Ack();
Write_IIC_Byte(0x40); //write data
IIC_Wait_Ack();
Write_IIC_Byte(data);
IIC_Wait_Ack();
IIC_Stop();
*/
uint8_t data2[2];
data2[0] = 0x40;
data2[1] = data;
I2C1_Write(0x3C, data2, 2);
}
我软硬的都写了,刚开始硬件不行,我改成了软件的,然后我又改回来,稀奇的不得了。
|