diff --git a/examples/app_hsv_cycle_per_rgb_example/src/hsv_cycle_per_rgb_example.c b/examples/app_hsv_cycle_per_rgb_example/src/hsv_cycle_per_rgb_example.c index 33d9bc3..4647318 100644 --- a/examples/app_hsv_cycle_per_rgb_example/src/hsv_cycle_per_rgb_example.c +++ b/examples/app_hsv_cycle_per_rgb_example/src/hsv_cycle_per_rgb_example.c @@ -11,8 +11,7 @@ void init_colors(uint32_t *current_colors, uint32_t *previous_colors, uint32_t c { *(current_colors + i) = cycleHSV(¤t_hue); } - // TODO: 当使用xs3_memcpy时,复制的后几个数据看起来是随机的 - memcpy(previous_colors, current_colors, NUM_RGBS * sizeof(uint32_t)); + xs3_memcpy(previous_colors, current_colors, NUM_RGBS * sizeof(uint32_t)); } void hsv_cycle_per_rgb_example() @@ -28,7 +27,7 @@ void hsv_cycle_per_rgb_example() for (size_t i = 0; i < NUM_RGB_GROUPS; i++) { - *(levels + i) = (NUM_RGBS / NUM_RGB_GROUPS)-1; + *(levels + i) = (NUM_RGBS / NUM_RGB_GROUPS); } // 用当前渐变颜色填充RGB数组,然后发送给rgb阵列 fill_gradient_with_groups_colorful(buf, current_colors, levels); @@ -36,10 +35,10 @@ void hsv_cycle_per_rgb_example() // 延迟以控制显示持续时间 delay_milliseconds(DELAY_TIME_RGB); // 更改下一组颜色,其中每个灯继承上一个灯的颜色,第一个灯通过cycleHSV计算出新的颜色 - memcpy(current_colors+1, previous_colors, (NUM_RGBS-1) * sizeof(uint32_t)); + xs3_memcpy(current_colors+1, previous_colors, (NUM_RGBS-1) * sizeof(uint32_t)); current_colors[0] = cycleHSV(¤t_hue); // 保留本轮颜色的记录 - memcpy(previous_colors, current_colors, NUM_RGBS * sizeof(uint32_t)); + xs3_memcpy(previous_colors, current_colors, NUM_RGBS * sizeof(uint32_t)); } } \ No newline at end of file