feat: 完成控制代码编写
This commit is contained in:
@@ -1 +1,185 @@
|
||||
ENTRY( _start )
|
||||
ENTRY( _start )
|
||||
|
||||
__stack_size = 2048;
|
||||
|
||||
PROVIDE( _stack_size = __stack_size );
|
||||
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/* CH32V30x_D8C - CH32V305RB-CH32V305FB
|
||||
CH32V30x_D8 - CH32V303CB-CH32V303RB
|
||||
*/
|
||||
/*
|
||||
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 128K
|
||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
|
||||
*/
|
||||
|
||||
/* CH32V30x_D8C - CH32V307VC-CH32V307WC-CH32V307RC
|
||||
CH32V30x_D8 - CH32V303VC-CH32V303RC
|
||||
FLASH + RAM supports the following configuration
|
||||
FLASH-192K + RAM-128K
|
||||
FLASH-224K + RAM-96K
|
||||
FLASH-256K + RAM-64K
|
||||
FLASH-288K + RAM-32K
|
||||
*/
|
||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
|
||||
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 288K
|
||||
}
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
.init :
|
||||
{
|
||||
_sinit = .;
|
||||
. = ALIGN(4);
|
||||
KEEP(*(SORT_NONE(.init)))
|
||||
. = ALIGN(4);
|
||||
_einit = .;
|
||||
} >FLASH AT>FLASH
|
||||
|
||||
.vector :
|
||||
{
|
||||
*(.vector);
|
||||
. = ALIGN(64);
|
||||
} >FLASH AT>FLASH
|
||||
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
*(.rodata)
|
||||
*(.rodata*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.gnu.linkonce.t.*)
|
||||
. = ALIGN(4);
|
||||
} >FLASH AT>FLASH
|
||||
|
||||
.fini :
|
||||
{
|
||||
KEEP(*(SORT_NONE(.fini)))
|
||||
. = ALIGN(4);
|
||||
} >FLASH AT>FLASH
|
||||
|
||||
PROVIDE( _etext = . );
|
||||
PROVIDE( _eitcm = . );
|
||||
|
||||
.preinit_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP (*(.preinit_array))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
} >FLASH AT>FLASH
|
||||
|
||||
.init_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
|
||||
KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
} >FLASH AT>FLASH
|
||||
|
||||
.fini_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
|
||||
KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
} >FLASH AT>FLASH
|
||||
|
||||
.ctors :
|
||||
{
|
||||
/* gcc uses crtbegin.o to find the start of
|
||||
the constructors, so we make sure it is
|
||||
first. Because this is a wildcard, it
|
||||
doesn't matter if the user does not
|
||||
actually link against crtbegin.o; the
|
||||
linker won't look for a file to match a
|
||||
wildcard. The wildcard also means that it
|
||||
doesn't matter which directory crtbegin.o
|
||||
is in. */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*crtbegin?.o(.ctors))
|
||||
/* We don't want to include the .ctor section from
|
||||
the crtend.o file until after the sorted ctors.
|
||||
The .ctor section from the crtend file contains the
|
||||
end of ctors marker and it must be last */
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
} >FLASH AT>FLASH
|
||||
|
||||
.dtors :
|
||||
{
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*crtbegin?.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
} >FLASH AT>FLASH
|
||||
|
||||
.dalign :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
PROVIDE(_data_vma = .);
|
||||
} >RAM AT>FLASH
|
||||
|
||||
.dlalign :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
PROVIDE(_data_lma = .);
|
||||
} >FLASH AT>FLASH
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.gnu.linkonce.r.*)
|
||||
*(.data .data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
. = ALIGN(8);
|
||||
PROVIDE( __global_pointer$ = . + 0x800 );
|
||||
*(.sdata .sdata.*)
|
||||
*(.sdata2.*)
|
||||
*(.gnu.linkonce.s.*)
|
||||
. = ALIGN(8);
|
||||
*(.srodata.cst16)
|
||||
*(.srodata.cst8)
|
||||
*(.srodata.cst4)
|
||||
*(.srodata.cst2)
|
||||
*(.srodata .srodata.*)
|
||||
. = ALIGN(4);
|
||||
PROVIDE( _edata = .);
|
||||
} >RAM AT>FLASH
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
PROVIDE( _sbss = .);
|
||||
*(.sbss*)
|
||||
*(.gnu.linkonce.sb.*)
|
||||
*(.bss*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON*)
|
||||
. = ALIGN(4);
|
||||
PROVIDE( _ebss = .);
|
||||
} >RAM AT>FLASH
|
||||
|
||||
PROVIDE( _end = _ebss);
|
||||
PROVIDE( end = . );
|
||||
|
||||
.stack ORIGIN(RAM) + LENGTH(RAM) - __stack_size :
|
||||
{
|
||||
PROVIDE( _heap_end = . );
|
||||
. = ALIGN(4);
|
||||
PROVIDE(_susrstack = . );
|
||||
. = . + __stack_size;
|
||||
PROVIDE( _eusrstack = .);
|
||||
} >RAM
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -228,7 +228,7 @@ uint8 imu660ra_init(void)
|
||||
#if IMU660RA_USE_SOFT_IIC
|
||||
soft_iic_init(&imu660ra_iic_struct, IMU660RA_DEV_ADDR, IMU660RA_SOFT_IIC_DELAY, IMU660RA_SCL_PIN, IMU660RA_SDA_PIN); // 配置 IMU660RA 的 IIC 端口
|
||||
#else
|
||||
spi_init(IMU660RA_SPI, SPI_MODE0, IMU660RA_SPI_SPEED, IMU660RA_SPC_PIN, IMU660RA_SDI_PIN, IMU660RA_SDO_PIN, SPI_CS_NULL); // 配置 IMU660RA 的 SPI 端口
|
||||
spi_init(IMU660RA_SPI, SPI_MODE0, IMU660RA_SPI_SPEED, IMU660RA_SPC_PIN, IMU660RA_SDI_PIN, IMU660RA_SDO_PIN, IMU660RA_CS_PIN); // 配置 IMU660RA 的 SPI 端口
|
||||
gpio_init(IMU660RA_CS_PIN, GPO, GPIO_HIGH, GPO_PUSH_PULL); // 配置 IMU660RA 的 CS 端口
|
||||
imu660ra_read_register(IMU660RA_CHIP_ID); // 读取一下设备 ID 将设备设置为 SPI 模式
|
||||
#endif
|
||||
|
||||
@@ -62,21 +62,21 @@
|
||||
#if IMU660RA_USE_SOFT_IIC // 这两段 颜色正常的才是正确的 颜色灰的就是没有用的
|
||||
//====================================================软件 IIC 驱动====================================================
|
||||
#define IMU660RA_SOFT_IIC_DELAY (10) // 软件 IIC 的时钟延时周期 数值越小 IIC 通信速率越快
|
||||
#define IMU660RA_SCL_PIN (E7) // 软件 IIC SCL 引脚 连接 IMU660RA 的 SCL 引脚
|
||||
#define IMU660RA_SDA_PIN (E8) // 软件 IIC SDA 引脚 连接 IMU660RA 的 SDA 引脚
|
||||
#define IMU660RA_SCL_PIN (B3) // 软件 IIC SCL 引脚 连接 IMU660RA 的 SCL 引脚
|
||||
#define IMU660RA_SDA_PIN (B5) // 软件 IIC SDA 引脚 连接 IMU660RA 的 SDA 引脚
|
||||
//====================================================软件 IIC 驱动====================================================
|
||||
#else
|
||||
|
||||
//====================================================硬件 SPI 驱动====================================================
|
||||
#define IMU660RA_SPI_SPEED (10 * 1000 * 1000) // 硬件 SPI 速率
|
||||
#define IMU660RA_SPI SPI_3 // 硬件 SPI 号
|
||||
#define IMU660RA_SPC_PIN SPI3_MAP0_SCK_B3 // 硬件 SPI SCK 引脚
|
||||
#define IMU660RA_SDI_PIN SPI3_MAP0_MOSI_B5 // 硬件 SPI MOSI 引脚
|
||||
#define IMU660RA_SDO_PIN SPI3_MAP0_MISO_B4 // 硬件 SPI MISO 引脚
|
||||
#define IMU660RA_SPI SPI_1 // 硬件 SPI 号
|
||||
#define IMU660RA_SPC_PIN SPI1_MAP1_SCK_B3 // 硬件 SPI SCK 引脚
|
||||
#define IMU660RA_SDI_PIN SPI1_MAP1_MOSI_B5 // 硬件 SPI MOSI 引脚
|
||||
#define IMU660RA_SDO_PIN SPI1_MAP1_MISO_B4 // 硬件 SPI MISO 引脚
|
||||
|
||||
//====================================================硬件 SPI 驱动====================================================
|
||||
#endif
|
||||
#define IMU660RA_CS_PIN (C10) // CS 片选引脚
|
||||
#define IMU660RA_CS_PIN (B6) // CS 片选引脚
|
||||
#define IMU660RA_CS(x) ((x) ? (gpio_high(IMU660RA_CS_PIN)) : (gpio_low(IMU660RA_CS_PIN)))
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
/*********************************************************************************************************************
|
||||
* CH32V307VCT6 Opensourec Library 即(CH32V307VCT6 开源库)是一个基于官方 SDK 接口的第三方开源库
|
||||
* Copyright (c) 2022 SEEKFREE 逐飞科技
|
||||
*
|
||||
* 本文件是CH32V307VCT6 开源库的一部分
|
||||
*
|
||||
* CH32V307VCT6 开源库 是免费软件
|
||||
* 您可以根据自由软件基金会发布的 GPL(GNU General Public License,即 GNU通用公共许可证)的条款
|
||||
* 即 GPL 的第3版(即 GPL3.0)或(您选择的)任何后来的版本,重新发布和/或修改它
|
||||
*
|
||||
* 本开源库的发布是希望它能发挥作用,但并未对其作任何的保证
|
||||
* 甚至没有隐含的适销性或适合特定用途的保证
|
||||
* 更多细节请参见 GPL
|
||||
*
|
||||
* 您应该在收到本开源库的同时收到一份 GPL 的副本
|
||||
* 如果没有,请参阅<https://www.gnu.org/licenses/>
|
||||
*
|
||||
* 额外注明:
|
||||
* 本开源库使用 GPL3.0 开源许可证协议 以上许可申明为译文版本
|
||||
* 许可申明英文版在 libraries/doc 文件夹下的 GPL3_permission_statement.txt 文件中
|
||||
* 许可证副本在 libraries 文件夹下 即该文件夹下的 LICENSE 文件
|
||||
* 欢迎各位使用并传播本程序 但修改内容时必须保留逐飞科技的版权声明(即本声明)
|
||||
*
|
||||
* 文件名称 zf_driver_soft_iic
|
||||
* 公司名称 成都逐飞科技有限公司
|
||||
* 版本信息 查看 libraries/doc 文件夹内 version 文件 版本说明
|
||||
* 开发环境 MounRiver Studio V1.8.1
|
||||
* 适用平台 CH32V307VCT6
|
||||
* 店铺链接 https://seekfree.taobao.com/
|
||||
*
|
||||
* 修改记录
|
||||
* 日期 作者 备注
|
||||
* 2022-09-15 大W first version
|
||||
********************************************************************************************************************/
|
||||
* CH32V307VCT6 Opensourec Library 即(CH32V307VCT6 开源库)是一个基于官方 SDK 接口的第三方开源库
|
||||
* Copyright (c) 2022 SEEKFREE 逐飞科技
|
||||
*
|
||||
* 本文件是CH32V307VCT6 开源库的一部分
|
||||
*
|
||||
* CH32V307VCT6 开源库 是免费软件
|
||||
* 您可以根据自由软件基金会发布的 GPL(GNU General Public License,即 GNU通用公共许可证)的条款
|
||||
* 即 GPL 的第3版(即 GPL3.0)或(您选择的)任何后来的版本,重新发布和/或修改它
|
||||
*
|
||||
* 本开源库的发布是希望它能发挥作用,但并未对其作任何的保证
|
||||
* 甚至没有隐含的适销性或适合特定用途的保证
|
||||
* 更多细节请参见 GPL
|
||||
*
|
||||
* 您应该在收到本开源库的同时收到一份 GPL 的副本
|
||||
* 如果没有,请参阅<https://www.gnu.org/licenses/>
|
||||
*
|
||||
* 额外注明:
|
||||
* 本开源库使用 GPL3.0 开源许可证协议 以上许可申明为译文版本
|
||||
* 许可申明英文版在 libraries/doc 文件夹下的 GPL3_permission_statement.txt 文件中
|
||||
* 许可证副本在 libraries 文件夹下 即该文件夹下的 LICENSE 文件
|
||||
* 欢迎各位使用并传播本程序 但修改内容时必须保留逐飞科技的版权声明(即本声明)
|
||||
*
|
||||
* 文件名称 zf_driver_soft_iic
|
||||
* 公司名称 成都逐飞科技有限公司
|
||||
* 版本信息 查看 libraries/doc 文件夹内 version 文件 版本说明
|
||||
* 开发环境 MounRiver Studio V1.8.1
|
||||
* 适用平台 CH32V307VCT6
|
||||
* 店铺链接 https://seekfree.taobao.com/
|
||||
*
|
||||
* 修改记录
|
||||
* 日期 作者 备注
|
||||
* 2022-09-15 大W first version
|
||||
********************************************************************************************************************/
|
||||
|
||||
#include "zf_common_debug.h"
|
||||
|
||||
#include "zf_driver_soft_iic.h"
|
||||
|
||||
#define SOFT_IIC_SDA_IO_SWITCH (0) // 是否需要 SDA 进行 I/O 切换 0-不需要 1-需要
|
||||
#define SOFT_IIC_SDA_IO_SWITCH (0) // 是否需要 SDA 进行 I/O 切换 0-不需要 1-需要
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// 函数简介 软件 IIC 延时
|
||||
@@ -46,12 +46,12 @@
|
||||
// 使用示例 soft_iic_delay(1);
|
||||
// 备注信息 内部调用
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
//static void soft_iic_delay (vuint32 delay)
|
||||
// static void soft_iic_delay (vuint32 delay)
|
||||
//{
|
||||
// volatile uint32 count = delay;
|
||||
// while(count --);
|
||||
//}
|
||||
#define soft_iic_delay(x) for(uint32 i = x; i--; )
|
||||
#define soft_iic_delay(x) for (uint32 i = x; i--;)
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// 函数简介 软件 IIC START 信号
|
||||
@@ -60,16 +60,16 @@
|
||||
// 使用示例 soft_iic_start(soft_iic_obj);
|
||||
// 备注信息 内部调用
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
static void soft_iic_start (soft_iic_info_struct *soft_iic_obj)
|
||||
static void soft_iic_start(soft_iic_info_struct *soft_iic_obj)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
gpio_high(soft_iic_obj->scl_pin); // SCL 高电平
|
||||
gpio_high(soft_iic_obj->sda_pin); // SDA 高电平
|
||||
gpio_high(soft_iic_obj->scl_pin); // SCL 高电平
|
||||
gpio_high(soft_iic_obj->sda_pin); // SDA 高电平
|
||||
|
||||
soft_iic_delay(soft_iic_obj->delay);
|
||||
gpio_low(soft_iic_obj->sda_pin); // SDA 先拉低
|
||||
gpio_low(soft_iic_obj->sda_pin); // SDA 先拉低
|
||||
soft_iic_delay(soft_iic_obj->delay);
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 再拉低
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 再拉低
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
@@ -79,16 +79,16 @@ static void soft_iic_start (soft_iic_info_struct *soft_iic_obj)
|
||||
// 使用示例 soft_iic_stop(soft_iic_obj);
|
||||
// 备注信息 内部调用
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
static void soft_iic_stop (soft_iic_info_struct *soft_iic_obj)
|
||||
static void soft_iic_stop(soft_iic_info_struct *soft_iic_obj)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
gpio_low(soft_iic_obj->sda_pin); // SDA 低电平
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 低电平
|
||||
gpio_low(soft_iic_obj->sda_pin); // SDA 低电平
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 低电平
|
||||
|
||||
soft_iic_delay(soft_iic_obj->delay);
|
||||
gpio_high(soft_iic_obj->scl_pin); // SCL 先拉高
|
||||
gpio_high(soft_iic_obj->scl_pin); // SCL 先拉高
|
||||
soft_iic_delay(soft_iic_obj->delay);
|
||||
gpio_high(soft_iic_obj->sda_pin); // SDA 再拉高
|
||||
gpio_high(soft_iic_obj->sda_pin); // SDA 再拉高
|
||||
soft_iic_delay(soft_iic_obj->delay);
|
||||
}
|
||||
|
||||
@@ -100,25 +100,22 @@ static void soft_iic_stop (soft_iic_info_struct *soft_iic_obj)
|
||||
// 使用示例 soft_iic_send_ack(soft_iic_obj, 1);
|
||||
// 备注信息 内部调用
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
static void soft_iic_send_ack (soft_iic_info_struct *soft_iic_obj, uint8 ack)
|
||||
static void soft_iic_send_ack(soft_iic_info_struct *soft_iic_obj, uint8 ack)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 低电平
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 低电平
|
||||
|
||||
if(ack)
|
||||
{
|
||||
gpio_high(soft_iic_obj->sda_pin); // SDA 拉高
|
||||
}
|
||||
else
|
||||
{
|
||||
gpio_low(soft_iic_obj->sda_pin); // SDA 拉低
|
||||
if (ack) {
|
||||
gpio_high(soft_iic_obj->sda_pin); // SDA 拉高
|
||||
} else {
|
||||
gpio_low(soft_iic_obj->sda_pin); // SDA 拉低
|
||||
}
|
||||
|
||||
soft_iic_delay(soft_iic_obj->delay);
|
||||
gpio_high(soft_iic_obj->scl_pin); // SCL 拉高
|
||||
gpio_high(soft_iic_obj->scl_pin); // SCL 拉高
|
||||
soft_iic_delay(soft_iic_obj->delay);
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 拉低
|
||||
gpio_high(soft_iic_obj->sda_pin); // SDA 拉高
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 拉低
|
||||
gpio_high(soft_iic_obj->sda_pin); // SDA 拉高
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
@@ -128,25 +125,24 @@ static void soft_iic_send_ack (soft_iic_info_struct *soft_iic_obj, uint8 ack)
|
||||
// 使用示例 soft_iic_wait_ack(soft_iic_obj);
|
||||
// 备注信息 内部调用
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
static uint8 soft_iic_wait_ack (soft_iic_info_struct *soft_iic_obj)
|
||||
static uint8 soft_iic_wait_ack(soft_iic_info_struct *soft_iic_obj)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
uint8 temp = 0;
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 低电平
|
||||
gpio_high(soft_iic_obj->sda_pin); // SDA 高电平 释放 SDA
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 低电平
|
||||
gpio_high(soft_iic_obj->sda_pin); // SDA 高电平 释放 SDA
|
||||
#if SOFT_IIC_SDA_IO_SWITCH
|
||||
gpio_set_dir(soft_iic_obj->sda_pin, GPI, GPI_FLOATING_IN);
|
||||
#endif
|
||||
soft_iic_delay(soft_iic_obj->delay);
|
||||
|
||||
gpio_high(soft_iic_obj->scl_pin); // SCL 高电平
|
||||
gpio_high(soft_iic_obj->scl_pin); // SCL 高电平
|
||||
soft_iic_delay(soft_iic_obj->delay);
|
||||
|
||||
if(gpio_get_level((gpio_pin_enum)soft_iic_obj->sda_pin))
|
||||
{
|
||||
if (gpio_get_level((gpio_pin_enum)soft_iic_obj->sda_pin)) {
|
||||
temp = 1;
|
||||
}
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 低电平
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 低电平
|
||||
#if SOFT_IIC_SDA_IO_SWITCH
|
||||
gpio_set_dir(soft_iic_obj->sda_pin, GPO, GPO_OPEN_DTAIN);
|
||||
#endif
|
||||
@@ -162,22 +158,21 @@ static uint8 soft_iic_wait_ack (soft_iic_info_struct *soft_iic_obj)
|
||||
// 返回参数 uint8 ACK 状态
|
||||
// 备注信息 内部调用
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
static uint8 soft_iic_send_data (soft_iic_info_struct *soft_iic_obj, const uint8 data)
|
||||
static uint8 soft_iic_send_data(soft_iic_info_struct *soft_iic_obj, const uint8 data)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
uint8 temp = 0x80;
|
||||
while(temp)
|
||||
{
|
||||
// gpio_set_level(soft_iic_obj->sda_pin, data & temp);
|
||||
while (temp) {
|
||||
// gpio_set_level(soft_iic_obj->sda_pin, data & temp);
|
||||
((data & temp) ? (gpio_high(soft_iic_obj->sda_pin)) : (gpio_low(soft_iic_obj->sda_pin)));
|
||||
temp >>= 1;
|
||||
|
||||
soft_iic_delay(soft_iic_obj->delay);
|
||||
gpio_high(soft_iic_obj->scl_pin); // SCL 拉高
|
||||
gpio_high(soft_iic_obj->scl_pin); // SCL 拉高
|
||||
soft_iic_delay(soft_iic_obj->delay);
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 拉低
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 拉低
|
||||
}
|
||||
return ((soft_iic_wait_ack(soft_iic_obj) == 1) ? 0 : 1 );
|
||||
return ((soft_iic_wait_ack(soft_iic_obj) == 1) ? 0 : 1);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
@@ -187,27 +182,26 @@ static uint8 soft_iic_send_data (soft_iic_info_struct *soft_iic_obj, const uint8
|
||||
// 返回参数 uint8 数据
|
||||
// 备注信息 内部调用
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
static uint8 soft_iic_read_data (soft_iic_info_struct *soft_iic_obj, uint8 ack)
|
||||
static uint8 soft_iic_read_data(soft_iic_info_struct *soft_iic_obj, uint8 ack)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
uint8 data = 0x00;
|
||||
uint8 temp = 8;
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 低电平
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 低电平
|
||||
soft_iic_delay(soft_iic_obj->delay);
|
||||
gpio_high(soft_iic_obj->sda_pin); // SDA 高电平 释放 SDA
|
||||
gpio_high(soft_iic_obj->sda_pin); // SDA 高电平 释放 SDA
|
||||
#if SOFT_IIC_SDA_IO_SWITCH
|
||||
gpio_set_dir(soft_iic_obj->sda_pin, GPI, GPI_FLOATING_IN);
|
||||
#endif
|
||||
|
||||
while(temp --)
|
||||
{
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 拉低
|
||||
while (temp--) {
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 拉低
|
||||
soft_iic_delay(soft_iic_obj->delay);
|
||||
gpio_high(soft_iic_obj->scl_pin); // SCL 拉高
|
||||
gpio_high(soft_iic_obj->scl_pin); // SCL 拉高
|
||||
soft_iic_delay(soft_iic_obj->delay);
|
||||
data = ((data << 1) | gpio_get_level((gpio_pin_enum)soft_iic_obj->sda_pin));
|
||||
}
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 低电平
|
||||
gpio_low(soft_iic_obj->scl_pin); // SCL 低电平
|
||||
#if SOFT_IIC_SDA_IO_SWITCH
|
||||
gpio_set_dir(soft_iic_obj->sda_pin, GPO, GPO_OPEN_DTAIN);
|
||||
#endif
|
||||
@@ -220,11 +214,11 @@ static uint8 soft_iic_read_data (soft_iic_info_struct *soft_iic_obj, uint8 ack)
|
||||
// 函数简介 软件 IIC 接口写 8bit 数据
|
||||
// 参数说明 *soft_iic_obj 软件 IIC 指定信息 可以参照 zf_driver_soft_iic.h 里的格式看看
|
||||
// 参数说明 data 要写入的数据
|
||||
// 返回参数 void
|
||||
// 返回参数 void
|
||||
// 使用示例 soft_iic_write_8bit_register(soft_iic_obj, 0x01);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
void soft_iic_write_8bit (soft_iic_info_struct *soft_iic_obj, const uint8 data)
|
||||
void soft_iic_write_8bit(soft_iic_info_struct *soft_iic_obj, const uint8 data)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
soft_iic_start(soft_iic_obj);
|
||||
@@ -238,19 +232,18 @@ void soft_iic_write_8bit (soft_iic_info_struct *soft_iic_obj, const uint8 data)
|
||||
// 参数说明 *soft_iic_obj 软件 IIC 指定信息 可以参照 zf_driver_soft_iic.h 里的格式看看
|
||||
// 参数说明 *data 数据存放缓冲区
|
||||
// 参数说明 len 缓冲区长度
|
||||
// 返回参数 void
|
||||
// 返回参数 void
|
||||
// 使用示例 soft_iic_write_8bit_array(soft_iic_obj, data, 6);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
void soft_iic_write_8bit_array (soft_iic_info_struct *soft_iic_obj, const uint8 *data, uint32 len)
|
||||
void soft_iic_write_8bit_array(soft_iic_info_struct *soft_iic_obj, const uint8 *data, uint32 len)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
zf_assert(data != NULL);
|
||||
soft_iic_start(soft_iic_obj);
|
||||
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1);
|
||||
while(len --)
|
||||
{
|
||||
soft_iic_send_data(soft_iic_obj, *data ++);
|
||||
while (len--) {
|
||||
soft_iic_send_data(soft_iic_obj, *data++);
|
||||
}
|
||||
soft_iic_stop(soft_iic_obj);
|
||||
}
|
||||
@@ -259,11 +252,11 @@ void soft_iic_write_8bit_array (soft_iic_info_struct *soft_iic_obj, const uint8
|
||||
// 函数简介 软件 IIC 接口器写 16bit 数据
|
||||
// 参数说明 *soft_iic_obj 软件 IIC 指定信息 可以参照 zf_driver_soft_iic.h 里的格式看看
|
||||
// 参数说明 data 要写入的数据
|
||||
// 返回参数 void
|
||||
// 返回参数 void
|
||||
// 使用示例 soft_iic_write_16bit(soft_iic_obj, 0x0101);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
void soft_iic_write_16bit (soft_iic_info_struct *soft_iic_obj, const uint16 data)
|
||||
void soft_iic_write_16bit(soft_iic_info_struct *soft_iic_obj, const uint16 data)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
soft_iic_start(soft_iic_obj);
|
||||
@@ -278,20 +271,19 @@ void soft_iic_write_16bit (soft_iic_info_struct *soft_iic_obj, const uint16 data
|
||||
// 参数说明 *soft_iic_obj 软件 IIC 指定信息 可以参照 zf_driver_soft_iic.h 里的格式看看
|
||||
// 参数说明 *data 数据存放缓冲区
|
||||
// 参数说明 len 缓冲区长度
|
||||
// 返回参数 void
|
||||
// 返回参数 void
|
||||
// 使用示例 soft_iic_write_16bit_array(soft_iic_obj, data, 6);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
void soft_iic_write_16bit_array (soft_iic_info_struct *soft_iic_obj, const uint16 *data, uint32 len)
|
||||
void soft_iic_write_16bit_array(soft_iic_info_struct *soft_iic_obj, const uint16 *data, uint32 len)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
zf_assert(data != NULL);
|
||||
soft_iic_start(soft_iic_obj);
|
||||
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1);
|
||||
while(len --)
|
||||
{
|
||||
while (len--) {
|
||||
soft_iic_send_data(soft_iic_obj, (uint8)((*data & 0xFF00) >> 8));
|
||||
soft_iic_send_data(soft_iic_obj, (uint8)(*data ++ & 0x00FF));
|
||||
soft_iic_send_data(soft_iic_obj, (uint8)(*data++ & 0x00FF));
|
||||
}
|
||||
soft_iic_stop(soft_iic_obj);
|
||||
}
|
||||
@@ -301,11 +293,11 @@ void soft_iic_write_16bit_array (soft_iic_info_struct *soft_iic_obj, const uint1
|
||||
// 参数说明 *soft_iic_obj 软件 IIC 指定信息 可以参照 zf_driver_soft_iic.h 里的格式看看
|
||||
// 参数说明 register_name 传感器的寄存器地址
|
||||
// 参数说明 data 要写入的数据
|
||||
// 返回参数 void
|
||||
// 返回参数 void
|
||||
// 使用示例 soft_iic_write_8bit_register(soft_iic_obj, 0x01, 0x01);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
void soft_iic_write_8bit_register (soft_iic_info_struct *soft_iic_obj, const uint8 register_name, const uint8 data)
|
||||
void soft_iic_write_8bit_register(soft_iic_info_struct *soft_iic_obj, const uint8 register_name, const uint8 data)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
soft_iic_start(soft_iic_obj);
|
||||
@@ -321,20 +313,19 @@ void soft_iic_write_8bit_register (soft_iic_info_struct *soft_iic_obj, const uin
|
||||
// 参数说明 register_name 传感器的寄存器地址
|
||||
// 参数说明 *data 数据存放缓冲区
|
||||
// 参数说明 len 缓冲区长度
|
||||
// 返回参数 void
|
||||
// 返回参数 void
|
||||
// 使用示例 soft_iic_write_8bit_registers(soft_iic_obj, 0x01, data, 6);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
void soft_iic_write_8bit_registers (soft_iic_info_struct *soft_iic_obj, const uint8 register_name, const uint8 *data, uint32 len)
|
||||
void soft_iic_write_8bit_registers(soft_iic_info_struct *soft_iic_obj, const uint8 register_name, const uint8 *data, uint32 len)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
zf_assert(data != NULL);
|
||||
soft_iic_start(soft_iic_obj);
|
||||
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1);
|
||||
soft_iic_send_data(soft_iic_obj, register_name);
|
||||
while(len --)
|
||||
{
|
||||
soft_iic_send_data(soft_iic_obj, *data ++);
|
||||
while (len--) {
|
||||
soft_iic_send_data(soft_iic_obj, *data++);
|
||||
}
|
||||
soft_iic_stop(soft_iic_obj);
|
||||
}
|
||||
@@ -344,11 +335,11 @@ void soft_iic_write_8bit_registers (soft_iic_info_struct *soft_iic_obj, const ui
|
||||
// 参数说明 *soft_iic_obj 软件 IIC 指定信息 可以参照 zf_driver_soft_iic.h 里的格式看看
|
||||
// 参数说明 register_name 传感器的寄存器地址
|
||||
// 参数说明 data 要写入的数据
|
||||
// 返回参数 void
|
||||
// 返回参数 void
|
||||
// 使用示例 soft_iic_write_16bit_register(soft_iic_obj, 0x0101, 0x0101);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
void soft_iic_write_16bit_register (soft_iic_info_struct *soft_iic_obj, const uint16 register_name, const uint16 data)
|
||||
void soft_iic_write_16bit_register(soft_iic_info_struct *soft_iic_obj, const uint16 register_name, const uint16 data)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
soft_iic_start(soft_iic_obj);
|
||||
@@ -366,11 +357,11 @@ void soft_iic_write_16bit_register (soft_iic_info_struct *soft_iic_obj, const ui
|
||||
// 参数说明 register_name 传感器的寄存器地址
|
||||
// 参数说明 *data 数据存放缓冲区
|
||||
// 参数说明 len 缓冲区长度
|
||||
// 返回参数 void
|
||||
// 返回参数 void
|
||||
// 使用示例 soft_iic_write_16bit_registers(soft_iic_obj, 0x0101, data, 6);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
void soft_iic_write_16bit_registers (soft_iic_info_struct *soft_iic_obj, const uint16 register_name, const uint16 *data, uint32 len)
|
||||
void soft_iic_write_16bit_registers(soft_iic_info_struct *soft_iic_obj, const uint16 register_name, const uint16 *data, uint32 len)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
zf_assert(data != NULL);
|
||||
@@ -378,10 +369,9 @@ void soft_iic_write_16bit_registers (soft_iic_info_struct *soft_iic_obj, const u
|
||||
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1);
|
||||
soft_iic_send_data(soft_iic_obj, (uint8)((register_name & 0xFF00) >> 8));
|
||||
soft_iic_send_data(soft_iic_obj, (uint8)(register_name & 0x00FF));
|
||||
while(len--)
|
||||
{
|
||||
while (len--) {
|
||||
soft_iic_send_data(soft_iic_obj, (uint8)((*data & 0xFF00) >> 8));
|
||||
soft_iic_send_data(soft_iic_obj, (uint8)(*data ++ & 0x00FF));
|
||||
soft_iic_send_data(soft_iic_obj, (uint8)(*data++ & 0x00FF));
|
||||
}
|
||||
soft_iic_stop(soft_iic_obj);
|
||||
}
|
||||
@@ -391,9 +381,9 @@ void soft_iic_write_16bit_registers (soft_iic_info_struct *soft_iic_obj, const u
|
||||
// 参数说明 *soft_iic_obj 软件 IIC 指定信息 可以参照 zf_driver_soft_iic.h 里的格式看看
|
||||
// 返回参数 uint8 返回读取的 8bit 数据
|
||||
// 使用示例 soft_iic_read_8bit(soft_iic_obj);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
uint8 soft_iic_read_8bit (soft_iic_info_struct *soft_iic_obj)
|
||||
uint8 soft_iic_read_8bit(soft_iic_info_struct *soft_iic_obj)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
uint8 temp = 0;
|
||||
@@ -410,19 +400,18 @@ uint8 soft_iic_read_8bit (soft_iic_info_struct *soft_iic_obj)
|
||||
// 参数说明 register_name 传感器的寄存器地址
|
||||
// 参数说明 *data 要读取的数据的缓冲区指针
|
||||
// 参数说明 len 要读取的数据长度
|
||||
// 返回参数 void
|
||||
// 返回参数 void
|
||||
// 使用示例 soft_iic_read_8bit_array(soft_iic_obj, data, 8);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
void soft_iic_read_8bit_array (soft_iic_info_struct *soft_iic_obj, uint8 *data, uint32 len)
|
||||
void soft_iic_read_8bit_array(soft_iic_info_struct *soft_iic_obj, uint8 *data, uint32 len)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
zf_assert(data != NULL);
|
||||
soft_iic_start(soft_iic_obj);
|
||||
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1 | 0x01);
|
||||
while(len --)
|
||||
{
|
||||
*data ++ = soft_iic_read_data(soft_iic_obj, len == 0);
|
||||
while (len--) {
|
||||
*data++ = soft_iic_read_data(soft_iic_obj, len == 0);
|
||||
}
|
||||
soft_iic_stop(soft_iic_obj);
|
||||
}
|
||||
@@ -433,16 +422,16 @@ void soft_iic_read_8bit_array (soft_iic_info_struct *soft_iic_obj, uint8 *data,
|
||||
// 参数说明 register_name 传感器的寄存器地址
|
||||
// 返回参数 uint16 返回读取的 16bit 数据
|
||||
// 使用示例 soft_iic_read_16bit(soft_iic_obj);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
uint16 soft_iic_read_16bit (soft_iic_info_struct *soft_iic_obj)
|
||||
uint16 soft_iic_read_16bit(soft_iic_info_struct *soft_iic_obj)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
uint16 temp = 0;
|
||||
soft_iic_start(soft_iic_obj);
|
||||
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1 | 0x01);
|
||||
temp = soft_iic_read_data(soft_iic_obj, 0);
|
||||
temp = ((temp << 8)| soft_iic_read_data(soft_iic_obj, 1));
|
||||
temp = ((temp << 8) | soft_iic_read_data(soft_iic_obj, 1));
|
||||
soft_iic_stop(soft_iic_obj);
|
||||
return temp;
|
||||
}
|
||||
@@ -452,21 +441,20 @@ uint16 soft_iic_read_16bit (soft_iic_info_struct *soft_iic_obj)
|
||||
// 参数说明 *soft_iic_obj 软件 IIC 指定信息 可以参照 zf_driver_soft_iic.h 里的格式看看
|
||||
// 参数说明 *data 要读取的数据的缓冲区指针
|
||||
// 参数说明 len 要读取的数据长度
|
||||
// 返回参数 void
|
||||
// 返回参数 void
|
||||
// 使用示例 soft_iic_read_16bit_array(soft_iic_obj, data, 8);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
void soft_iic_read_16bit_array (soft_iic_info_struct *soft_iic_obj, uint16 *data, uint32 len)
|
||||
void soft_iic_read_16bit_array(soft_iic_info_struct *soft_iic_obj, uint16 *data, uint32 len)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
zf_assert(data != NULL);
|
||||
soft_iic_start(soft_iic_obj);
|
||||
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1 | 0x01);
|
||||
while(len --)
|
||||
{
|
||||
while (len--) {
|
||||
*data = soft_iic_read_data(soft_iic_obj, 0);
|
||||
*data = ((*data << 8)| soft_iic_read_data(soft_iic_obj, len == 0));
|
||||
data ++;
|
||||
*data = ((*data << 8) | soft_iic_read_data(soft_iic_obj, len == 0));
|
||||
data++;
|
||||
}
|
||||
soft_iic_stop(soft_iic_obj);
|
||||
}
|
||||
@@ -477,9 +465,9 @@ void soft_iic_read_16bit_array (soft_iic_info_struct *soft_iic_obj, uint16 *data
|
||||
// 参数说明 register_name 传感器的寄存器地址
|
||||
// 返回参数 uint8 返回读取的 8bit 数据
|
||||
// 使用示例 soft_iic_read_8bit_register(soft_iic_obj, 0x01);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
uint8 soft_iic_read_8bit_register (soft_iic_info_struct *soft_iic_obj, const uint8 register_name)
|
||||
uint8 soft_iic_read_8bit_register(soft_iic_info_struct *soft_iic_obj, const uint8 register_name)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
uint8 temp = 0;
|
||||
@@ -499,11 +487,11 @@ uint8 soft_iic_read_8bit_register (soft_iic_info_struct *soft_iic_obj, const uin
|
||||
// 参数说明 register_name 传感器的寄存器地址
|
||||
// 参数说明 *data 要读取的数据的缓冲区指针
|
||||
// 参数说明 len 要读取的数据长度
|
||||
// 返回参数 void
|
||||
// 返回参数 void
|
||||
// 使用示例 soft_iic_read_8bit_registers(soft_iic_obj, 0x01, data, 8);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
void soft_iic_read_8bit_registers (soft_iic_info_struct *soft_iic_obj, const uint8 register_name, uint8 *data, uint32 len)
|
||||
void soft_iic_read_8bit_registers(soft_iic_info_struct *soft_iic_obj, const uint8 register_name, uint8 *data, uint32 len)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
zf_assert(data != NULL);
|
||||
@@ -512,9 +500,8 @@ void soft_iic_read_8bit_registers (soft_iic_info_struct *soft_iic_obj, const uin
|
||||
soft_iic_send_data(soft_iic_obj, register_name);
|
||||
soft_iic_start(soft_iic_obj);
|
||||
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1 | 0x01);
|
||||
while(len --)
|
||||
{
|
||||
*data ++ = soft_iic_read_data(soft_iic_obj, len == 0);
|
||||
while (len--) {
|
||||
*data++ = soft_iic_read_data(soft_iic_obj, len == 0);
|
||||
}
|
||||
soft_iic_stop(soft_iic_obj);
|
||||
}
|
||||
@@ -525,9 +512,9 @@ void soft_iic_read_8bit_registers (soft_iic_info_struct *soft_iic_obj, const uin
|
||||
// 参数说明 register_name 传感器的寄存器地址
|
||||
// 返回参数 uint16 返回读取的 16bit 数据
|
||||
// 使用示例 soft_iic_read_16bit_register(soft_iic_obj, 0x0101);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
uint16 soft_iic_read_16bit_register (soft_iic_info_struct *soft_iic_obj, const uint16 register_name)
|
||||
uint16 soft_iic_read_16bit_register(soft_iic_info_struct *soft_iic_obj, const uint16 register_name)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
uint16 temp = 0;
|
||||
@@ -538,7 +525,7 @@ uint16 soft_iic_read_16bit_register (soft_iic_info_struct *soft_iic_obj, const u
|
||||
soft_iic_start(soft_iic_obj);
|
||||
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1 | 0x01);
|
||||
temp = soft_iic_read_data(soft_iic_obj, 0);
|
||||
temp = ((temp << 8)| soft_iic_read_data(soft_iic_obj, 1));
|
||||
temp = ((temp << 8) | soft_iic_read_data(soft_iic_obj, 1));
|
||||
soft_iic_stop(soft_iic_obj);
|
||||
return temp;
|
||||
}
|
||||
@@ -549,11 +536,11 @@ uint16 soft_iic_read_16bit_register (soft_iic_info_struct *soft_iic_obj, const u
|
||||
// 参数说明 register_name 传感器的寄存器地址
|
||||
// 参数说明 *data 要读取的数据的缓冲区指针
|
||||
// 参数说明 len 要读取的数据长度
|
||||
// 返回参数 void
|
||||
// 返回参数 void
|
||||
// 使用示例 soft_iic_read_16bit_registers(soft_iic_obj, 0x0101, data, 8);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
void soft_iic_read_16bit_registers (soft_iic_info_struct *soft_iic_obj, const uint16 register_name, uint16 *data, uint32 len)
|
||||
void soft_iic_read_16bit_registers(soft_iic_info_struct *soft_iic_obj, const uint16 register_name, uint16 *data, uint32 len)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
zf_assert(data != NULL);
|
||||
@@ -563,11 +550,10 @@ void soft_iic_read_16bit_registers (soft_iic_info_struct *soft_iic_obj, const ui
|
||||
soft_iic_send_data(soft_iic_obj, (uint8)(register_name & 0x00FF));
|
||||
soft_iic_start(soft_iic_obj);
|
||||
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1 | 0x01);
|
||||
while(len --)
|
||||
{
|
||||
while (len--) {
|
||||
*data = soft_iic_read_data(soft_iic_obj, 0);
|
||||
*data = ((*data << 8)| soft_iic_read_data(soft_iic_obj, len == 0));
|
||||
data ++;
|
||||
*data = ((*data << 8) | soft_iic_read_data(soft_iic_obj, len == 0));
|
||||
data++;
|
||||
}
|
||||
soft_iic_stop(soft_iic_obj);
|
||||
}
|
||||
@@ -579,29 +565,26 @@ void soft_iic_read_16bit_registers (soft_iic_info_struct *soft_iic_obj, const ui
|
||||
// 参数说明 write_len 发送缓冲区长度
|
||||
// 参数说明 *read_data 读取数据存放缓冲区
|
||||
// 参数说明 read_len 读取缓冲区长度
|
||||
// 返回参数 void
|
||||
// 返回参数 void
|
||||
// 使用示例 iic_transfer_8bit_array(IIC_1, addr, data, 64, data, 64);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
void soft_iic_transfer_8bit_array (soft_iic_info_struct *soft_iic_obj, const uint8 *write_data, uint32 write_len, uint8 *read_data, uint32 read_len)
|
||||
void soft_iic_transfer_8bit_array(soft_iic_info_struct *soft_iic_obj, const uint8 *write_data, uint32 write_len, uint8 *read_data, uint32 read_len)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
zf_assert(write_data != NULL);
|
||||
zf_assert(read_data != NULL);
|
||||
soft_iic_start(soft_iic_obj);
|
||||
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1);
|
||||
while(write_len --)
|
||||
{
|
||||
soft_iic_send_data(soft_iic_obj, *write_data ++);
|
||||
while (write_len--) {
|
||||
soft_iic_send_data(soft_iic_obj, *write_data++);
|
||||
}
|
||||
|
||||
if(read_len)
|
||||
{
|
||||
if (read_len) {
|
||||
soft_iic_start(soft_iic_obj);
|
||||
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1 | 0x01);
|
||||
while(read_len --)
|
||||
{
|
||||
*read_data ++ = soft_iic_read_data(soft_iic_obj, read_len == 0);
|
||||
while (read_len--) {
|
||||
*read_data++ = soft_iic_read_data(soft_iic_obj, read_len == 0);
|
||||
}
|
||||
}
|
||||
soft_iic_stop(soft_iic_obj);
|
||||
@@ -614,31 +597,28 @@ void soft_iic_transfer_8bit_array (soft_iic_info_struct *soft_iic_obj, const uin
|
||||
// 参数说明 write_len 发送缓冲区长度
|
||||
// 参数说明 *read_data 读取数据存放缓冲区
|
||||
// 参数说明 read_len 读取缓冲区长度
|
||||
// 返回参数 void
|
||||
// 返回参数 void
|
||||
// 使用示例 iic_transfer_16bit_array(IIC_1, addr, data, 64, data, 64);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
void soft_iic_transfer_16bit_array (soft_iic_info_struct *soft_iic_obj, const uint16 *write_data, uint32 write_len, uint16 *read_data, uint32 read_len)
|
||||
void soft_iic_transfer_16bit_array(soft_iic_info_struct *soft_iic_obj, const uint16 *write_data, uint32 write_len, uint16 *read_data, uint32 read_len)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
zf_assert(write_data != NULL);
|
||||
zf_assert(read_data != NULL);
|
||||
soft_iic_start(soft_iic_obj);
|
||||
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1);
|
||||
while(write_len--)
|
||||
{
|
||||
while (write_len--) {
|
||||
soft_iic_send_data(soft_iic_obj, (uint8)((*write_data & 0xFF00) >> 8));
|
||||
soft_iic_send_data(soft_iic_obj, (uint8)(*write_data ++ & 0x00FF));
|
||||
soft_iic_send_data(soft_iic_obj, (uint8)(*write_data++ & 0x00FF));
|
||||
}
|
||||
if(read_len)
|
||||
{
|
||||
if (read_len) {
|
||||
soft_iic_start(soft_iic_obj);
|
||||
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1 | 0x01);
|
||||
while(read_len --)
|
||||
{
|
||||
while (read_len--) {
|
||||
*read_data = soft_iic_read_data(soft_iic_obj, 0);
|
||||
*read_data = ((*read_data << 8)| soft_iic_read_data(soft_iic_obj, read_len == 0));
|
||||
read_data ++;
|
||||
*read_data = ((*read_data << 8) | soft_iic_read_data(soft_iic_obj, read_len == 0));
|
||||
read_data++;
|
||||
}
|
||||
}
|
||||
soft_iic_stop(soft_iic_obj);
|
||||
@@ -649,11 +629,11 @@ void soft_iic_transfer_16bit_array (soft_iic_info_struct *soft_iic_obj, const ui
|
||||
// 参数说明 *soft_iic_obj 软件 IIC 指定信息 可以参照 zf_driver_soft_iic.h 里的格式看看
|
||||
// 参数说明 register_name 传感器的寄存器地址
|
||||
// 参数说明 data 要写入的数据
|
||||
// 返回参数 void
|
||||
// 返回参数 void
|
||||
// 使用示例 soft_iic_sccb_write_register(soft_iic_obj, 0x01, 0x01);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
void soft_iic_sccb_write_register (soft_iic_info_struct *soft_iic_obj, const uint8 register_name, uint8 data)
|
||||
void soft_iic_sccb_write_register(soft_iic_info_struct *soft_iic_obj, const uint8 register_name, uint8 data)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
soft_iic_start(soft_iic_obj);
|
||||
@@ -669,9 +649,9 @@ void soft_iic_sccb_write_register (soft_iic_info_struct *soft_iic_obj, const uin
|
||||
// 参数说明 register_name 传感器的寄存器地址
|
||||
// 返回参数 uint8 返回读取的 8bit 数据
|
||||
// 使用示例 soft_iic_sccb_read_register(soft_iic_obj, 0x01);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
uint8 soft_iic_sccb_read_register (soft_iic_info_struct *soft_iic_obj, const uint8 register_name)
|
||||
uint8 soft_iic_sccb_read_register(soft_iic_info_struct *soft_iic_obj, const uint8 register_name)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
uint8 temp = 0;
|
||||
@@ -694,18 +674,46 @@ uint8 soft_iic_sccb_read_register (soft_iic_info_struct *soft_iic_obj, const uin
|
||||
// 参数说明 delay 软件 IIC 延时 就是时钟高电平时间 越短 IIC 速率越高
|
||||
// 参数说明 scl_pin 软件 IIC 时钟引脚 参照 zf_driver_gpio.h 内 gpio_pin_enum 枚举体定义
|
||||
// 参数说明 sda_pin 软件 IIC 数据引脚 参照 zf_driver_gpio.h 内 gpio_pin_enum 枚举体定义
|
||||
// 返回参数 void
|
||||
// 返回参数 void
|
||||
// 使用示例 soft_iic_init(&soft_iic_obj, addr, 100, B6, B7);
|
||||
// 备注信息
|
||||
// 备注信息
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
void soft_iic_init (soft_iic_info_struct *soft_iic_obj, uint8 addr, uint32 delay, gpio_pin_enum scl_pin, gpio_pin_enum sda_pin)
|
||||
void soft_iic_init(soft_iic_info_struct *soft_iic_obj, uint8 addr, uint32 delay, gpio_pin_enum scl_pin, gpio_pin_enum sda_pin)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
zf_assert(scl_pin != sda_pin); // 醒醒! scl_pin 与 sda_pin 怎么能填同一个引脚?
|
||||
zf_assert(scl_pin != sda_pin); // 醒醒! scl_pin 与 sda_pin 怎么能填同一个引脚?
|
||||
soft_iic_obj->scl_pin = scl_pin;
|
||||
soft_iic_obj->sda_pin = sda_pin;
|
||||
soft_iic_obj->addr = addr;
|
||||
soft_iic_obj->delay = delay;
|
||||
gpio_init(scl_pin, GPO, GPIO_HIGH, GPO_PUSH_PULL); // 提取对应IO索引 AF功能编码
|
||||
gpio_init(sda_pin, GPO, GPIO_HIGH, GPO_OPEN_DTAIN); // 提取对应IO索引 AF功能编码
|
||||
soft_iic_obj->addr = addr;
|
||||
soft_iic_obj->delay = delay;
|
||||
gpio_init(scl_pin, GPO, GPIO_HIGH, GPO_PUSH_PULL); // 提取对应IO索引 AF功能编码
|
||||
gpio_init(sda_pin, GPO, GPIO_HIGH, GPO_OPEN_DTAIN); // 提取对应IO索引 AF功能编码
|
||||
}
|
||||
void eep_soft_iic_read_8bit_registers(soft_iic_info_struct *soft_iic_obj, const uint8 register_name_h, const uint8 register_name_l, uint8 *data, uint32 len)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
zf_assert(data != NULL);
|
||||
soft_iic_start(soft_iic_obj);
|
||||
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1);
|
||||
soft_iic_send_data(soft_iic_obj, register_name_h);
|
||||
soft_iic_send_data(soft_iic_obj, register_name_l);
|
||||
soft_iic_start(soft_iic_obj);
|
||||
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1 | 0x01);
|
||||
while (len--) {
|
||||
*data++ = soft_iic_read_data(soft_iic_obj, len == 0);
|
||||
}
|
||||
soft_iic_stop(soft_iic_obj);
|
||||
}
|
||||
void eep_soft_iic_write_8bit_registers(soft_iic_info_struct *soft_iic_obj, const uint8 register_name_h, const uint8 register_name_l, const uint8 *data, uint32 len)
|
||||
{
|
||||
zf_assert(soft_iic_obj != NULL);
|
||||
zf_assert(data != NULL);
|
||||
soft_iic_start(soft_iic_obj);
|
||||
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1);
|
||||
soft_iic_send_data(soft_iic_obj, register_name_h);
|
||||
soft_iic_send_data(soft_iic_obj, register_name_l);
|
||||
while (len--) {
|
||||
soft_iic_send_data(soft_iic_obj, *data++);
|
||||
}
|
||||
soft_iic_stop(soft_iic_obj);
|
||||
}
|
||||
@@ -1,83 +1,84 @@
|
||||
/*********************************************************************************************************************
|
||||
* CH32V307VCT6 Opensourec Library 即(CH32V307VCT6 开源库)是一个基于官方 SDK 接口的第三方开源库
|
||||
* Copyright (c) 2022 SEEKFREE 逐飞科技
|
||||
*
|
||||
* 本文件是CH32V307VCT6 开源库的一部分
|
||||
*
|
||||
* CH32V307VCT6 开源库 是免费软件
|
||||
* 您可以根据自由软件基金会发布的 GPL(GNU General Public License,即 GNU通用公共许可证)的条款
|
||||
* 即 GPL 的第3版(即 GPL3.0)或(您选择的)任何后来的版本,重新发布和/或修改它
|
||||
*
|
||||
* 本开源库的发布是希望它能发挥作用,但并未对其作任何的保证
|
||||
* 甚至没有隐含的适销性或适合特定用途的保证
|
||||
* 更多细节请参见 GPL
|
||||
*
|
||||
* 您应该在收到本开源库的同时收到一份 GPL 的副本
|
||||
* 如果没有,请参阅<https://www.gnu.org/licenses/>
|
||||
*
|
||||
* 额外注明:
|
||||
* 本开源库使用 GPL3.0 开源许可证协议 以上许可申明为译文版本
|
||||
* 许可申明英文版在 libraries/doc 文件夹下的 GPL3_permission_statement.txt 文件中
|
||||
* 许可证副本在 libraries 文件夹下 即该文件夹下的 LICENSE 文件
|
||||
* 欢迎各位使用并传播本程序 但修改内容时必须保留逐飞科技的版权声明(即本声明)
|
||||
*
|
||||
* 文件名称 zf_driver_soft_iic
|
||||
* 公司名称 成都逐飞科技有限公司
|
||||
* 版本信息 查看 libraries/doc 文件夹内 version 文件 版本说明
|
||||
* 开发环境 MounRiver Studio V1.8.1
|
||||
* 适用平台 CH32V307VCT6
|
||||
* 店铺链接 https://seekfree.taobao.com/
|
||||
*
|
||||
* 修改记录
|
||||
* 日期 作者 备注
|
||||
* 2022-09-15 大W first version
|
||||
********************************************************************************************************************/
|
||||
* CH32V307VCT6 Opensourec Library 即(CH32V307VCT6 开源库)是一个基于官方 SDK 接口的第三方开源库
|
||||
* Copyright (c) 2022 SEEKFREE 逐飞科技
|
||||
*
|
||||
* 本文件是CH32V307VCT6 开源库的一部分
|
||||
*
|
||||
* CH32V307VCT6 开源库 是免费软件
|
||||
* 您可以根据自由软件基金会发布的 GPL(GNU General Public License,即 GNU通用公共许可证)的条款
|
||||
* 即 GPL 的第3版(即 GPL3.0)或(您选择的)任何后来的版本,重新发布和/或修改它
|
||||
*
|
||||
* 本开源库的发布是希望它能发挥作用,但并未对其作任何的保证
|
||||
* 甚至没有隐含的适销性或适合特定用途的保证
|
||||
* 更多细节请参见 GPL
|
||||
*
|
||||
* 您应该在收到本开源库的同时收到一份 GPL 的副本
|
||||
* 如果没有,请参阅<https://www.gnu.org/licenses/>
|
||||
*
|
||||
* 额外注明:
|
||||
* 本开源库使用 GPL3.0 开源许可证协议 以上许可申明为译文版本
|
||||
* 许可申明英文版在 libraries/doc 文件夹下的 GPL3_permission_statement.txt 文件中
|
||||
* 许可证副本在 libraries 文件夹下 即该文件夹下的 LICENSE 文件
|
||||
* 欢迎各位使用并传播本程序 但修改内容时必须保留逐飞科技的版权声明(即本声明)
|
||||
*
|
||||
* 文件名称 zf_driver_soft_iic
|
||||
* 公司名称 成都逐飞科技有限公司
|
||||
* 版本信息 查看 libraries/doc 文件夹内 version 文件 版本说明
|
||||
* 开发环境 MounRiver Studio V1.8.1
|
||||
* 适用平台 CH32V307VCT6
|
||||
* 店铺链接 https://seekfree.taobao.com/
|
||||
*
|
||||
* 修改记录
|
||||
* 日期 作者 备注
|
||||
* 2022-09-15 大W first version
|
||||
********************************************************************************************************************/
|
||||
|
||||
#ifndef _zf_driver_soft_iic_h_
|
||||
#define _zf_driver_soft_iic_h_
|
||||
|
||||
|
||||
#include "zf_driver_gpio.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gpio_pin_enum scl_pin; // 用于记录对应的引脚编号
|
||||
gpio_pin_enum sda_pin; // 用于记录对应的引脚编号
|
||||
uint8 addr; // 器件地址 七位地址模式
|
||||
uint32 delay; // 模拟 IIC 软延时时长
|
||||
}soft_iic_info_struct;
|
||||
gpio_pin_enum scl_pin; // 用于记录对应的引脚编号
|
||||
gpio_pin_enum sda_pin; // 用于记录对应的引脚编号
|
||||
uint8 addr; // 器件地址 七位地址模式
|
||||
uint32 delay; // 模拟 IIC 软延时时长
|
||||
} soft_iic_info_struct;
|
||||
|
||||
void soft_iic_write_8bit (soft_iic_info_struct *soft_iic_obj, const uint8 data);
|
||||
void soft_iic_write_8bit_array (soft_iic_info_struct *soft_iic_obj, const uint8 *data, uint32 len);
|
||||
void soft_iic_write_8bit(soft_iic_info_struct *soft_iic_obj, const uint8 data);
|
||||
void soft_iic_write_8bit_array(soft_iic_info_struct *soft_iic_obj, const uint8 *data, uint32 len);
|
||||
|
||||
void soft_iic_write_16bit (soft_iic_info_struct *soft_iic_obj, const uint16 data);
|
||||
void soft_iic_write_16bit_array (soft_iic_info_struct *soft_iic_obj, const uint16 *data, uint32 len);
|
||||
void soft_iic_write_16bit(soft_iic_info_struct *soft_iic_obj, const uint16 data);
|
||||
void soft_iic_write_16bit_array(soft_iic_info_struct *soft_iic_obj, const uint16 *data, uint32 len);
|
||||
|
||||
void soft_iic_write_8bit_register (soft_iic_info_struct *soft_iic_obj, const uint8 register_name, const uint8 data);
|
||||
void soft_iic_write_8bit_registers (soft_iic_info_struct *soft_iic_obj, const uint8 register_name, const uint8 *data, uint32 len);
|
||||
void soft_iic_write_8bit_register(soft_iic_info_struct *soft_iic_obj, const uint8 register_name, const uint8 data);
|
||||
void soft_iic_write_8bit_registers(soft_iic_info_struct *soft_iic_obj, const uint8 register_name, const uint8 *data, uint32 len);
|
||||
|
||||
void soft_iic_write_16bit_register (soft_iic_info_struct *soft_iic_obj, const uint16 register_name, const uint16 data);
|
||||
void soft_iic_write_16bit_registers (soft_iic_info_struct *soft_iic_obj, const uint16 register_name, const uint16 *data, uint32 len);
|
||||
void soft_iic_write_16bit_register(soft_iic_info_struct *soft_iic_obj, const uint16 register_name, const uint16 data);
|
||||
void soft_iic_write_16bit_registers(soft_iic_info_struct *soft_iic_obj, const uint16 register_name, const uint16 *data, uint32 len);
|
||||
|
||||
uint8 soft_iic_read_8bit (soft_iic_info_struct *soft_iic_obj);
|
||||
void soft_iic_read_8bit_array (soft_iic_info_struct *soft_iic_obj, uint8 *data, uint32 len);
|
||||
uint8 soft_iic_read_8bit(soft_iic_info_struct *soft_iic_obj);
|
||||
void soft_iic_read_8bit_array(soft_iic_info_struct *soft_iic_obj, uint8 *data, uint32 len);
|
||||
|
||||
uint16 soft_iic_read_16bit (soft_iic_info_struct *soft_iic_obj);
|
||||
void soft_iic_read_16bit_array (soft_iic_info_struct *soft_iic_obj, uint16 *data, uint32 len);
|
||||
uint16 soft_iic_read_16bit(soft_iic_info_struct *soft_iic_obj);
|
||||
void soft_iic_read_16bit_array(soft_iic_info_struct *soft_iic_obj, uint16 *data, uint32 len);
|
||||
|
||||
uint8 soft_iic_read_8bit_register (soft_iic_info_struct *soft_iic_obj, const uint8 register_name);
|
||||
void soft_iic_read_8bit_registers (soft_iic_info_struct *soft_iic_obj, const uint8 register_name, uint8 *data, uint32 len);
|
||||
uint8 soft_iic_read_8bit_register(soft_iic_info_struct *soft_iic_obj, const uint8 register_name);
|
||||
void soft_iic_read_8bit_registers(soft_iic_info_struct *soft_iic_obj, const uint8 register_name, uint8 *data, uint32 len);
|
||||
|
||||
uint16 soft_iic_read_16bit_register (soft_iic_info_struct *soft_iic_obj, const uint16 register_name);
|
||||
void soft_iic_read_16bit_registers (soft_iic_info_struct *soft_iic_obj, const uint16 register_name, uint16 *data, uint32 len);
|
||||
uint16 soft_iic_read_16bit_register(soft_iic_info_struct *soft_iic_obj, const uint16 register_name);
|
||||
void soft_iic_read_16bit_registers(soft_iic_info_struct *soft_iic_obj, const uint16 register_name, uint16 *data, uint32 len);
|
||||
|
||||
void soft_iic_transfer_8bit_array (soft_iic_info_struct *soft_iic_obj, const uint8 *write_data, uint32 write_len, uint8 *read_data, uint32 read_len);
|
||||
void soft_iic_transfer_16bit_array (soft_iic_info_struct *soft_iic_obj, const uint16 *write_data, uint32 write_len, uint16 *read_data, uint32 read_len);
|
||||
void soft_iic_transfer_8bit_array(soft_iic_info_struct *soft_iic_obj, const uint8 *write_data, uint32 write_len, uint8 *read_data, uint32 read_len);
|
||||
void soft_iic_transfer_16bit_array(soft_iic_info_struct *soft_iic_obj, const uint16 *write_data, uint32 write_len, uint16 *read_data, uint32 read_len);
|
||||
|
||||
void soft_iic_sccb_write_register (soft_iic_info_struct *soft_iic_obj, const uint8 register_name, uint8 data);
|
||||
uint8 soft_iic_sccb_read_register (soft_iic_info_struct *soft_iic_obj, const uint8 register_name);
|
||||
void soft_iic_sccb_write_register(soft_iic_info_struct *soft_iic_obj, const uint8 register_name, uint8 data);
|
||||
uint8 soft_iic_sccb_read_register(soft_iic_info_struct *soft_iic_obj, const uint8 register_name);
|
||||
|
||||
void soft_iic_init (soft_iic_info_struct *soft_iic_obj, uint8 addr, uint32 delay, gpio_pin_enum scl_pin, gpio_pin_enum sda_pin);
|
||||
void soft_iic_init(soft_iic_info_struct *soft_iic_obj, uint8 addr, uint32 delay, gpio_pin_enum scl_pin, gpio_pin_enum sda_pin);
|
||||
|
||||
void eep_soft_iic_write_8bit_registers(soft_iic_info_struct *soft_iic_obj, const uint8 register_name_h, const uint8 register_name_l, const uint8 *data, uint32 len);
|
||||
void eep_soft_iic_read_8bit_registers(soft_iic_info_struct *soft_iic_obj, const uint8 register_name_h, const uint8 register_name_l, uint8 *data, uint32 len);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user