您尚未登录。

楼主 # 2022-11-22 09:50:45

khalilchen
会员
注册时间: 2022-11-03
已发帖子: 5
积分: 10

在SWM32SRET6上搞了一个ARM2D

extern const uint8_t LOG_map[84 * 82 * 2];

static ARM_NOINIT arm_2d_helper_pfb_t s_tExamplePFB;

extern const uint8_t c_bmpBlueSlashes[];
const arm_2d_tile_t c_tileBlueSlashes = {
    .tRegion = {
        .tSize = {
            .iWidth = 84,
            .iHeight = 82
        },
    },
    .tInfo.bIsRoot = true,
    .phwBuffer = (uint16_t *)LOG_map,
};

static char LCD_TextBuffer[128];
void log_refresh_handler(const arm_2d_tile_t *ptTarget)
{
    arm_2d_region_t tBarRegion = {
        .tLocation = {
           .iX = (ptTarget->tRegion.tSize.iWidth - c_tileBlueSlashes.tRegion.tSize.iWidth) / 2,
           .iY = (ptTarget->tRegion.tSize.iHeight - c_tileBlueSlashes.tRegion.tSize.iHeight) / (int16_t)2,
        },
        .tSize = {
            .iWidth = 84,
            .iHeight = 82,
        },
    };
   
    arm_2d_rgb16_tile_copy( &c_tileBlueSlashes,
                            ptTarget,
                            &tBarRegion,
                            ARM_2D_CP_MODE_COPY);
   
    lcd_text_location(200, 200);
    snprintf(LCD_TextBuffer, sizeof(LCD_TextBuffer), "%s\r\n", "SD卡升");
    lcd_puts(LCD_TextBuffer, 0xffffffff);
}

static
IMPL_PFB_ON_DRAW(__pfb_draw_LOG_handler)
{
    ARM_2D_UNUSED(pTarget);
   
    arm_2d_rgb16_fill_colour(ptTile, NULL, 0x24ff);
    log_refresh_handler(ptTile);
    
    return arm_fsm_rt_cpl;
}

static
IMPL_PFB_ON_DRAW(__pfb_draw_background_handler)
{
    ARM_2D_UNUSED(pTarget);
    ARM_2D_UNUSED(bIsNewFrame);

    arm_2d_rgb16_fill_colour(ptTile, NULL, 0x24ff );

    return arm_fsm_rt_cpl;
}

static
IMPL_PFB_ON_LOW_LV_RENDERING(__pfb_render_handler)
{
    const arm_2d_tile_t *ptTile = &(ptPFB->tTile);

    ARM_2D_UNUSED(pTarget);
    ARM_2D_UNUSED(bIsNewFrame);

    GLCD_DrawBitmap(ptTile->tRegion.tLocation.iX,
                    ptTile->tRegion.tLocation.iY,
                    ptTile->tRegion.tSize.iWidth,
                    ptTile->tRegion.tSize.iHeight,
                    ptTile->pchBuffer);
                   
    arm_2d_helper_pfb_report_rendering_complete(&s_tExamplePFB,
                                                (arm_2d_pfb_t *)ptPFB);
}

void display_task(void)

    /*! define dirty regions */
    IMPL_ARM_2D_REGION_LIST(s_tDirtyRegions, static const)
       
        ADD_REGION_TO_LIST(s_tDirtyRegions,
            .tLocation = {0,
                          0},
            .tSize = {
                .iWidth = 480,
                .iHeight = 272, 
            },
        ),

    END_IMPL_ARM_2D_REGION_LIST()

    //! call partial framebuffer helper service
    while(arm_fsm_rt_cpl != arm_2d_helper_pfb_task(
                                &s_tExamplePFB,
                                (arm_2d_region_list_item_t *)s_tDirtyRegions));                                   
}       


void Peripherals_Init(void)
{
    lcd_memory_init();
    lcd_rgb_init();
   
    gt9x_init();

    GPIO_Init(GPIOM, PIN16, 0, 1, 0);
    GPIO_Init(GPIOM, PIN18, 1, 1, 0);
}

int main(void)
{
    SystemInit();

    systick_init();
   
    Peripherals_Init();

    arm_irq_safe
    {
        arm_2d_init();
    }

    //! initialise FPB helper
    if (ARM_2D_HELPER_PFB_INIT(
            &s_tExamplePFB,                 //!< FPB Helper object
            APP_SCREEN_WIDTH,               //!< screen width
            APP_SCREEN_HEIGHT,              //!< screen height
            uint16_t,                       //!< colour date type
            PFB_BLOCK_WIDTH,                //!< PFB block width
            PFB_BLOCK_HEIGHT,               //!< PFB block height
            1,                              //!< number of PFB in the PFB pool
            {
                .evtOnLowLevelRendering = {
                    //! callback for low level rendering
                    .fnHandler = &__pfb_render_handler,                         
                },
                .evtOnDrawing = {
                    //! callback for drawing GUI
                    .fnHandler = &__pfb_draw_background_handler,
                },
            }
        ) < 0) {
        //! error detected
        assert(false);
    }

    //! draw background first
    while (arm_fsm_rt_cpl != arm_2d_helper_pfb_task(&s_tExamplePFB, NULL));

    //! update draw function
    ARM_2D_HELPER_PFB_UPDATE_ON_DRAW_HANDLER(&s_tExamplePFB,
        &__pfb_draw_LOG_handler);

    while (1) {
        display_task();
        GPIO_InvBit(GPIOM, PIN18);
        swm_delay_ms(500);
    }
}

离线

#1 2022-12-03 22:44:46

foric
会员
所在地: 北京
注册时间: 2022-12-03
已发帖子: 2
积分: 2
个人网站

Re: 在SWM32SRET6上搞了一个ARM2D

好贴 ,SWM32SRE跑arm-2d。我正好自己做了SWM32SRE开发板,试试看

离线

#2 2023-02-13 15:14:10

ddd10086
会员
注册时间: 2022-12-29
已发帖子: 6
积分: 6

Re: 在SWM32SRET6上搞了一个ARM2D

mark,请问是在哪里找到这种指令的

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn