本帖最后由 浪人望断了天涯 于 2017-2-2 18:00 编辑
加入中全出来的
//画点函数
//x,y:坐标
//color:颜 {MOD}值
void LTDC_Draw_Point(TYPE_ltdc_dev *P_Ltdc_dev)
{
while(BSP_SDRAM_ReadData((__IO uint32_t)(ltdc_lcd_framebuf + P_Ltdc_dev ->pointx + P_Ltdc_dev ->pointy * 480), P_Ltdc_dev ->ready_dat,4) != HAL_OK);//加入这句后就写不进去数据,读出来的数据是正确的。但是去掉后就可以写进去数据
if(P_Ltdc_dev ->pointx % 2)
{
P_Ltdc_dev ->ready_dat[0] &= 0x0000ffff;
P_Ltdc_dev ->ready_dat[0] |= (uint32_t)(P_Ltdc_dev ->color << 16);
}
else
{
P_Ltdc_dev ->ready_dat[0] &= 0xffff0000;
P_Ltdc_dev ->ready_dat[0] |= (uint32_t)P_Ltdc_dev ->color;
}
P_Ltdc_dev ->ready_dat[6] = 0;
P_Ltdc_dev ->ready_dat[7] = 0;
while(BSP_SDRAM_WriteData((__IO uint32_t)(ltdc_lcd_framebuf + P_Ltdc_dev ->pointx + P_Ltdc_dev ->pointy * 480), P_Ltdc_dev ->ready_dat,8) != HAL_OK);
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
//画点函数
//x,y:坐标
//color:颜 {MOD}值
void LTDC_Draw_Point(TYPE_ltdc_dev *P_Ltdc_dev)
{
while(BSP_SDRAM_ReadData((__IO uint32_t)(ltdc_lcd_framebuf + P_Ltdc_dev ->pointx + P_Ltdc_dev ->pointy * 480), P_Ltdc_dev ->ready_dat,4) != HAL_OK);//加入这句就无法写进去数据了
if(P_Ltdc_dev ->pointx % 2)
{
P_Ltdc_dev ->ready_dat[0] &= 0x0000ffff;
P_Ltdc_dev ->ready_dat[0] |= (uint32_t)(P_Ltdc_dev ->color << 16);
}
else
{
P_Ltdc_dev ->ready_dat[0] &= 0xffff0000;
P_Ltdc_dev ->ready_dat[0] |= (uint32_t)P_Ltdc_dev ->color;
}
P_Ltdc_dev ->ready_dat[6] = 0;
P_Ltdc_dev ->ready_dat[7] = 0;
while(BSP_SDRAM_WriteData((__IO uint32_t)(ltdc_lcd_framebuf + P_Ltdc_dev ->pointx + P_Ltdc_dev ->pointy * 480), P_Ltdc_dev ->ready_dat,8) != HAL_OK);
}
我dbug看了程序能够正常进行,只写没有效果,我找不出原因了!我再试试原例程看看
使用例程中void LTDC_Draw_Point(TYPE_ltdc_dev *P_Ltdc_dev)
{
FMC_SDRAM_ReadBuffer((uint8_t *)P_Ltdc_dev ->ready_dat,(__IO uint32_t)(ltdc_lcd_framebuf + P_Ltdc_dev ->pointx + P_Ltdc_dev ->pointy * 480),4);
P_Ltdc_dev ->ready_dat[0] = 0xff;
P_Ltdc_dev ->ready_dat[1] = 0xff;
P_Ltdc_dev ->ready_dat[2] = 0xff;
P_Ltdc_dev ->ready_dat[3] = 0xff;
FMC_SDRAM_WriteBuffer((uint8_t *)P_Ltdc_dev ->ready_dat,(__IO uint32_t)(ltdc_lcd_framebuf + P_Ltdc_dev ->pointx + P_Ltdc_dev ->pointy * 480),4);
的函数会直接跳到/**
* @brief This function handles Hard Fault exception.
* @param None
* @retval None
*/
void HardFault_Handler(void)
{
/* Go to infinite loop when Hard Fault exception occurs */
while (1)
{
}
}
一周热门 更多>