minilogic / f1c_nonos

Bare metal code examples for Allwinner's F1C100S (F1C200S) SOC
66 stars 21 forks source link

Clarification on dev_enable(state_switch() && state_vsys() > 3000 ? 1 : 0); #1

Closed 0x0fe closed 8 months ago

0x0fe commented 1 year ago

Can you clarify the function and usage of dev_enable and the statement linked?

https://github.com/minilogic/f1c_nonos/blob/b359050bf9124dfab63313fb44ec53769d002584/src/demo/wave/main.c#L149

minilogic commented 1 year ago

It's made for the f1c_dbc, which is a complete device with a power management scheme. In this case, the dev_enable function keeps the device on as long as the switch S1 is in the "ON" position and the system voltage level VSYS is greater than 3V (see diagram Bottom board). For the LicheePi board, this feature is redundant and useless.

0x0fe commented 1 year ago

ohh, i see, this is for some external PMIC. I dont use this baord so i disabled this. I want to port your SDK to Keil, because for some of us its convenient to use Keil. Slowly working on that. I find the SDK very neat. By the way, i wonder if you implemented double buffering (is there an interrupt on VSYNC) to avoid tearing effect. I am testing a small 320*480 TFT and i noticed what i beleive to be some tearing effect when displaying full frame R, G, B at 20fps. The LCD has a TE line which could be used for that, but it seem not necessary if there is double buffering tied to VSYNC.

minilogic commented 1 year ago

Double buffering is done by allocating two buffers using the fb_alloc function (see example lvgl example), the active buffer is assigned with the lay_update function. And synchronization can be done using the disp_sinc function (later I will change the name to disp_sync :) ). Tomorrow I will post an example demo using this algorithm.

0x0fe commented 1 year ago

neat, that seems quite straightforward. Thanks for all these clarifications and kudos for the nice SDK.

minilogic commented 1 year ago

Example of synchronous buffer switching: Gouraud Shade Effect

0x0fe commented 1 year ago

You may be interested in what is here, there is a more complete defe driver, and many other useful things. I posted few other links of interest in whycan. https://github.com/Saoskywalker/micropython_for_f1c100s/tree/main/driver

0x0fe commented 1 year ago

and i can find some of these functions of DEFE into these drivers: https://github.com/yukchou/linux-sunxi-1/tree/31b2ca019c839fed5baa62093e8934188d6a5e65/drivers/video/sunxi/disp

So possibly many other functions can be extracted from these.