分类 linux 下的文章

Sometimes, we need to run a script to modify saveral files at once.

We can use xargs on shell tube.

ls | xargs echo 

As the command before, xargs run echo and use the result from ls.

this example shows how to use xargs modify all index.html that change *.js to *.js?ver=xxx

verStr="1.0.0"

# set version for  .css .js files
find -name "index.html" | xargs -i cp {} {}.bak 

find -name "index.html" | xargs sed -i 's@\.js.*\"@.js?ver='${verStr}'\"@g'

# reset files
# find -name "index.html" | xargs -i mv {}.bak {} 

在进行嵌入式开发的时候,文件传输是比较麻烦的 在调试过程中,最方便的方式是使用nfs进行文件目录共享 记录一下在设备和ubuntu之间共享的方法

在ubuntu上开启nfs共享

1. 安装和开启nfs-server服务

sudo apt install nfs-kernel-server

2. 配置共享文件目录

此时可以创建一个新目录 或者使用 开发目录来进行共享,这里以 /home/my/dev 为例

sudo vi /etc/exports

添加

/home/my/dev  192.168.*(rw,sync,no_root_squash)

如果出现Protocol not supported 可以在 /etc/default/nfs-kernel-server末尾添加

PRCNFSDORTS="--nfs-version 2,3,4 --debug --syslog"

3. 刷新服务

sudo systemctl restart nfs-server.service

4. 检查状态

sudo exportfs -v

lv_draw_sw_img_decoded

img_decoded 是用于解码图片并且将图片绘制到指定buffer区域。

LV_ATTRIBUTE_FAST_MEM 
void lv_draw_sw_img_decoded
(
struct _lv_draw_ctx_t * draw_ctx,
const lv_draw_img_dsc_t * draw_dsc,
const lv_area_t * coords, 
const uint8_t * src_buf, 
lv_img_cf_t cf
)

/**
    struct _lv_draw_ctx_t * draw_ctx        // 绘制上下文
    const lv_draw_img_dsc_t * draw_dsc      // 图像素材绘制描述
    const lv_area_t * coords                // 绘制区(图像在output buffer上的绝对定位)
    const uint8_t * src_buf                  // 图像buffer
    lv_img_cf_t cf                          // 图像色彩格式
**/

绘制上下文中,与当前绘制图像相关的属性:

typedef struct _lv_draw_ctx_t  {
    /**
     *  Pointer to a buffer to draw into
     */
    void * buf;

    /**
     * The position and size of `buf` (absolute coordinates)
     */
    lv_area_t * buf_area;

    /**
     * The current clip area with absolute coordinates, always the same or smaller than `buf_area`
     */
    const lv_area_t * clip_area;

} lv_draw_ctx_t;

与图像本身的绘制效果相关的:

typedef struct {

    int16_t angle;
    uint16_t zoom;
    lv_point_t pivot;

    lv_color_t recolor;
    lv_opa_t recolor_opa;

    lv_opa_t opa;
    lv_blend_mode_t blend_mode : 4;

    int32_t frame_id;
    uint8_t antialias       : 1;
} lv_draw_img_dsc_t;

lvgl doc flex

lv_obj_set_layout(obj, LV_LAYOUT_FLEX)

The possible values for flex_flow are:

LV_FLEX_FLOW_ROW: Place the children in a row without wrapping
不换行的ROW

LV_FLEX_FLOW_COLUMN: Place the children in a column without wrapping

LV_FLEX_FLOW_ROW_WRAP: Place the children in a row with wrapping

LV_FLEX_FLOW_COLUMN_WRAP: Place the children in a column with wrapping

LV_FLEX_FLOW_ROW_REVERSE: Place the children in a row without wrapping but in reversed order

LV_FLEX_FLOW_COLUMN_REVERSE: Place the children in a column without wrapping but in reversed order

LV_FLEX_FLOW_ROW_WRAP_REVERSE: Place the children in a row with wrapping but in reversed order

LV_FLEX_FLOW_COLUMN_WRAP_REVERSE: Place the children in a column with wrapping but in reversed order



The possible values are:

LV_FLEX_ALIGN_START: means left on a horizontally and top vertically. (default)

LV_FLEX_ALIGN_END: means right on a horizontally and bottom vertically

LV_FLEX_ALIGN_CENTER: simply center

LV_FLEX_ALIGN_SPACE_EVENLY: items are distributed so that the spacing between any two items (and the space to the edges) is equal. Does not apply to track_cross_place.

LV_FLEX_ALIGN_SPACE_AROUND: items are evenly distributed in the track with equal space around them. Note that visually the spaces aren't equal, since all the items have equal space on both sides. The first item will have one unit of space against the container edge, but two units of space between the next item because that next item has its own spacing that applies. Not applies to track_cross_place.

LV_FLEX_ALIGN_SPACE_BETWEEN: items are evenly distributed in the track: first item is on the start line, last item on the end line. Not applies to track_cross_place.