[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

@ -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

Before After
Before After