[doc] update readme and rst

This commit is contained in:
jzlv 2022-11-18 16:47:16 +08:00
parent d763463e26
commit aa5a88a88e
8 changed files with 283 additions and 60 deletions

View File

@ -17,7 +17,7 @@ Note2due to the non-generic peripherals, the code style and interface name in
|:-------------:|:--------:|:-------:|
|BL602/BL604 | √ | √ |
|BL702/BL704/BL706 | √ | √ |
|BL616 | × | √ |
|BL616/BL618 | × | √ |
|BL808 | × | √ |
## LHAL Support
@ -26,7 +26,7 @@ Note2due to the non-generic peripherals, the code style and interface name in
Note**√** means supported **×** means not supported**○** means supported but not tested **-** means no such peripheral。
| Peripheral | BL602/BL604 | BL702/BL704/BL706 | BL616 | BL808 |
| Peripheral | BL602/BL604 | BL702/BL704/BL706 | BL616/BL618 | BL808 |
|:------------:|:--------------:|:--------------------:|:-----------:|:--------:|
| ADC | ○ | √ | √ | ○ |
| CAM | - | × | × | × |
@ -35,11 +35,11 @@ Note**√** means supported **×** means not supported**○** means sup
| DMA | ○ | √ | √ | √ |
| EFUSE | × | × | × | × |
| EMAC | - | √ | √ | √ |
| FLASH | × | × | × | × |
| FLASH | √ | √ | √ | √ |
| GPIO | ○ | √ | √ | √ |
| I2C | ○ | √ | √ | ○ |
| IR | ○ | √ | √ | ○ |
| MJPEG | × | × | × | × |
| MJPEG | × | × | √ | √ |
| PWM_v1 | ○ | √ | - | - |
| PWM_v2 | - | - | √ | √ |
| RTC | ○ | √ | √ | √ |
@ -47,12 +47,12 @@ Note**√** means supported **×** means not supported**○** means sup
| SEC_SHA | ○ | √ | √ | √ |
| SEC_TRNG | ○ | √ | √ | √ |
| SEC_PKA | ○ | √ | √ | √ |
| SPI | ○ | √ | √ | |
| SPI | ○ | √ | √ | |
| TIMER | ○ | √ | √ | √ |
| UART | √ | √ | √ | √ |
| USB_v1 | - | √ | - | - |
| USB_v2 | - | - | √ | √ |
| WDG | ○ | | √ | ○ |
| WDG | ○ | | √ | ○ |
## Code Framework
@ -141,7 +141,14 @@ TODO
## Debug
Only supports debug with CKLink currently. See [bl mcu sdk debug chapter](https://bl-mcu-sdk.readthedocs.io/zh_CN/latest/get_started/debug.html)。
Only supports debug with CKLink currently. See [bl mcu sdk debug chapter](https://bl-mcu-sdk.readthedocs.io/zh_CN/latest/get_started/debug.html).
## Firmware Download
We recommend you to use this **BL DevCube** and download firmware with serial.
- [BL DevCube Tool](https://dev.bouffalolab.com/download)
- [BL DevCube download guide](https://bl-mcu-sdk.readthedocs.io/zh_CN/latest/get_started/devcube.html)
# Resources

View File

@ -17,7 +17,7 @@
|:-------------:|:--------:|:-------:|
|BL602/BL604 | √ | √ |
|BL702/BL704/BL706 | √ | √ |
|BL616 | × | √ |
|BL616/BL618 | × | √ |
|BL808 | × | √ |
## LHAL 支持情况
@ -26,7 +26,7 @@
备注:**√** 表示已支持;**×** 表示未支持;**○** 表示已支持但未测试;**-** 表示没有该外设。
| 外设 | BL602/BL604 | BL702/BL704/BL706 | BL616 | BL808 |
| 外设 | BL602/BL604 | BL702/BL704/BL706 | BL616/BL618 | BL808 |
|:------------:|:--------------:|:--------------------:|:-----------:|:--------:|
| ADC | ○ | √ | √ | ○ |
| CAM | - | × | × | × |
@ -35,11 +35,11 @@
| DMA | ○ | √ | √ | √ |
| EFUSE | × | × | × | × |
| EMAC | - | √ | √ | √ |
| FLASH | × | × | × | × |
| FLASH | √ | √ | √ | √ |
| GPIO | ○ | √ | √ | √ |
| I2C | ○ | √ | √ | ○ |
| IR | ○ | √ | √ | ○ |
| MJPEG | × | × | × | × |
| MJPEG | × | × | √ | √ |
| PWM_v1 | ○ | √ | - | - |
| PWM_v2 | - | - | √ | √ |
| RTC | ○ | √ | √ | √ |
@ -47,12 +47,12 @@
| SEC_SHA | ○ | √ | √ | √ |
| SEC_TRNG | ○ | √ | √ | √ |
| SEC_PKA | ○ | √ | √ | √ |
| SPI | ○ | √ | √ | |
| SPI | ○ | √ | √ | |
| TIMER | ○ | √ | √ | √ |
| UART | √ | √ | √ | √ |
| USB_v1 | - | √ | - | - |
| USB_v2 | - | - | √ | √ |
| WDG | ○ | | √ | ○ |
| WDG | ○ | | √ | ○ |
# 代码框架
@ -143,6 +143,13 @@ TODO
当前仅支持使用 CKLink 调试。详细参考 [bl mcu sdk 调试章节](https://bl-mcu-sdk.readthedocs.io/zh_CN/latest/get_started/debug.html)。
## 固件烧录
推荐使用 **BL DevCube** 并通过串口进行固件的烧录。
- [BL DevCube Tool](https://dev.bouffalolab.com/download)
- [BL DevCube download guide](https://bl-mcu-sdk.readthedocs.io/zh_CN/latest/get_started/devcube.html)
# 芯片手册
芯片数据手册和参考手册见 [文档](https://dev.bouffalolab.com/document)。

View File

@ -12,7 +12,7 @@ adc channel
adc clock div
^^^^^^^^^^^^^^^^^^^^
对 adc 时钟再一次进行分频。
对 adc 时钟再一次进行分频。分频后的时钟必须小于 2M。
.. code-block:: c
:linenos:
@ -247,8 +247,6 @@ bflb_adc_start_conversion
* - dev
- 设备句柄
.. warning:: 没有开启连续转换时,下次采集需要先关闭 adc 采集并等待 100us 以后方可调用该函数。
bflb_adc_stop_conversion
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -439,4 +437,46 @@ bflb_adc_parse_result
* - result
- 输出结果
* - count
- 转换个数
- 转换个数
bflb_adc_tsen_init
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 初始化 adc tsen 模块。
.. code-block:: c
:linenos:
void bflb_adc_tsen_init(struct bflb_device_s *dev, uint8_t tsen_mod);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - tsen_mod
- 模式选择
bflb_adc_tsen_get_temp
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 初始化 adc tsen 模块。
.. code-block:: c
:linenos:
float bflb_adc_tsen_get_temp(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - return
- 温度

View File

@ -40,12 +40,11 @@ bflb_clk_get_system_clock
.. code-block:: c
:linenos:
#define BFLB_SYSTEM_ROOT_CLOCK 0
#define BFLB_SYSTEM_CPU_CLK 1
#define BFLB_SYSTEM_PBCLK 2
#define BFLB_SYSTEM_XCLK 3
#define BFLB_SYSTEM_32K_CLK 4
#define BFLB_SYSTEM_1K_CLK 5
#define BFLB_SYSTEM_ROOT_CLOCK 0
#define BFLB_SYSTEM_CPU_CLK 1
#define BFLB_SYSTEM_PBCLK 2
#define BFLB_SYSTEM_XCLK 3
#define BFLB_SYSTEM_32K_CLK 4
bflb_clk_get_peripheral_clock
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -75,35 +74,39 @@ bflb_clk_get_peripheral_clock
.. code-block:: c
:linenos:
#define BFLB_DEVICE_TYPE_ADC 0
#define BFLB_DEVICE_TYPE_DAC 1
#define BFLB_DEVICE_TYPE_AUDIOADC 2
#define BFLB_DEVICE_TYPE_AUDIODAC 3
#define BFLB_DEVICE_TYPE_GPIO 4
#define BFLB_DEVICE_TYPE_UART 5
#define BFLB_DEVICE_TYPE_SPI 6
#define BFLB_DEVICE_TYPE_I2C 7
#define BFLB_DEVICE_TYPE_DMA 8
#define BFLB_DEVICE_TYPE_I2S 9
#define BFLB_DEVICE_TYPE_IR 10
#define BFLB_DEVICE_TYPE_TIMER 11
#define BFLB_DEVICE_TYPE_PWM 12
#define BFLB_DEVICE_TYPE_ISO11898 13
#define BFLB_DEVICE_TYPE_CAMERA 14
#define BFLB_DEVICE_TYPE_FLASH 15
#define BFLB_DEVICE_TYPE_QSPI 16
#define BFLB_DEVICE_TYPE_SDH 17
#define BFLB_DEVICE_TYPE_SDU 18
#define BFLB_DEVICE_TYPE_ETH 19
#define BFLB_DEVICE_TYPE_RTC 20
#define BFLB_DEVICE_TYPE_CRC 21
#define BFLB_DEVICE_TYPE_RNG 22
#define BFLB_DEVICE_TYPE_MIPI 23
#define BFLB_DEVICE_TYPE_DPI 24
#define BFLB_DEVICE_TYPE_DSI 25
#define BFLB_DEVICE_TYPE_CSI 26
#define BFLB_DEVICE_TYPE_USB 27
#define BFLB_DEVICE_TYPE_AES 28
#define BFLB_DEVICE_TYPE_SHA 29
#define BFLB_DEVICE_TYPE_MD5 30
#define BFLB_DEVICE_TYPE_TRNG 31
#define BFLB_DEVICE_TYPE_ADC 0
#define BFLB_DEVICE_TYPE_DAC 1
#define BFLB_DEVICE_TYPE_AUDIOADC 2
#define BFLB_DEVICE_TYPE_AUDIODAC 3
#define BFLB_DEVICE_TYPE_GPIO 4
#define BFLB_DEVICE_TYPE_UART 5
#define BFLB_DEVICE_TYPE_SPI 6
#define BFLB_DEVICE_TYPE_I2C 7
#define BFLB_DEVICE_TYPE_DMA 8
#define BFLB_DEVICE_TYPE_I2S 9
#define BFLB_DEVICE_TYPE_IR 10
#define BFLB_DEVICE_TYPE_TIMER 11
#define BFLB_DEVICE_TYPE_PWM 12
#define BFLB_DEVICE_TYPE_ISO11898 13
#define BFLB_DEVICE_TYPE_CAMERA 14
#define BFLB_DEVICE_TYPE_FLASH 15
#define BFLB_DEVICE_TYPE_QSPI 16
#define BFLB_DEVICE_TYPE_SDH 17
#define BFLB_DEVICE_TYPE_SDU 18
#define BFLB_DEVICE_TYPE_ETH 19
#define BFLB_DEVICE_TYPE_RTC 20
#define BFLB_DEVICE_TYPE_CRC 21
#define BFLB_DEVICE_TYPE_RNG 22
#define BFLB_DEVICE_TYPE_MIPI 23
#define BFLB_DEVICE_TYPE_DPI 24
#define BFLB_DEVICE_TYPE_DSI 25
#define BFLB_DEVICE_TYPE_CSI 26
#define BFLB_DEVICE_TYPE_USB 27
#define BFLB_DEVICE_TYPE_AES 28
#define BFLB_DEVICE_TYPE_SHA 29
#define BFLB_DEVICE_TYPE_MD5 30
#define BFLB_DEVICE_TYPE_TRNG 31
#define BFLB_DEVICE_TYPE_PKA 32
#define BFLB_DEVICE_TYPE_CKS 33
#define BFLB_DEVICE_TYPE_MJPEG 34

View File

@ -289,7 +289,7 @@ bflb_dma_channel_irq_detach
bflb_dma_channel_lli_reload
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取 dma 通道完成中断状态
说明: 配置 dma 通道的 lli 信息
.. code-block:: c
:linenos:

View File

@ -126,7 +126,7 @@ Functions
bflb_gpio_init
^^^^^^^^^^^^^^^^^^^^
说明: 初始化 gpio。如果使用到 UART 功能,需要使用 `bflb_gpio_uart_init` 替代
说明: 初始化 gpio。如果配置为 UART 功能,请使用 `bflb_gpio_uart_init`
.. code-block:: c
:linenos:

View File

@ -4,12 +4,178 @@ PWM_v1
Macros
------------
pwm channel
^^^^^^^^^^^^^^
PWM V1 版本共 5个 pwm 通道。
Structs
------------
struct bflb_pwm_v1_channel_config_s
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pwm v1 初始化配置结构体。
.. code-block:: c
:linenos:
struct bflb_pwm_v1_channel_config_s {
uint8_t clk_source;
uint16_t clk_div;
uint16_t period;
};
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - clk_source
- 时钟源选择PBCLK or XCLK or 32K_CLK
* - clk_div
- 分频值
* - period
- 周期值
.. note:: PWM 最终产生的频率 = clk_source/clk_div/period
Functions
------------
------------
bflb_pwm_v1_channel_init
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 初始化 pwm 通道。使用之前需要选择 gpio 为 pwm 功能。
.. code-block:: c
:linenos:
void bflb_pwm_v1_channel_init(struct bflb_device_s *dev, uint8_t ch, const struct bflb_pwm_v1_channel_config_s *config);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道号
* - config
- 配置项
bflb_pwm_v1_channel_deinit
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 复位 pwm 通道。
.. code-block:: c
:linenos:
void bflb_pwm_v1_channel_deinit(struct bflb_device_s *dev, uint8_t ch);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道号
bflb_pwm_v1_start
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 启动 pwm 通道输出。
.. code-block:: c
:linenos:
void bflb_pwm_v1_start(struct bflb_device_s *dev, uint8_t ch);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道号
bflb_pwm_v1_stop
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 关闭 pwm 通道输出。
.. code-block:: c
:linenos:
void bflb_pwm_v1_stop(struct bflb_device_s *dev, uint8_t ch);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道号
bflb_pwm_v1_set_period
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 修改 pwm 通道周期值,从而更改 pwm 通道输出的频率。
.. code-block:: c
:linenos:
void bflb_pwm_v1_set_period(struct bflb_device_s *dev, uint8_t ch, uint16_t period);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道号
* - period
- 周期值
bflb_pwm_v1_channel_set_threshold
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 设置 pwm 占空比。
.. code-block:: c
:linenos:
void bflb_pwm_v1_channel_set_threshold(struct bflb_device_s *dev, uint8_t ch, uint16_t low_threhold, uint16_t high_threhold);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道号
* - low_threhold
- 低阈值
* - high_threhold
- 高阈值,需要大于 low_threhold并且小于等于 period
.. note:: PWM 占空比 = (high_threhold - low_threhold)/period

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB