[feat][examples/spi] add spi ws2812,spi ssd1306,spi lcd display images using tinyjpeg demo
10
examples/spi/spi_lcd_display_jpeg/CMakeLists.txt
Normal file
|
@ -0,0 +1,10 @@
|
|||
set(BSP_COMMON_DIR ${CMAKE_SOURCE_DIR}/bsp/bsp_common)
|
||||
|
||||
set(TARGET_REQUIRED_LIBS tiny_jpeg romfs)
|
||||
|
||||
set(TARGET_REQUIRED_PRIVATE_INCLUDE ${BSP_COMMON_DIR}/mcu_lcd )
|
||||
set(TARGET_REQUIRED_SRCS ${sources} ${BSP_COMMON_DIR}/mcu_lcd/mcu_lcd.c ${BSP_COMMON_DIR}/mcu_lcd/ili9341.c ${BSP_COMMON_DIR}/mcu_lcd/st7735s.c ${BSP_COMMON_DIR}/mcu_lcd/st7789v.c ${BSP_COMMON_DIR}/mcu_lcd/font.c )
|
||||
|
||||
set(mains main.c)
|
||||
generate_bin()
|
||||
|
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_1.jpg
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_10.jpg
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_11.jpg
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_12.jpg
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_13.jpg
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_14.jpg
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_15.jpg
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_16.jpg
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_17.jpg
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_18.jpg
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_19.jpg
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_2.jpg
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_20.jpg
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_21.jpg
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_22.jpg
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_23.jpg
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_24.jpg
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_25.jpg
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_26.jpg
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_27.jpg
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_28.jpg
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_29.jpg
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_3.jpg
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_30.jpg
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_31.jpg
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_32.jpg
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_33.jpg
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_34.jpg
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_35.jpg
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_36.jpg
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_37.jpg
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_38.jpg
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_39.jpg
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_4.jpg
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_40.jpg
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_41.jpg
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_42.jpg
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_43.jpg
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_44.jpg
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_45.jpg
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_46.jpg
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_47.jpg
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_48.jpg
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_49.jpg
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_5.jpg
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_50.jpg
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_51.jpg
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_52.jpg
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_53.jpg
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_54.jpg
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_55.jpg
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_56.jpg
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_57.jpg
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_58.jpg
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_59.jpg
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_6.jpg
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_60.jpg
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_7.jpg
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_8.jpg
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
examples/spi/spi_lcd_display_jpeg/jpeg_image/img_9.jpg
Normal file
After Width: | Height: | Size: 1.4 KiB |
261
examples/spi/spi_lcd_display_jpeg/main.c
Normal file
|
@ -0,0 +1,261 @@
|
|||
/**
|
||||
* @file main.c
|
||||
* @brief
|
||||
*
|
||||
* Copyright (c) 2021 Bouffalolab team
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
* This Case is currently based on BL706_AVB development board with ili9341 controller screen.
|
||||
* If you use other hardware platforms, please modify the pin Settings by yourself
|
||||
*
|
||||
* Your should Short connect func1 and func2 jump cap on 706_AVB Board,and Plug the screen into the HD13 interface
|
||||
* Then the hardware for lvgl case testing is available.
|
||||
*
|
||||
* 使用了 romfs 文件系统,需要另外烧入 romfs 文件系统镜像文件,镜像文件在目录下 jpeg_image.bin, 需要烧录到 0x80000 位置
|
||||
* jpeg_image 文件夹下是 romfs文件系统镜像的源文件,jpeg_image.bin 由 jpeg_image 文件夹通过 components/romfs/genromfs 工具生成
|
||||
* 关于 romfs 文件系统相关,请查看 components/romfs/genromfs/readme.md 文档
|
||||
* 本例程是使用四分之一图片,通过镜像旋转到完整图片
|
||||
*/
|
||||
|
||||
#include "hal_spi.h"
|
||||
#include "hal_gpio.h"
|
||||
#include "hal_dma.h"
|
||||
|
||||
#include "mcu_lcd.h"
|
||||
#include "bl_romfs.h"
|
||||
#include "tjpgd.h"
|
||||
|
||||
/* Session identifier for input/output functions (name, members and usage are as user defined) */
|
||||
typedef struct {
|
||||
romfs_file_t *p_file;
|
||||
uint16_t x_start;
|
||||
uint16_t y_start;
|
||||
} IODEV;
|
||||
|
||||
#define SZ_WORK (12 * 1024) /* 解码工作区大小,过小会报错 */
|
||||
uint8_t work_buff[SZ_WORK]; /* 工作区 */
|
||||
|
||||
/**
|
||||
* @brief tiny jpeg 解压数据输入函数,使用 romfs 文件系统
|
||||
*
|
||||
* @param jd
|
||||
* @param buff
|
||||
* @param nbyte
|
||||
* @return size_t
|
||||
*/
|
||||
size_t in_func(JDEC *jd, uint8_t *buff, size_t nbyte)
|
||||
{
|
||||
IODEV *dev = jd->device;
|
||||
|
||||
if (buff) {
|
||||
return romfs_read(dev->p_file, (char *)buff, nbyte);
|
||||
} else {
|
||||
romfs_lseek(dev->p_file, nbyte, ROMFS_SEEK_CUR);
|
||||
return nbyte;
|
||||
}
|
||||
}
|
||||
|
||||
/* 定义显示的缓冲区 */
|
||||
uint8_t flush_buff[2][1 * 1024] __attribute__((aligned(4), section(".tcm_data")));
|
||||
uint8_t buff_using_flag;
|
||||
|
||||
/**
|
||||
* @brief tiny jpeg 解压数据输出函数
|
||||
*
|
||||
* @param jd
|
||||
* @param bitmap
|
||||
* @param rect
|
||||
* @return int
|
||||
*/
|
||||
int out_func(JDEC *jd, void *bitmap, JRECT *rect)
|
||||
{
|
||||
uint16_t base_x = ((IODEV *)(jd->device))->x_start;
|
||||
uint16_t base_y = ((IODEV *)(jd->device))->y_start;
|
||||
uint16_t x1, x2, y1, y2;
|
||||
uint16_t w = rect->right - rect->left;
|
||||
uint16_t h = rect->bottom - rect->top;
|
||||
uint32_t lenth = (w + 1) * (h + 1);
|
||||
uint16_t *p_src, *p_dst;
|
||||
|
||||
/* 关闭自动翻转数据大小端 */
|
||||
lcd_auto_swap_set(0);
|
||||
/* 手动翻转数据大小端 */
|
||||
lcd_swap_color_data16(bitmap, bitmap, lenth);
|
||||
|
||||
/* 缓冲区够大,拷贝到缓冲区,非阻塞发送, */
|
||||
if (lenth * 2 < sizeof(flush_buff) / 2) {
|
||||
/* 1 四分之一原图 */
|
||||
x1 = base_x + rect->left;
|
||||
x2 = base_x + rect->right;
|
||||
y1 = base_y + rect->top;
|
||||
y2 = base_y + rect->bottom;
|
||||
while (lcd_draw_is_busy()) {
|
||||
}
|
||||
lcd_draw_picture_nonblocking(x1, y1, x2, y2, (lcd_color_t *)bitmap);
|
||||
|
||||
/* 水平镜像 */
|
||||
p_src = (uint16_t *)bitmap;
|
||||
p_dst = (uint16_t *)flush_buff[0];
|
||||
for (int16_t i = 0; i <= h; i++) {
|
||||
for (int16_t j = 0; j <= w; j++) {
|
||||
p_dst[j] = p_src[w - j];
|
||||
}
|
||||
p_src += w + 1;
|
||||
p_dst += w + 1;
|
||||
}
|
||||
x1 = base_x + (jd->width * 2 - rect->right) - 1;
|
||||
x2 = base_x + (jd->width * 2 - rect->left) - 1;
|
||||
while (lcd_draw_is_busy()) {
|
||||
}
|
||||
lcd_draw_picture_nonblocking(x1, y1, x2, y2, (lcd_color_t *)flush_buff[0]);
|
||||
|
||||
/* 左垂直镜像 */
|
||||
p_src = (uint16_t *)bitmap;
|
||||
p_dst = (uint16_t *)flush_buff[1] + (w + 1) * h;
|
||||
for (int16_t i = h; i >= 0; i--) {
|
||||
for (int16_t j = 0; j <= w; j++) {
|
||||
p_dst[j] = p_src[j];
|
||||
}
|
||||
p_src += w + 1;
|
||||
p_dst -= w + 1;
|
||||
}
|
||||
x1 = base_x + rect->left;
|
||||
x2 = base_x + rect->right;
|
||||
y1 = base_y + (jd->height * 2 - rect->bottom) - 1;
|
||||
y2 = base_y + (jd->height * 2 - rect->top) - 1;
|
||||
while (lcd_draw_is_busy()) {
|
||||
}
|
||||
lcd_draw_picture_nonblocking(x1, y1, x2, y2, (lcd_color_t *)flush_buff[1]);
|
||||
|
||||
/* 右垂直镜像 */
|
||||
p_src = (uint16_t *)bitmap;
|
||||
p_dst = (uint16_t *)flush_buff[0] + (w + 1) * h;
|
||||
for (int16_t i = h; i >= 0; i--) {
|
||||
for (int16_t j = 0; j <= w; j++) {
|
||||
p_dst[j] = p_src[w - j];
|
||||
}
|
||||
p_src += w + 1;
|
||||
p_dst -= w + 1;
|
||||
}
|
||||
x1 = base_x + (jd->width * 2 - rect->right) - 1;
|
||||
x2 = base_x + (jd->width * 2 - rect->left) - 1;
|
||||
y1 = base_y + (jd->height * 2 - rect->bottom) - 1;
|
||||
y2 = base_y + (jd->height * 2 - rect->top) - 1;
|
||||
while (lcd_draw_is_busy()) {
|
||||
}
|
||||
lcd_draw_picture_nonblocking(x1, y1, x2, y2, (lcd_color_t *)flush_buff[0]);
|
||||
|
||||
} else {
|
||||
/* 缓冲区不够大阻塞发送 */
|
||||
MSG("flush_buff too small\r\n");
|
||||
}
|
||||
|
||||
/* 恢复自动翻转数据大小端 */
|
||||
lcd_auto_swap_set(1);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
uint64_t time_node_1, time_node_2;
|
||||
JRESULT res; /* TJpgDec API f */
|
||||
JDEC jdec; /* jdec obj */
|
||||
|
||||
romfs_file_t img_file;
|
||||
|
||||
IODEV devid = {
|
||||
.x_start = 10,
|
||||
.y_start = 10,
|
||||
.p_file = &img_file,
|
||||
}; /* 私有结构体,指针保存到 jdec.device中 */
|
||||
|
||||
char img_path[32] = "/romfs/img_1.jpg";
|
||||
uint8_t num = 1;
|
||||
|
||||
uint8_t str[64];
|
||||
|
||||
bflb_platform_init(0);
|
||||
|
||||
if (lcd_init()) {
|
||||
MSG("lcd err \r\n");
|
||||
}
|
||||
lcd_set_dir(2, 0);
|
||||
lcd_clear(0x001F);
|
||||
// lcd_draw_rectangle(200, 120, 300, 220, 0xffff);
|
||||
// lcd_draw_circle(250, 170, 50, 0xffff);
|
||||
// lcd_draw_circle(200, 120, 100, 0xffff);
|
||||
|
||||
if (romfs_mount()) {
|
||||
MSG("romfs find err\r\n");
|
||||
while (1) {
|
||||
};
|
||||
} else {
|
||||
MSG("romfs mount success\r\n");
|
||||
}
|
||||
|
||||
romfs_open(&img_file, "/romfs/img_1.jpg", 0);
|
||||
|
||||
time_node_1 = bflb_platform_get_time_ms();
|
||||
|
||||
while (1) {
|
||||
/* 工作区分配,注册输入函数,分析 JPEG 信息*/
|
||||
res = jd_prepare(&jdec, in_func, work_buff, SZ_WORK, &devid);
|
||||
|
||||
if (res != JDR_OK) {
|
||||
MSG("jd_prepare err:%d\r\n", res);
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
/* 注册输出函数,解压 JPEG */
|
||||
res = jd_decomp(&jdec, out_func, 0);
|
||||
|
||||
/* 性能计算与图片切换 */
|
||||
if (res == JDR_OK) {
|
||||
if (++num > 60) {
|
||||
num = 1;
|
||||
|
||||
time_node_2 = bflb_platform_get_time_ms();
|
||||
uint32_t time = (uint32_t)(time_node_2 - time_node_1);
|
||||
|
||||
sprintf((char *)str, "time:%ld\r\nfps :%ld", time, 1000 * 60 / time);
|
||||
MSG("%s", str);
|
||||
|
||||
while (lcd_draw_is_busy()) {
|
||||
BL_DRV_DUMMY;
|
||||
}
|
||||
lcd_draw_str_ascii16(5, 180, 0xFFFF, 0x0010, str, 0xff);
|
||||
|
||||
time_node_1 = bflb_platform_get_time_ms();
|
||||
}
|
||||
romfs_close(&img_file);
|
||||
/* open next image */
|
||||
sprintf(img_path, "/romfs/img_%d.jpg", num);
|
||||
romfs_open(&img_file, img_path, 0);
|
||||
} else {
|
||||
MSG("jd_decomp err:%d\r\n", res);
|
||||
}
|
||||
}
|
||||
}
|
5
examples/spi/spi_ssd1306_badapple/CMakeLists.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
set(BSP_COMMON_DIR ${CMAKE_SOURCE_DIR}/bsp/bsp_common)
|
||||
set(TARGET_REQUIRED_PRIVATE_INCLUDE ${BSP_COMMON_DIR}/mcu_lcd)
|
||||
set(TARGET_REQUIRED_SRCS ${BSP_COMMON_DIR}/mcu_lcd/ssd1306.c ${BSP_COMMON_DIR}/mcu_lcd/font.c)
|
||||
set(mains main.c)
|
||||
generate_bin()
|
5320
examples/spi/spi_ssd1306_badapple/badapple.h
Normal file
711
examples/spi/spi_ssd1306_badapple/cdk/ssd1306.cdkproj
Normal file
|
@ -0,0 +1,711 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Project Name="ssd1306" Version="1" Language="C">
|
||||
<Description>CPU: RV32IMAFC
|
||||
Chip: bl70x
|
||||
Board: bl70x_iot
|
||||
</Description>
|
||||
<Dependencies Name="Debug"/>
|
||||
<VirtualDirectory Name="app">
|
||||
<File Name="../main.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../badapple.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="chip">
|
||||
<VirtualDirectory Name="riscv">
|
||||
<File Name="../../../../drivers/bl702_driver/startup/interrupt.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/startup/system_bl702.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="startup">
|
||||
<File Name="../../../../drivers/bl702_driver/startup/GCC/entry.S">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/startup/GCC/start_load.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="hal">
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_adc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_dac.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_dma.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_gpio.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_i2c.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_i2s.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_mtimer.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_pwm.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_spi.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_timer.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_uart.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_usb.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_clock.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_cam.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_mjpeg.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_pm.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_flash.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="std">
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_acomp.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_adc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_aon.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_cam.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_clock.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_dac.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_dma.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_ef_ctrl.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_emac.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_glb.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_hbn.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_i2c.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_i2c_gpio_sim.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_i2s.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_ir.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_common.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_kys.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_l1c.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_mjpeg.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_pds.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_psram.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_pwm.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_qdec.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_romapi.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_romdriver.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sec_dbg.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sec_eng.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sf_cfg.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sf_cfg_ext.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sf_ctrl.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sflash.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sflash_ext.c" ExcludeProjConfig="">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_spi.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_timer.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_uart.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_usb.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_xip_sflash.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_xip_sflash_ext.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="bsp">
|
||||
<VirtualDirectory Name="board">
|
||||
<File Name="../../../../bsp/board/bl702/board.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="bsp_common">
|
||||
<File Name="../../../../bsp/bsp_common/platform/bflb_platform.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../bsp/bsp_common/platform/syscalls.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../bsp/bsp_common/mcu_lcd/ssd1306.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="common">
|
||||
<File Name="../../../../common/device/drv_device.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../common/memheap/drv_mmheap.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../common/ring_buffer/ring_buffer.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../common/soft_crc/softcrc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../common/misc/misc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="script">
|
||||
<File Name="../../../../tools/openocd/bl70x_gdb.init">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/regs/bl70x_reg.svc">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../readme.md">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<MonitorProgress>
|
||||
<DebugLaunch>90</DebugLaunch>
|
||||
<FlashOperate>37</FlashOperate>
|
||||
</MonitorProgress>
|
||||
<VirtualDirectory Name="components">
|
||||
<VirtualDirectory Name="fatfs">
|
||||
<File Name="../../../../components/fatfs/diskio.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../components/fatfs/ff.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../components/fatfs/ffsystem.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../components/fatfs/ffunicode.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="shell">
|
||||
<File Name="../../../../components/shell/shell.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="usb_stack">
|
||||
<VirtualDirectory Name="class">
|
||||
<VirtualDirectory Name="cdc">
|
||||
<File Name="../../../../components/usb_stack/class/cdc/usbd_cdc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="hid">
|
||||
<File Name="../../../../components/usb_stack/class/hid/usbd_hid.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="msc">
|
||||
<File Name="../../../../components/usb_stack/class/msc/usbd_msc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="core">
|
||||
<File Name="../../../../components/usb_stack/core/usbd_core.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<Dependencies Name="BuildSet"/>
|
||||
<Dependencies Name="CK_Link_Debug"/>
|
||||
<Dependencies Name="OpenOCD_Debug"/>
|
||||
<DebugSessions>
|
||||
<watchExpressions/>
|
||||
<memoryExpressions>0x23000000;;;</memoryExpressions>
|
||||
<statistics>;;MHZ;</statistics>
|
||||
<peripheralTabs>
|
||||
<Tab disFormat="Hex">glb</Tab>
|
||||
<Tab disFormat="Hex">uart</Tab>
|
||||
</peripheralTabs>
|
||||
<WatchDisplayFormat>1</WatchDisplayFormat>
|
||||
<LocalDisplayFormat>1</LocalDisplayFormat>
|
||||
<debugLayout/>
|
||||
<memoryTabColSizeExpressions>100:8;100:8;100:8;100:8;</memoryTabColSizeExpressions>
|
||||
</DebugSessions>
|
||||
<DebugSessions>
|
||||
<watchExpressions/>
|
||||
<memoryExpressions>;;;</memoryExpressions>
|
||||
<statistics>;;MHZ;</statistics>
|
||||
<peripheralTabs>
|
||||
<Tab disFormat="Hex">glb</Tab>
|
||||
<Tab disFormat="Hex">uart</Tab>
|
||||
</peripheralTabs>
|
||||
<WatchDisplayFormat>1</WatchDisplayFormat>
|
||||
<LocalDisplayFormat>1</LocalDisplayFormat>
|
||||
<debugLayout/>
|
||||
<memoryTabColSizeExpressions>100:8;100:8;100:8;100:8;</memoryTabColSizeExpressions>
|
||||
</DebugSessions>
|
||||
<BuildConfigs>
|
||||
<BuildConfig Name="OpenOCD_Debug">
|
||||
<Target>
|
||||
<ROMBank Selected="1">
|
||||
<ROM1>
|
||||
<InUse>no</InUse>
|
||||
<Start>0x23000000</Start>
|
||||
<Size>0x100000</Size>
|
||||
</ROM1>
|
||||
<ROM2>
|
||||
<InUse>no</InUse>
|
||||
<Start>0x22014000</Start>
|
||||
<Size>0x4000</Size>
|
||||
</ROM2>
|
||||
<ROM3>
|
||||
<InUse>no</InUse>
|
||||
<Start>0x42018000</Start>
|
||||
<Size>0x8000</Size>
|
||||
</ROM3>
|
||||
<ROM4>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
</ROM4>
|
||||
<ROM5>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
</ROM5>
|
||||
</ROMBank>
|
||||
<RAMBank>
|
||||
<RAM1>
|
||||
<InUse>yes</InUse>
|
||||
<Start>0x42020000</Start>
|
||||
<Size>0xc000</Size>
|
||||
<Init>yes</Init>
|
||||
</RAM1>
|
||||
<RAM2>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM2>
|
||||
<RAM3>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM3>
|
||||
<RAM4>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM4>
|
||||
<RAM5>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM5>
|
||||
</RAMBank>
|
||||
<CPU>rv32imafc</CPU>
|
||||
<UseMiniLib>yes</UseMiniLib>
|
||||
<Endian>little</Endian>
|
||||
<UseHardFloat>no</UseHardFloat>
|
||||
<UseEnhancedLRW>no</UseEnhancedLRW>
|
||||
<UseContinueBuild>no</UseContinueBuild>
|
||||
<UseSemiHost>no</UseSemiHost>
|
||||
</Target>
|
||||
<Output>
|
||||
<OutputName>$(ProjectName)</OutputName>
|
||||
<Type>Executable</Type>
|
||||
<CreateHexFile>no</CreateHexFile>
|
||||
<CreateBinFile>yes</CreateBinFile>
|
||||
<Preprocessor>no</Preprocessor>
|
||||
<Disassmeble>yes</Disassmeble>
|
||||
<CallGraph>no</CallGraph>
|
||||
<Map>yes</Map>
|
||||
</Output>
|
||||
<User>
|
||||
<BeforeCompile>
|
||||
<RunUserProg>no</RunUserProg>
|
||||
<UserProgName/>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg>no</RunUserProg>
|
||||
<UserProgName/>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg>no</RunUserProg>
|
||||
<UserProgName>$(ProjectPath)../../../../tools/bflb_flash_tool/bflb_mcu_tool.exe --chipname=bl702 --interface=openocd --firmware="$(ProjectPath)/Obj/$(ProjectName).bin" </UserProgName>
|
||||
</AfterMake>
|
||||
</User>
|
||||
<Compiler>
|
||||
<Define>ARCH_RISCV;BFLB_USE_HAL_DRIVER;BFLB_USE_ROM_DRIVER;bl706_iot</Define>
|
||||
<Undefine/>
|
||||
<Optim>Optimize more (-O2)</Optim>
|
||||
<DebugLevel>Default (-g)</DebugLevel>
|
||||
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../bsp/board/bl702;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/libc/inc;$(ProjectPath)../../../../common/libc/inc/arm_gcc;$(ProjectPath)../../../../common/libc/inc/bits;$(ProjectPath)../../../../common/libc/inc/sys;$(ProjectPath)../../../../common/libc/src;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)/../../../../bsp/bsp_common/mcu_lcd;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc</IncludePath>
|
||||
<OtherFlags>-fshort-enums -fno-common -fms-extensions -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wall -Wshift-negative-value -Wchar-subscripts -Wformat -Wuninitialized -Winit-self -Wignored-qualifiers -Wunused -Wundef -msmall-data-limit=4 -std=c99</OtherFlags>
|
||||
<Verbose>no</Verbose>
|
||||
<Ansi>no</Ansi>
|
||||
<Syntax>no</Syntax>
|
||||
<Pedantic>no</Pedantic>
|
||||
<PedanticErr>no</PedanticErr>
|
||||
<InhibitWarn>no</InhibitWarn>
|
||||
<AllWarn>yes</AllWarn>
|
||||
<WarnErr>no</WarnErr>
|
||||
<OneElfS>yes</OneElfS>
|
||||
<Fstrict>no</Fstrict>
|
||||
</Compiler>
|
||||
<Asm>
|
||||
<Define/>
|
||||
<Undefine/>
|
||||
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../bsp/board/bl702;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/regs;$(ProjectPath)../../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl602_driver/startup;$(ProjectPath)../../../../drivers/bl602_driver/std_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)/../../../../bsp/bsp_common/ssd1306</IncludePath>
|
||||
<OtherFlags/>
|
||||
<DebugLevel>gdwarf2</DebugLevel>
|
||||
</Asm>
|
||||
<Linker>
|
||||
<Garbage>yes</Garbage>
|
||||
<Garbage2>yes</Garbage2>
|
||||
<LDFile>$(ProjectPath)../../../../drivers/bl702_driver/bl702_flash.ld</LDFile>
|
||||
<LibName>c</LibName>
|
||||
<LibPath/>
|
||||
<OtherFlags>--specs=nano.specs -u _printf_float</OtherFlags>
|
||||
<AutoLDFile>no</AutoLDFile>
|
||||
<LinkType/>
|
||||
</Linker>
|
||||
<Debug>
|
||||
<LoadApplicationAtStartup>yes</LoadApplicationAtStartup>
|
||||
<Connector>OpenOCD</Connector>
|
||||
<StopAt>yes</StopAt>
|
||||
<StopAtText>main</StopAtText>
|
||||
<InitFile/>
|
||||
<AfterLoadFile>$(ProjectPath)/../../../../tools/openocd/bl70x_gdb.init</AfterLoadFile>
|
||||
<AutoRun>yes</AutoRun>
|
||||
<ResetType>Hard Reset</ResetType>
|
||||
<SoftResetVal>23000000</SoftResetVal>
|
||||
<ResetAfterLoad>no</ResetAfterLoad>
|
||||
<Dumpcore>no</Dumpcore>
|
||||
<DumpcoreText>$(ProjectPath)/$(ProjectName).cdkcore</DumpcoreText>
|
||||
<ConfigICE>
|
||||
<IP>localhost</IP>
|
||||
<PORT>1025</PORT>
|
||||
<CPUNumber>0</CPUNumber>
|
||||
<Clock>2000</Clock>
|
||||
<Delay>10</Delay>
|
||||
<WaitReset>50</WaitReset>
|
||||
<DDC>yes</DDC>
|
||||
<TRST>no</TRST>
|
||||
<DebugPrint>no</DebugPrint>
|
||||
<Connect>Normal</Connect>
|
||||
<ResetType>Hard Reset</ResetType>
|
||||
<SoftResetVal>21000000</SoftResetVal>
|
||||
<RTOSType>Bare Metal</RTOSType>
|
||||
<DownloadToFlash>yes</DownloadToFlash>
|
||||
<ResetAfterConnect>yes</ResetAfterConnect>
|
||||
<GDBName/>
|
||||
<GDBServerType>Local</GDBServerType>
|
||||
<OtherFlags>-arch riscv</OtherFlags>
|
||||
</ConfigICE>
|
||||
<ConfigSIM>
|
||||
<SIMTarget/>
|
||||
<OtherFlags/>
|
||||
<NoGraphic>yes</NoGraphic>
|
||||
<Log>no</Log>
|
||||
<SimTrace>no</SimTrace>
|
||||
</ConfigSIM>
|
||||
<ConfigOpenOCD>
|
||||
<OpenOCDExecutablePath>openocd-hifive</OpenOCDExecutablePath>
|
||||
<OpenOCDTelnetPortEnable>no</OpenOCDTelnetPortEnable>
|
||||
<OpenOCDTelnetPort>4444</OpenOCDTelnetPort>
|
||||
<OpenOCDTclPortEnable>no</OpenOCDTclPortEnable>
|
||||
<OpenOCDTclPort>6666</OpenOCDTclPort>
|
||||
<OpenOCDConfigOptions>-f ../../../../tools/openocd/if_rv_dbg_plus.cfg -f ../../../../tools/openocd/tgt_702.cfg</OpenOCDConfigOptions>
|
||||
</ConfigOpenOCD>
|
||||
</Debug>
|
||||
<Flash>
|
||||
<InitFile/>
|
||||
<Erase>Erase Sectors</Erase>
|
||||
<Algorithms Path="">bl70x_flasher.elf</Algorithms>
|
||||
<Program>yes</Program>
|
||||
<Verify>yes</Verify>
|
||||
<ResetAndRun>no</ResetAndRun>
|
||||
<ResetType>Hard Reset</ResetType>
|
||||
<SoftResetVal/>
|
||||
<External>yes</External>
|
||||
<Command>$(ProjectPath)/../../../../tools/bflb_flash_tool/bflb_mcu_tool.exe</Command>
|
||||
<Arguments>--chipname=bl702 --firmware="$(ProjectPath)/Obj/$(ProjectName).bin"</Arguments>
|
||||
</Flash>
|
||||
</BuildConfig>
|
||||
<BuildConfig Name="CK_Link_Debug">
|
||||
<Target>
|
||||
<ROMBank Selected="1">
|
||||
<ROM1>
|
||||
<InUse>no</InUse>
|
||||
<Start>0x23000000</Start>
|
||||
<Size>0x100000</Size>
|
||||
</ROM1>
|
||||
<ROM2>
|
||||
<InUse>no</InUse>
|
||||
<Start>0x22014000</Start>
|
||||
<Size>0x4000</Size>
|
||||
</ROM2>
|
||||
<ROM3>
|
||||
<InUse>no</InUse>
|
||||
<Start>0x42018000</Start>
|
||||
<Size>0x8000</Size>
|
||||
</ROM3>
|
||||
<ROM4>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
</ROM4>
|
||||
<ROM5>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
</ROM5>
|
||||
</ROMBank>
|
||||
<RAMBank>
|
||||
<RAM1>
|
||||
<InUse>yes</InUse>
|
||||
<Start>0x42020000</Start>
|
||||
<Size>0xc000</Size>
|
||||
<Init>yes</Init>
|
||||
</RAM1>
|
||||
<RAM2>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM2>
|
||||
<RAM3>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM3>
|
||||
<RAM4>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM4>
|
||||
<RAM5>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM5>
|
||||
</RAMBank>
|
||||
<CPU>rv32imafc</CPU>
|
||||
<UseMiniLib>yes</UseMiniLib>
|
||||
<Endian>little</Endian>
|
||||
<UseHardFloat>no</UseHardFloat>
|
||||
<UseEnhancedLRW>no</UseEnhancedLRW>
|
||||
<UseContinueBuild>no</UseContinueBuild>
|
||||
<UseSemiHost>no</UseSemiHost>
|
||||
</Target>
|
||||
<Output>
|
||||
<OutputName>$(ProjectName)</OutputName>
|
||||
<Type>Executable</Type>
|
||||
<CreateHexFile>no</CreateHexFile>
|
||||
<CreateBinFile>yes</CreateBinFile>
|
||||
<Preprocessor>no</Preprocessor>
|
||||
<Disassmeble>yes</Disassmeble>
|
||||
<CallGraph>no</CallGraph>
|
||||
<Map>yes</Map>
|
||||
</Output>
|
||||
<User>
|
||||
<BeforeCompile>
|
||||
<RunUserProg>no</RunUserProg>
|
||||
<UserProgName/>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg>no</RunUserProg>
|
||||
<UserProgName/>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg>no</RunUserProg>
|
||||
<UserProgName>$(ProjectPath)../../../../tools/bflb_flash_tool/bflb_mcu_tool.exe --chipname=bl702 --interface=openocd --firmware="$(ProjectPath)/Obj/$(ProjectName).bin" </UserProgName>
|
||||
</AfterMake>
|
||||
</User>
|
||||
<Compiler>
|
||||
<Define>ARCH_RISCV;BFLB_USE_HAL_DRIVER;bl706_iot</Define>
|
||||
<Undefine/>
|
||||
<Optim>Optimize more (-O2)</Optim>
|
||||
<DebugLevel>Default (-g)</DebugLevel>
|
||||
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl702;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/libc/inc;$(ProjectPath)../../../../common/libc/inc/arm_gcc;$(ProjectPath)../../../../common/libc/inc/bits;$(ProjectPath)../../../../common/libc/inc/sys;$(ProjectPath)../../../../common/libc/src;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc</IncludePath>
|
||||
<OtherFlags>-fshort-enums -fno-common -fms-extensions -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wall -Wshift-negative-value -Wchar-subscripts -Wformat -Wuninitialized -Winit-self -Wignored-qualifiers -Wunused -Wundef -msmall-data-limit=4 -std=c99</OtherFlags>
|
||||
<Verbose>no</Verbose>
|
||||
<Ansi>no</Ansi>
|
||||
<Syntax>no</Syntax>
|
||||
<Pedantic>no</Pedantic>
|
||||
<PedanticErr>no</PedanticErr>
|
||||
<InhibitWarn>no</InhibitWarn>
|
||||
<AllWarn>yes</AllWarn>
|
||||
<WarnErr>no</WarnErr>
|
||||
<OneElfS>yes</OneElfS>
|
||||
<Fstrict>no</Fstrict>
|
||||
</Compiler>
|
||||
<Asm>
|
||||
<Define/>
|
||||
<Undefine/>
|
||||
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl702;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl602_driver/startup;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl602_driver/regs;$(ProjectPath)../../../../drivers/bl602_driver/std_drv/inc</IncludePath>
|
||||
<OtherFlags/>
|
||||
<DebugLevel>gdwarf2</DebugLevel>
|
||||
</Asm>
|
||||
<Linker>
|
||||
<Garbage>yes</Garbage>
|
||||
<Garbage2>yes</Garbage2>
|
||||
<LDFile>$(ProjectPath)../../../../drivers/bl702_driver/bl702_flash.ld</LDFile>
|
||||
<LibName>c</LibName>
|
||||
<LibPath/>
|
||||
<OtherFlags>--specs=nano.specs</OtherFlags>
|
||||
<AutoLDFile>no</AutoLDFile>
|
||||
<LinkType/>
|
||||
</Linker>
|
||||
<Debug>
|
||||
<LoadApplicationAtStartup>yes</LoadApplicationAtStartup>
|
||||
<Connector>ICE</Connector>
|
||||
<StopAt>yes</StopAt>
|
||||
<StopAtText>main</StopAtText>
|
||||
<InitFile/>
|
||||
<AfterLoadFile>$(ProjectPath)/../../../../tools/openocd/bl70x_gdb.init</AfterLoadFile>
|
||||
<AutoRun>yes</AutoRun>
|
||||
<ResetType>Hard Reset</ResetType>
|
||||
<SoftResetVal>23000000</SoftResetVal>
|
||||
<ResetAfterLoad>no</ResetAfterLoad>
|
||||
<Dumpcore>no</Dumpcore>
|
||||
<DumpcoreText>$(ProjectPath)/$(ProjectName).cdkcore</DumpcoreText>
|
||||
<ConfigICE>
|
||||
<IP>localhost</IP>
|
||||
<PORT>1025</PORT>
|
||||
<CPUNumber>0</CPUNumber>
|
||||
<Clock>2000</Clock>
|
||||
<Delay>10</Delay>
|
||||
<WaitReset>50</WaitReset>
|
||||
<DDC>yes</DDC>
|
||||
<TRST>no</TRST>
|
||||
<DebugPrint>no</DebugPrint>
|
||||
<Connect>Normal</Connect>
|
||||
<ResetType>Hard Reset</ResetType>
|
||||
<SoftResetVal>21000000</SoftResetVal>
|
||||
<RTOSType>Bare Metal</RTOSType>
|
||||
<DownloadToFlash>yes</DownloadToFlash>
|
||||
<ResetAfterConnect>yes</ResetAfterConnect>
|
||||
<GDBName/>
|
||||
<GDBServerType>Local</GDBServerType>
|
||||
<OtherFlags>-arch riscv</OtherFlags>
|
||||
</ConfigICE>
|
||||
<ConfigSIM>
|
||||
<SIMTarget/>
|
||||
<OtherFlags/>
|
||||
<NoGraphic>yes</NoGraphic>
|
||||
<Log>no</Log>
|
||||
<SimTrace>no</SimTrace>
|
||||
</ConfigSIM>
|
||||
<ConfigOpenOCD>
|
||||
<OpenOCDExecutablePath>openocd-hifive</OpenOCDExecutablePath>
|
||||
<OpenOCDTelnetPortEnable>no</OpenOCDTelnetPortEnable>
|
||||
<OpenOCDTelnetPort>4444</OpenOCDTelnetPort>
|
||||
<OpenOCDTclPortEnable>no</OpenOCDTclPortEnable>
|
||||
<OpenOCDTclPort>6666</OpenOCDTclPort>
|
||||
<OpenOCDConfigOptions>-f ../../../../tools/openocd/if_rv_dbg_plus.cfg -f ../../../../tools/openocd/tgt_702.cfg</OpenOCDConfigOptions>
|
||||
</ConfigOpenOCD>
|
||||
</Debug>
|
||||
<Flash>
|
||||
<InitFile/>
|
||||
<Erase>Erase Sectors</Erase>
|
||||
<Algorithms Path="">bl70x_flasher.elf</Algorithms>
|
||||
<Program>yes</Program>
|
||||
<Verify>yes</Verify>
|
||||
<ResetAndRun>no</ResetAndRun>
|
||||
<ResetType>Hard Reset</ResetType>
|
||||
<SoftResetVal/>
|
||||
<External>no</External>
|
||||
<Command>$(ProjectPath)/../../../../tools/bflb_flash_tool/bflb_mcu_tool.exe</Command>
|
||||
<Arguments>--chipname=bl702 --firmware="$(ProjectPath)/Obj/$(ProjectName).bin" </Arguments>
|
||||
</Flash>
|
||||
</BuildConfig>
|
||||
</BuildConfigs>
|
||||
</Project>
|
34
examples/spi/spi_ssd1306_badapple/main.c
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include "hal_spi.h"
|
||||
#include "hal_gpio.h"
|
||||
#include "ssd1306.h"
|
||||
#include "badapple.h"
|
||||
|
||||
void oled_draw_logo(uint8_t x, uint8_t y, uint8_t index, uint8_t mode);
|
||||
void badapple_display(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
bflb_platform_init(0);
|
||||
ssd1306_init();
|
||||
|
||||
ssd1306_draw_bmp(0, 0, (unsigned char *)logo, 0, 1);
|
||||
ssd1306_refresh_gram();
|
||||
bflb_platform_delay_ms(2000);
|
||||
ssd1306_draw_bmp(0, 0, (unsigned char *)logo, 1, 1);
|
||||
ssd1306_refresh_gram();
|
||||
bflb_platform_delay_ms(2000);
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
badapple_display();
|
||||
}
|
||||
}
|
||||
|
||||
void badapple_display(void)
|
||||
{
|
||||
uint8_t t;
|
||||
for (t = 0; t < 175; t++) {
|
||||
ssd1306_draw_bmp(0, 0, (unsigned char *)Image, t, 1);
|
||||
ssd1306_refresh_gram();
|
||||
bflb_platform_delay_ms(200);
|
||||
}
|
||||
}
|
5
examples/spi/spi_ssd1306_badapple/readme.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
```bash
|
||||
|
||||
$ make APP=spi_oled_badapple BOARD=bl706_avb
|
||||
|
||||
```
|
4
examples/spi/spi_ws2812b/CMakeLists.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
set(mains main.c)
|
||||
generate_bin()
|
||||
|
||||
|
253
examples/spi/spi_ws2812b/main.c
Normal file
|
@ -0,0 +1,253 @@
|
|||
/**
|
||||
* @file main.c
|
||||
* @brief
|
||||
*
|
||||
* Copyright (c) 2021 Bouffalolab team
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "hal_spi.h"
|
||||
#include "hal_gpio.h"
|
||||
#include "hal_dma.h"
|
||||
|
||||
#define TRANSFER_LEN 1
|
||||
#define RGB24(r, g, b) ((r << 16) | (g << 8) | (b))
|
||||
|
||||
#define LED_NUM (60)
|
||||
|
||||
// static uint32_t txBuff[TRANSFER_LEN] = { 0 };
|
||||
struct device *spi_ws2812b;
|
||||
|
||||
static uint8_t color_green[24] = { 0xFC, 0xFC, 0xFC, 0xFC,
|
||||
0xFC, 0xFC, 0xFC, 0xFC,
|
||||
0xE0, 0xE0, 0xE0, 0xE0,
|
||||
0xE0, 0xE0, 0xE0, 0xE0,
|
||||
0xE0, 0xE0, 0xE0, 0xE0,
|
||||
0xE0, 0xE0, 0xE0, 0xE0 };
|
||||
|
||||
static uint8_t code01[2] = { 0xE0, 0xFC };
|
||||
|
||||
static uint32_t color_blue_24[6] = {
|
||||
0xE0E0E0E0,
|
||||
0xE0E0E0E0,
|
||||
0xE0E0E0E0,
|
||||
0xE0E0E0E0,
|
||||
0xFCFCFCFC,
|
||||
0xFCFCFCFC,
|
||||
};
|
||||
|
||||
static uint8_t tx_buf[24] = { 0 };
|
||||
|
||||
/**
|
||||
* @brief Get the rgb object
|
||||
*
|
||||
* @param x // rgb color val, must less 1530
|
||||
* @param a // led luminance, must less 8; so this is 8 position adjustment
|
||||
* @return uint32_t // rgb 24
|
||||
*/
|
||||
uint32_t get_rgb(uint32_t x, uint8_t a)
|
||||
{
|
||||
uint8_t r, g, b;
|
||||
uint16_t i = 0, j = 0;
|
||||
x %= 1530;
|
||||
i = x / 256;
|
||||
|
||||
j = x % 256;
|
||||
|
||||
switch (i) {
|
||||
case 0: {
|
||||
r = 255;
|
||||
g = 0;
|
||||
b = j;
|
||||
} break;
|
||||
|
||||
case 1: {
|
||||
r = 255 - j;
|
||||
g = 0;
|
||||
b = 255;
|
||||
} break;
|
||||
case 2: {
|
||||
r = 0;
|
||||
g = j;
|
||||
b = 255;
|
||||
} break;
|
||||
case 3: {
|
||||
r = 0;
|
||||
g = 255;
|
||||
b = 255 - j;
|
||||
} break;
|
||||
case 4: {
|
||||
r = j;
|
||||
g = 255;
|
||||
b = 0;
|
||||
} break;
|
||||
case 5: {
|
||||
r = 255;
|
||||
g = 255 - j;
|
||||
b = 0;
|
||||
} break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return RGB24((r >> a), (g >> a), (b >> a));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief color to spi send byte
|
||||
*
|
||||
* @param color
|
||||
* @param pbyte
|
||||
*/
|
||||
void color24_to_8byte(uint32_t color, uint8_t *pbyte)
|
||||
{
|
||||
uint8_t i = 0;
|
||||
uint32_t n = 0;
|
||||
|
||||
uint32_t j = 0x8000; // 24bit, G
|
||||
for (i = 0; i < 8; i++) {
|
||||
if ((color & j) == j) {
|
||||
pbyte[n] = 0xFC;
|
||||
} else {
|
||||
pbyte[n] = 0xE0;
|
||||
}
|
||||
n++;
|
||||
j >>= 1;
|
||||
}
|
||||
j = 0x800000; // 16bit, R
|
||||
for (i = 0; i < 8; i++) {
|
||||
if ((color & j) == j) {
|
||||
pbyte[n] = 0xFC;
|
||||
} else {
|
||||
pbyte[n] = 0xE0;
|
||||
}
|
||||
n++;
|
||||
j >>= 1;
|
||||
}
|
||||
j = 0x80; // 8bit, B
|
||||
for (i = 0; i < 8; i++) {
|
||||
if ((color & j) == j) {
|
||||
pbyte[n] = 0xFC;
|
||||
} else {
|
||||
pbyte[n] = 0xE0;
|
||||
}
|
||||
n++;
|
||||
j >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief spi send one led color
|
||||
*
|
||||
* @param color
|
||||
*/
|
||||
void spi_send_val(uint32_t color)
|
||||
{
|
||||
color24_to_8byte(color, tx_buf);
|
||||
|
||||
spi_transmit(spi_ws2812b, &tx_buf, 24, 0);
|
||||
// spi_transmit(spi_ws2812b, &color_green, 24, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief spi send ws2812B 0 code
|
||||
*
|
||||
*/
|
||||
void spi_send_code0(void)
|
||||
{
|
||||
// MSG("spi send 0 code 0x%x \r\n", code01[0]);
|
||||
spi_transmit(spi_ws2812b, &code01[0], 1, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief spi send ws2812B 1 code
|
||||
*
|
||||
*/
|
||||
void spi_send_code1(void)
|
||||
{
|
||||
spi_transmit(spi_ws2812b, &code01[1], 1, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
void ws2812_write_byte(uint8_t data)
|
||||
{
|
||||
uint8_t i = 0;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
if ((data & 0x80) == 0x80) {
|
||||
spi_send_code0();
|
||||
} else {
|
||||
spi_send_code1();
|
||||
}
|
||||
data = data << 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param rgb_val
|
||||
*/
|
||||
void ws2812_write_val(uint32_t rgb_val)
|
||||
{
|
||||
ws2812_write_byte((uint8_t)(rgb_val >> 8)); // G
|
||||
ws2812_write_byte((uint8_t)(rgb_val >> 16)); // R
|
||||
ws2812_write_byte((uint8_t)(rgb_val >> 0)); // B
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
uint16_t rgb_base = 0;
|
||||
uint16_t k = 51;
|
||||
uint32_t rgb_buff[LED_NUM];
|
||||
|
||||
bflb_platform_init(0);
|
||||
spi_register(SPI0_INDEX, "spi_ws2812b");
|
||||
spi_ws2812b = device_find("spi_ws2812b");
|
||||
|
||||
if (spi_ws2812b) {
|
||||
device_open(spi_ws2812b, DEVICE_OFLAG_STREAM_TX);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
uint32_t rgb_tmp = rgb_base;
|
||||
for (uint16_t i = 0; i < LED_NUM; i++) {
|
||||
rgb_buff[i] = get_rgb((rgb_tmp += k), 4);
|
||||
}
|
||||
|
||||
rgb_base += 5;
|
||||
if (rgb_base >= 1530) {
|
||||
rgb_base = 0;
|
||||
}
|
||||
|
||||
for (uint16_t i = 0; i < LED_NUM; i++) {
|
||||
spi_send_val(rgb_buff[i]);
|
||||
}
|
||||
|
||||
bflb_platform_delay_ms(1);
|
||||
}
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1)
|
||||
;
|
||||
}
|
9
examples/spi/spi_ws2812b/readme.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
将 **board/bl706_iot/peripheral_config.h** 中 **BSP_USING_SPI0** 的 spi 外设的 **clk** 配置为 **8000000**; 由于 WS2812B 的时序要求,所以 spi 发送时 clk 必须选择 **8000000**
|
||||
|
||||
**board/bl706_iot/pinmux_config.h** 中 **CONFIG_GPIO3_FUNC 、CONFIG_GPIO4_FUNC 、CONFIG_GPIO5_FUNC、CONFIG_GPIO6_FUNC** 选择 **GPIO_FUN_SPI**
|
||||
|
||||
```bash
|
||||
|
||||
$ make APP=spi_ws2812b BOARD=bl706_iot
|
||||
|
||||
```
|