use timer

This commit is contained in:
wmano
2025-08-23 11:54:16 +08:00
parent 975f8b4930
commit 45965db185
18 changed files with 591 additions and 7266 deletions
+5 -4
View File
@@ -1485,10 +1485,10 @@ CONFIG_BSP_USING_UART2=y
CONFIG_BSP_USING_UART3=y
# CONFIG_BSP_UART3_RX_USING_DMA is not set
# CONFIG_BSP_UART3_TX_USING_DMA is not set
CONFIG_BSP_USING_UART4=y
# CONFIG_BSP_UART4_RX_USING_DMA is not set
# CONFIG_BSP_UART4_TX_USING_DMA is not set
# CONFIG_BSP_USING_UART5 is not set
# CONFIG_BSP_USING_UART4 is not set
CONFIG_BSP_USING_UART5=y
# CONFIG_BSP_UART5_RX_USING_DMA is not set
# CONFIG_BSP_UART5_TX_USING_DMA is not set
CONFIG_BSP_USING_UART6=y
# CONFIG_BSP_UART6_RX_USING_DMA is not set
# CONFIG_BSP_UART6_TX_USING_DMA is not set
@@ -1497,6 +1497,7 @@ CONFIG_BSP_USING_I2C1=y
CONFIG_BSP_USING_I2C2=y
CONFIG_BSP_USING_I2C3=y
CONFIG_BSP_USING_I2C4=y
# CONFIG_BSP_USING_CAN is not set
# CONFIG_BSP_USING_RNG is not set
# CONFIG_BSP_USING_UDID is not set
# end of On-chip Peripheral Drivers
-11
View File
@@ -1,11 +0,0 @@
#include "led_show.h"
void led_init (void)
{
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(LED2_PIN, PIN_MODE_OUTPUT);
}
-13
View File
@@ -1,13 +0,0 @@
#ifndef __LED_H__
#define __LED_H__
#include "drv_gpio.h"
#define LED0_PIN GET_PIN(A, 8) // GET_PIN(C, 13)
#define LED1_PIN GET_PIN(C, 14)
#define LED2_PIN GET_PIN(C, 15)
extern void led_init (void);
#endif
+1 -9
View File
@@ -7,8 +7,6 @@
#include <rtdevice.h>
#endif /* RT_USING_NANO */
#include "led_show.h"
void show_app_version (void)
{
rt_kprintf("\r\n\r\n================================================\r\n");
@@ -26,13 +24,7 @@ int main(void)
finsh_set_prompt("chrg ");
#endif
led_init();
while (1)
{
rt_pin_write(LED0_PIN, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(LED0_PIN, PIN_LOW);
while (1) {
rt_thread_mdelay(500);
}
}
+48
View File
@@ -0,0 +1,48 @@
#include <stdio.h>
#include <rtthread.h>
#include <rtdevice.h>
#include "tmr_clk.h"
struct tmr_clk_t tmrclk = {
.cnt = 0,
};
static void tmr_clk_callback (void *args)
{
struct tmr_clk_t *pCLK = (struct tmr_clk_t *)args;
pCLK->cnt++;
if (pCLK->cnt % 60 == 0) {
rt_kprintf("R : %d mins\r\n", pCLK->cnt/60);
}
//rt_kprintf("\r\n");
}
static int tmr_clk_init (void)
{
rt_err_t ret = RT_EOK;
rt_timer_t timer_fd;
timer_fd = rt_timer_create("tmr_clk", tmr_clk_callback,
&tmrclk, RT_TICK_PER_SECOND, RT_TIMER_FLAG_PERIODIC);
if (timer_fd == RT_NULL) {
//LOG_E("create tmr_clk");
return -1;
} else {
ret = rt_timer_start(timer_fd);
if (ret != RT_EOK) {
//LOG_E("start tmr_clk");
return ret;
}
}
return RT_EOK;
}
INIT_APP_EXPORT(tmr_clk_init);
+14
View File
@@ -0,0 +1,14 @@
#ifndef __TMR_CLK_H__
#define __TMR_CLK_H__
struct tmr_clk_t {
rt_uint32_t cnt;
};
extern struct tmr_clk_t tmrclk;
#endif
+245
View File
@@ -0,0 +1,245 @@
#include <rtthread.h>
#include "tmr_pin.h"
struct tmr_pin_t tmrpins[TOTAL_PINS] = {
[IDX_PIN_LED1] = {
.index = IDX_PIN_LED1,
.pin_name = PIN_NAME_LED1,
.pin_base = PIN_LED1,
.pin_mode = PIN_MODE_OUTPUT,
.pin_value = PIN_HIGH,
.tmr_name = TMR_NAME_LED1,
.tmr_fd = RT_NULL,
.tmr_stage = PIN_STAGE_IDLE,
.tmr_millis_on = PULSE_TIME*8,
.tmr_millis_off = PULSE_TIME*8,
.tmr_times = 1,
.tmr_cnt = 0,
}/*,
[IDX_PIN_LED2] = {
.index = IDX_PIN_LED2,
.pin_name = PIN_NAME_LED2,
.pin_base = PIN_LED2,
.pin_mode = PIN_MODE_OUTPUT,
.pin_value = PIN_HIGH,
.tmr_name = TMR_NAME_LED2,
.tmr_fd = RT_NULL,
.tmr_stage = PIN_STAGE_IDLE,
.tmr_millis_on = PULSE_TIME*8,
.tmr_millis_off = PULSE_TIME*8,
.tmr_times = 1,
.tmr_cnt = 0,
},
[IDX_PIN_LED3] = {
.index = IDX_PIN_LED3,
.pin_name = PIN_NAME_LED3,
.pin_base = PIN_LED3,
.pin_mode = PIN_MODE_OUTPUT,
.pin_value = PIN_HIGH,
.tmr_name = TMR_NAME_LED3,
.tmr_fd = RT_NULL,
.tmr_stage = PIN_STAGE_IDLE,
.tmr_millis_on = PULSE_TIME*8,
.tmr_millis_off = PULSE_TIME*8,
.tmr_times = 1,
.tmr_cnt = 0,
}*/
};
rt_int32_t tmr_pin_get (ePIN_IDX index)
{
if (index >= TOTAL_PINS) {
return -1;
}
struct tmr_pin_t *pPIN = &tmrpins[index];
pPIN->pin_value = rt_pin_read(pPIN->pin_base);
return pPIN->pin_value;
}
rt_int32_t tmr_pin_set (struct tmr_pin_t *pPIN, rt_uint8_t value)
{
pPIN->pin_value = value;
rt_pin_write(pPIN->pin_base, pPIN->pin_value);
return 0;
}
rt_int32_t tmr_pin_toggle (ePIN_IDX index)
{
if (index >= TOTAL_PINS) {
return -1;
}
struct tmr_pin_t *pPIN = &tmrpins[index];
pPIN->pin_value = !pPIN->pin_value;
rt_pin_write(pPIN->pin_base, pPIN->pin_value);
return 0;
}
static rt_int32_t tmr_pin_timer_set_on (struct tmr_pin_t *pPIN)
{
return rt_timer_control(pPIN->tmr_fd, RT_TIMER_CTRL_SET_TIME, (void *)&pPIN->tmr_millis_on);
}
static rt_int32_t tmr_pin_timer_set_off (struct tmr_pin_t *pPIN)
{
return rt_timer_control(pPIN->tmr_fd, RT_TIMER_CTRL_SET_TIME, (void *)&pPIN->tmr_millis_off);
}
rt_int32_t tmr_pin_pulsing (struct tmr_pin_t *pPIN, rt_uint8_t state)
{
rt_int32_t ret = 0;
if (state == PULSE_OFF) {
pPIN->tmr_stage = PIN_STAGE_IDLE;
tmr_pin_set(pPIN, PIN_HIGH);
} else {
if (pPIN->tmr_millis_on == HOLD_ZERO) { // 常低
pPIN->tmr_stage = PIN_STAGE_IDLE;
rt_timer_stop(pPIN->tmr_fd);
tmr_pin_set(pPIN, PIN_HIGH);
} else if (pPIN->tmr_millis_off == HOLD_ZERO) { // 常高
pPIN->tmr_stage = PIN_STAGE_IDLE;
tmr_pin_set(pPIN, PIN_LOW);
} else { // 交替
if (pPIN->tmr_stage == PIN_STAGE_IDLE) {
pPIN->tmr_stage = PIN_STAGE_ON;
tmr_pin_set(pPIN, PIN_LOW);
tmr_pin_timer_set_on(pPIN);
ret = rt_timer_start(pPIN->tmr_fd);
}
}
}
return ret;
}
static void tmr_pin_timer_timeout_callback (void* parameter)
{
struct tmr_pin_t *pPIN = (struct tmr_pin_t *)parameter;
if (pPIN->tmr_stage == PIN_STAGE_ON) {
pPIN->tmr_stage = PIN_STAGE_OFF;
tmr_pin_set(pPIN, PIN_HIGH);
tmr_pin_timer_set_off(pPIN);
rt_timer_start(pPIN->tmr_fd);
} else if (pPIN->tmr_stage == PIN_STAGE_OFF) {
pPIN->tmr_stage = PIN_STAGE_IDLE;
if ((pPIN->tmr_times == TIMES_ALWAYS)&&(pPIN->tmr_millis_off != HOLD_ZERO)) { // 保持闪烁
pPIN->tmr_stage = PIN_STAGE_ON;
tmr_pin_set(pPIN, PIN_LOW);
tmr_pin_timer_set_on(pPIN);
rt_timer_start(pPIN->tmr_fd);
} else { // 计数闪烁
if (++pPIN->tmr_cnt >= pPIN->tmr_times) {
pPIN->tmr_cnt = 0;
rt_timer_stop(pPIN->tmr_fd);
} else {
pPIN->tmr_stage = PIN_STAGE_ON;
tmr_pin_set(pPIN, PIN_LOW);
tmr_pin_timer_set_on(pPIN);
rt_timer_start(pPIN->tmr_fd);
}
}
}
}
static rt_int32_t tmr_pin_timer_start (ePIN_IDX index)
{
if (index >= TOTAL_PINS) {
return -1;
}
struct tmr_pin_t *pPIN = RT_NULL;
pPIN = &tmrpins[index];
pPIN->tmr_fd = rt_timer_create(pPIN->tmr_name, tmr_pin_timer_timeout_callback,
pPIN, pPIN->tmr_millis_on, RT_TIMER_FLAG_ONE_SHOT);
if (pPIN->tmr_fd == RT_NULL) {
//LOG_E("tmr '%s'", pPIN->tmr_name);
return -1;
}
return 0;
}
rt_int32_t tmr_pin_timer_delete (ePIN_IDX index)
{
if (index >= TOTAL_PINS) {
return -1;
}
return rt_timer_delete(tmrpins[index].tmr_fd);
}
static rt_int32_t tmr_pin_show (struct tmr_pin_t *pPIN, rt_uint32_t times, rt_uint32_t on, rt_uint32_t off)
{
rt_int32_t ret = 0;
pPIN->tmr_millis_on = on;
pPIN->tmr_millis_off = off;
pPIN->tmr_times = times;
pPIN->tmr_cnt = 0;
if (pPIN->tmr_millis_on == HOLD_ZERO) {
ret = tmr_pin_pulsing(pPIN, PULSE_OFF);
} else {
ret = tmr_pin_pulsing(pPIN, PULSE_ON);
}
return ret;
}
rt_int32_t tmr_led_flashing (ePIN_IDX index, rt_uint32_t times, rt_uint32_t on, rt_uint32_t off)
{
rt_int32_t ret = -1;
struct tmr_pin_t *pPIN = NULL;
if (index < TOTAL_PINS) {
pPIN = &tmrpins[index];
ret = tmr_pin_show(pPIN, times, on, off);
}
return ret;
}
static int tmr_pins_init (void)
{
rt_uint8_t i = 0;
struct tmr_pin_t *pPIN = RT_NULL;
for (i = 0; i < TOTAL_PINS; i++) {
pPIN = &tmrpins[i];
rt_pin_mode(pPIN->pin_base, pPIN->pin_mode);
if (pPIN->pin_mode == PIN_MODE_OUTPUT) {
pPIN->pin_value = PIN_HIGH;
rt_pin_write(pPIN->pin_base, pPIN->pin_value);
}
//LOG_I("I : set '%s'(%d) mode %d", pPIN->pin_name, pPIN->pin_base, pPIN->pin_mode);
tmr_pin_timer_start((ePIN_IDX)i);
}
tmr_led_flashing(IDX_PIN_LED1, TIMES_ALWAYS, PULSE_TIME*8, PULSE_TIME*8);
return 0;
}
INIT_ENV_EXPORT(tmr_pins_init);
+75
View File
@@ -0,0 +1,75 @@
#ifndef __PIN_TMR_H__
#define __PIN_TMR_H__
#include <rttypes.h>
#include <rtdef.h>
#include "drv_gpio.h"
#define PIN_NAME_LED1 "led1"
#define PIN_NAME_LED2 "led2"
#define PIN_NAME_LED3 "led3"
#define TMR_NAME_LED1 "tmr_led1"
#define TMR_NAME_LED2 "tmr_led2"
#define TMR_NAME_LED3 "tmr_led3"
#define PIN_LED1 GET_PIN(A, 8) //GET_PIN(C, 13)
#define PIN_LED2 GET_PIN(C, 14)
#define PIN_LED3 GET_PIN(C, 15)
#define TIMES_ALWAYS (0) // 无限周期
#define TIMES_ONE (1) // 单个周期
#define HOLD_ZERO (0) // 屏蔽参数
#define HOLD_ON (1) // 保持亮,on!=0,off=0
#define HOLD_OFF (1) // 保持灭,on=0, off!=0
#define PULSE_OFF (0) // 脉宽低
#define PULSE_ON (1) // 脉宽高
#define PULSE_TIME (25) // 脉冲动作持续时间,单位 ms
typedef enum {
IDX_PIN_LED1 = 0, // LED1
// IDX_PIN_LED2 = 1, // LED2
// IDX_PIN_LED3 = 2, // LED3
TOTAL_PINS
} ePIN_IDX;
typedef enum {
PIN_STAGE_IDLE = (0x00), // 空闲
PIN_STAGE_ON = (0x01), // 保持高
PIN_STAGE_OFF = (0x02), // 保持低
PIN_STAGE_END
} ePIN_STAGE;
struct tmr_pin_t {
rt_uint8_t index; // 引脚索引
char *pin_name; // 引脚名
rt_int32_t pin_base; // 引脚映射值
rt_int32_t pin_value; // 引脚值
rt_uint8_t pin_mode; // 引脚控制方向 0:out 1:in
const char *tmr_name; // 定时器名
rt_timer_t tmr_fd; // 定时器对象
ePIN_STAGE tmr_stage; // 定时器状态机
rt_uint32_t tmr_millis_on; // 定时器单次高持续时间 ms=ticks (基于 1000 ticks/s)
rt_uint32_t tmr_millis_off; // 定时器单次低持续时间 ms=ticks (基于 1000 ticks/s)
rt_uint32_t tmr_times; // 定时器执行周期总次数
rt_uint32_t tmr_cnt; // 定时器已执行周期次数
};
extern struct tmr_pin_t tmrpins[TOTAL_PINS];
extern rt_int32_t tmr_pin_set (struct tmr_pin_t *pPIN, rt_uint8_t value);
extern rt_int32_t tmr_pin_toggle (ePIN_IDX index);
extern rt_int32_t tmr_pin_pulsing (struct tmr_pin_t *pPIN, rt_uint8_t state);
extern rt_int32_t tmr_led_flashing (ePIN_IDX index, rt_uint32_t times, rt_uint32_t on, rt_uint32_t off);
#endif
+1 -1
View File
@@ -10,7 +10,7 @@ rt_err_t usart2_rx_irq(rt_device_t dev, rt_size_t size)
return RT_EOK;
}
rt_err_t usart2_open(void)
static int usart2_open(void)
{
rt_err_t ret;
+10
View File
@@ -250,6 +250,16 @@ menu "On-chip Peripheral Drivers"
endif
menuconfig BSP_USING_CAN
bool "Enable On Board CAN"
select RT_USING_CAN
default n
if BSP_USING_CAN
config BSP_USING_CAN1
bool "Enable On Board CAN1"
default n
endif
source "$(RTT_DIR)/bsp/stm32/libraries/HAL_Drivers/drivers/Kconfig"
endmenu
+189 -184
View File
@@ -337,9 +337,9 @@
<v6Rtti>0</v6Rtti>
<VariousControls>
<MiscControls></MiscControls>
<Define>RT_USING_ARMLIBC, __STDC_LIMIT_MACROS, STM32F405xx, __CLK_TCK=RT_TICK_PER_SECOND, __RTTHREAD__, RT_USING_LIBC, USE_HAL_DRIVER, USER_VECT_TAB_ADDRESS=0x08010000</Define>
<Define>RT_USING_ARMLIBC, RT_USING_LIBC, __RTTHREAD__, __STDC_LIMIT_MACROS, __CLK_TCK=RT_TICK_PER_SECOND, STM32F405xx, USE_HAL_DRIVER</Define>
<Undefine></Undefine>
<IncludePath>..\..\rt-thread\components\libc\posix\io\poll;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\libc\compilers\common\extension\fcntl\octal;..\..\rt-thread\components\drivers\smp_call;..\..\rt-thread\libcpu\arm\common;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\libc\posix\io\eventfd;..\..\libs\cmsis-core\Include;board;..\..\libs\freemodbus\modbus\tcp;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers\config;..\..\rt-thread\include;..\..\rt-thread\libcpu\arm\cortex-m4;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers;applications;..\..\libs\freemodbus\port;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\drivers\phy;board\CubeMX_Config\Inc;..\..\rt-thread\components\libc\posix\ipc;..\..\libs\stm32f4\STM32F4_HAL\Inc\Legacy;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers;..\..\rt-thread\components\libc\posix\io\epoll;..\..\libs\stm32f4\STM32F4_CMSIS\Include;..\..\rt-thread\components\libc\compilers\common\extension;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\drivers\include;..\..\libs\freemodbus\modbus\include;..\..\libs\freemodbus\modbus\ascii;.;..\..\rt-thread\components\libc\compilers\common\include;..\..\libs\freemodbus\modbus\rtu;..\..\libs\stm32f4\STM32F4_HAL\Inc;..\..\rt-thread\components\finsh;..\..\rt-thread\components\drivers\include</IncludePath>
<IncludePath>..\..\libs\freemodbus\modbus\include;..\..\rt-thread\include;..\..\rt-thread\components\libc\posix\ipc;..\..\rt-thread\components\drivers\include;..\..\libs\freemodbus\modbus\tcp;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers;..\..\rt-thread\components\drivers\smp_call;..\..\libs\stm32f4\STM32F4_HAL\Inc;..\..\rt-thread\components\libc\compilers\common\include;..\..\libs\freemodbus\modbus\rtu;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers\config;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\drivers\include;..\..\rt-thread\libcpu\arm\common;..\..\libs\stm32f4\STM32F4_HAL\Inc\Legacy;board;..\..\rt-thread\components\libc\posix\io\eventfd;.;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers;..\..\rt-thread\components\libc\compilers\common\extension\fcntl\octal;..\..\rt-thread\components\drivers\include;..\..\libs\freemodbus\modbus\ascii;..\..\rt-thread\components\libc\posix\io\epoll;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\libc\compilers\common\extension;..\..\rt-thread\components\drivers\phy;board\CubeMX_Config\Inc;..\..\libs\stm32f4\STM32F4_CMSIS\Include;..\..\rt-thread\libcpu\arm\cortex-m4;..\..\libs\cmsis-core\Include;..\..\rt-thread\components\finsh;applications;..\..\rt-thread\components\libc\posix\io\poll;..\..\libs\freemodbus\port</IncludePath>
</VariousControls>
</Cads>
<Aads>
@@ -383,16 +383,21 @@
<Group>
<GroupName>Applications</GroupName>
<Files>
<File>
<FileName>tmr_pin.c</FileName>
<FileType>1</FileType>
<FilePath>applications\tmr_pin.c</FilePath>
</File>
<File>
<FileName>tmr_clk.c</FileName>
<FileType>1</FileType>
<FilePath>applications\tmr_clk.c</FilePath>
</File>
<File>
<FileName>usart2.c</FileName>
<FileType>1</FileType>
<FilePath>applications\usart2.c</FilePath>
</File>
<File>
<FileName>led_show.c</FileName>
<FileType>1</FileType>
<FilePath>applications\led_show.c</FilePath>
</File>
<File>
<FileName>main.c</FileName>
<FileType>1</FileType>
@@ -1328,16 +1333,6 @@
<Group>
<GroupName>Finsh</GroupName>
<Files>
<File>
<FileName>shell.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\rt-thread\components\finsh\shell.c</FilePath>
</File>
<File>
<FileName>msh.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\rt-thread\components\finsh\msh.c</FilePath>
</File>
<File>
<FileName>msh_parse.c</FileName>
<FileType>1</FileType>
@@ -1348,101 +1343,46 @@
<FileType>1</FileType>
<FilePath>..\..\rt-thread\components\finsh\cmd.c</FilePath>
</File>
<File>
<FileName>shell.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\rt-thread\components\finsh\shell.c</FilePath>
</File>
<File>
<FileName>msh.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\rt-thread\components\finsh\msh.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>FreeModbus</GroupName>
<Files>
<File>
<FileName>mbfuncinput_m.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbfuncinput_m.c</FilePath>
</File>
<File>
<FileName>mb.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\mb.c</FilePath>
</File>
<File>
<FileName>mbfuncother.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbfuncother.c</FilePath>
</File>
<File>
<FileName>mb_m.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\mb_m.c</FilePath>
</File>
<File>
<FileName>mbrtu.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\rtu\mbrtu.c</FilePath>
</File>
<File>
<FileName>mbfuncdiag.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbfuncdiag.c</FilePath>
</File>
<File>
<FileName>porttimer.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\port\porttimer.c</FilePath>
</File>
<File>
<FileName>mbfuncholding.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbfuncholding.c</FilePath>
</File>
<File>
<FileName>mbfunccoils_m.c</FileName>
<FileName>sample_mb_slave.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbfunccoils_m.c</FilePath>
<FilePath>..\..\libs\freemodbus\samples\sample_mb_slave.c</FilePath>
</File>
<File>
<FileName>user_mb_app.c</FileName>
<FileName>mbfuncinput.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\port\user_mb_app.c</FilePath>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbfuncinput.c</FilePath>
</File>
<File>
<FileName>sample_mb_master.c</FileName>
<FileName>portserial.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\samples\sample_mb_master.c</FilePath>
</File>
<File>
<FileName>mbfuncholding_m.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbfuncholding_m.c</FilePath>
</File>
<File>
<FileName>mbfuncdisc.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbfuncdisc.c</FilePath>
<FilePath>..\..\libs\freemodbus\port\portserial.c</FilePath>
</File>
<File>
<FileName>porttcp.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\port\porttcp.c</FilePath>
</File>
<File>
<FileName>user_mb_app_m.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\port\user_mb_app_m.c</FilePath>
</File>
<File>
<FileName>portevent.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\port\portevent.c</FilePath>
</File>
<File>
<FileName>mbfuncdisc_m.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbfuncdisc_m.c</FilePath>
</File>
<File>
<FileName>portserial_m.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\port\portserial_m.c</FilePath>
</File>
<File>
<FileName>mbrtu_m.c</FileName>
<FileType>1</FileType>
@@ -1454,24 +1394,49 @@
<FilePath>..\..\libs\freemodbus\port\port.c</FilePath>
</File>
<File>
<FileName>mbutils.c</FileName>
<FileName>user_mb_app_m.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbutils.c</FilePath>
<FilePath>..\..\libs\freemodbus\port\user_mb_app_m.c</FilePath>
</File>
<File>
<FileName>mbfuncinput.c</FileName>
<FileName>sample_mb_master.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbfuncinput.c</FilePath>
<FilePath>..\..\libs\freemodbus\samples\sample_mb_master.c</FilePath>
</File>
<File>
<FileName>portevent_m.c</FileName>
<FileName>mbfuncholding_m.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\port\portevent_m.c</FilePath>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbfuncholding_m.c</FilePath>
</File>
<File>
<FileName>mbcrc.c</FileName>
<FileName>mbrtu.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\rtu\mbcrc.c</FilePath>
<FilePath>..\..\libs\freemodbus\modbus\rtu\mbrtu.c</FilePath>
</File>
<File>
<FileName>mbfuncinput_m.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbfuncinput_m.c</FilePath>
</File>
<File>
<FileName>mb.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\mb.c</FilePath>
</File>
<File>
<FileName>mbfuncdisc.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbfuncdisc.c</FilePath>
</File>
<File>
<FileName>mbfunccoils_m.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbfunccoils_m.c</FilePath>
</File>
<File>
<FileName>mbfuncdisc_m.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbfuncdisc_m.c</FilePath>
</File>
<File>
<FileName>porttimer_m.c</FileName>
@@ -1479,9 +1444,19 @@
<FilePath>..\..\libs\freemodbus\port\porttimer_m.c</FilePath>
</File>
<File>
<FileName>sample_mb_slave.c</FileName>
<FileName>mbutils.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\samples\sample_mb_slave.c</FilePath>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbutils.c</FilePath>
</File>
<File>
<FileName>porttimer.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\port\porttimer.c</FilePath>
</File>
<File>
<FileName>portserial_m.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\port\portserial_m.c</FilePath>
</File>
<File>
<FileName>mbfunccoils.c</FileName>
@@ -1489,9 +1464,39 @@
<FilePath>..\..\libs\freemodbus\modbus\functions\mbfunccoils.c</FilePath>
</File>
<File>
<FileName>portserial.c</FileName>
<FileName>mbfuncother.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\port\portserial.c</FilePath>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbfuncother.c</FilePath>
</File>
<File>
<FileName>mbcrc.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\rtu\mbcrc.c</FilePath>
</File>
<File>
<FileName>mbfuncdiag.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\functions\mbfuncdiag.c</FilePath>
</File>
<File>
<FileName>user_mb_app.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\port\user_mb_app.c</FilePath>
</File>
<File>
<FileName>portevent.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\port\portevent.c</FilePath>
</File>
<File>
<FileName>mb_m.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\modbus\mb_m.c</FilePath>
</File>
<File>
<FileName>portevent_m.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\freemodbus\port\portevent_m.c</FilePath>
</File>
</Files>
</Group>
@@ -2343,16 +2348,6 @@
<Group>
<GroupName>klibc</GroupName>
<Files>
<File>
<FileName>kstdio.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\rt-thread\src\klibc\kstdio.c</FilePath>
</File>
<File>
<FileName>kstring.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\rt-thread\src\klibc\kstring.c</FilePath>
</File>
<File>
<FileName>kerrno.c</FileName>
<FileType>1</FileType>
@@ -2363,11 +2358,21 @@
<FileType>1</FileType>
<FilePath>..\..\rt-thread\src\klibc\rt_vsscanf.c</FilePath>
</File>
<File>
<FileName>kstdio.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\rt-thread\src\klibc\kstdio.c</FilePath>
</File>
<File>
<FileName>rt_vsnprintf_tiny.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\rt-thread\src\klibc\rt_vsnprintf_tiny.c</FilePath>
</File>
<File>
<FileName>kstring.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\rt-thread\src\klibc\kstring.c</FilePath>
</File>
</Files>
</Group>
<Group>
@@ -2403,86 +2408,21 @@
<Group>
<GroupName>STM32F4-CMSIS</GroupName>
<Files>
<File>
<FileName>system_stm32f4xx.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_CMSIS\Source\Templates\system_stm32f4xx.c</FilePath>
</File>
<File>
<FileName>startup_stm32f405xx.s</FileName>
<FileType>2</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_CMSIS\Source\Templates\arm\startup_stm32f405xx.s</FilePath>
</File>
<File>
<FileName>system_stm32f4xx.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_CMSIS\Source\Templates\system_stm32f4xx.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>STM32F4-HAL</GroupName>
<Files>
<File>
<FileName>stm32f4xx_hal_rcc.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rcc.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_uart.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_uart.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_rng.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rng.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_cryp_ex.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cryp_ex.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_dma.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_dma.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_pwr.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pwr.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_usart.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_usart.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_cec.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cec.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_cortex.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cortex.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_cryp.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cryp.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_pwr_ex.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pwr_ex.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_i2c.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_i2c.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_crc.c</FileName>
<FileType>1</FileType>
@@ -2494,9 +2434,29 @@
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_i2c_ex.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_dma_ex.c</FileName>
<FileName>stm32f4xx_hal_cortex.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_dma_ex.c</FilePath>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cortex.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_i2c.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_i2c.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_gpio.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_gpio.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_pwr_ex.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pwr_ex.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_dma.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_dma.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_rcc_ex.c</FileName>
@@ -2504,9 +2464,54 @@
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rcc_ex.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_gpio.c</FileName>
<FileName>stm32f4xx_hal_pwr.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_gpio.c</FilePath>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pwr.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_rng.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rng.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_uart.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_uart.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_rcc.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rcc.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_usart.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_usart.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_dma_ex.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_dma_ex.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_cec.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cec.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_cryp_ex.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cryp_ex.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_cryp.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cryp.c</FilePath>
</File>
</Files>
</Group>
+1 -1
View File
@@ -463,7 +463,7 @@
#define BSP_USING_UART1
#define BSP_USING_UART2
#define BSP_USING_UART3
#define BSP_USING_UART4
#define BSP_USING_UART5
#define BSP_USING_UART6
#define BSP_USING_I2C
#define BSP_USING_I2C1
+1 -1
View File
@@ -336,7 +336,7 @@
<v6Rtti>0</v6Rtti>
<VariousControls>
<MiscControls></MiscControls>
<Define>STM32F405xx, USE_HAL_DRIVER, USER_VECT_TAB_ADDRESS=0x08010000</Define>
<Define>STM32F405xx, USE_HAL_DRIVER</Define>
<Undefine></Undefine>
<IncludePath>.;..\..\..\include;applications;.;board;board\CubeMX_Config\Inc;..\libraries\HAL_Drivers;..\libraries\HAL_Drivers\config;packages\led;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\cortex-m4;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\finsh;..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Inc;..\libraries\STM32F4xx_HAL\CMSIS\Device\ST\STM32F4xx\Include;..\libraries\STM32F4xx_HAL\CMSIS\Include</IncludePath>
</VariousControls>