From c8032dd1c6460d8f5e38ba80c34cfeb1dfa58579 Mon Sep 17 00:00:00 2001 From: wmano Date: Thu, 16 Oct 2025 00:07:30 +0800 Subject: [PATCH] change rel control --- apps/chrg/.config | 42 +- apps/chrg/applications/bsp/chrg_i2c.c | 121 ---- apps/chrg/applications/bsp/chrg_i2c.h | 43 -- apps/chrg/applications/bsp/chrg_intr.c | 115 ---- apps/chrg/applications/bsp/chrg_intr.h | 45 -- apps/chrg/applications/bsp/chrg_rel.c | 104 ++++ apps/chrg/applications/bsp/chrg_rel.h | 41 ++ apps/chrg/applications/thread/chrg_north.c | 38 ++ apps/chrg/applications/thread/chrg_north.h | 9 + apps/chrg/applications/thread/chrg_roll.c | 2 + apps/chrg/applications/utils/chrg_pcf8574.c | 132 ----- apps/chrg/applications/utils/chrg_pcf8574.h | 23 - apps/chrg/chrg.uvprojx | 582 +++++--------------- apps/chrg/rtconfig.h | 31 -- 14 files changed, 332 insertions(+), 996 deletions(-) delete mode 100644 apps/chrg/applications/bsp/chrg_i2c.c delete mode 100644 apps/chrg/applications/bsp/chrg_i2c.h delete mode 100644 apps/chrg/applications/bsp/chrg_intr.c delete mode 100644 apps/chrg/applications/bsp/chrg_intr.h create mode 100644 apps/chrg/applications/bsp/chrg_rel.c create mode 100644 apps/chrg/applications/bsp/chrg_rel.h delete mode 100644 apps/chrg/applications/utils/chrg_pcf8574.c delete mode 100644 apps/chrg/applications/utils/chrg_pcf8574.h diff --git a/apps/chrg/.config b/apps/chrg/.config index 99e6fec..55e1c83 100644 --- a/apps/chrg/.config +++ b/apps/chrg/.config @@ -246,47 +246,9 @@ CONFIG_RT_USING_SERIAL_V1=y CONFIG_RT_SERIAL_USING_DMA=y CONFIG_RT_SERIAL_RB_BUFSZ=64 # CONFIG_RT_USING_SERIAL_BYPASS is not set -CONFIG_RT_USING_CAN=y -# CONFIG_RT_CAN_USING_HDR is not set -# CONFIG_RT_CAN_USING_CANFD is not set -CONFIG_RT_CANMSG_BOX_SZ=16 -CONFIG_RT_CANSND_BOX_NUM=1 -CONFIG_RT_CANSND_MSG_TIMEOUT=100 +# CONFIG_RT_USING_CAN is not set # CONFIG_RT_USING_CPUTIME is not set -CONFIG_RT_USING_I2C=y -# CONFIG_RT_I2C_DEBUG is not set -CONFIG_RT_USING_I2C_BITOPS=y -# CONFIG_RT_I2C_BITOPS_DEBUG is not set -CONFIG_RT_USING_SOFT_I2C=y -# CONFIG_RT_USING_SOFT_I2C0 is not set -CONFIG_RT_USING_SOFT_I2C1=y -CONFIG_RT_SOFT_I2C1_SCL_PIN=34 -CONFIG_RT_SOFT_I2C1_SDA_PIN=35 -CONFIG_RT_SOFT_I2C1_BUS_NAME="i2c1" -CONFIG_RT_SOFT_I2C1_TIMING_DELAY=25 -CONFIG_RT_SOFT_I2C1_TIMING_TIMEOUT=10 -CONFIG_RT_USING_SOFT_I2C2=y -CONFIG_RT_SOFT_I2C2_SCL_PIN=4 -CONFIG_RT_SOFT_I2C2_SDA_PIN=5 -CONFIG_RT_SOFT_I2C2_BUS_NAME="i2c2" -CONFIG_RT_SOFT_I2C2_TIMING_DELAY=25 -CONFIG_RT_SOFT_I2C2_TIMING_TIMEOUT=10 -CONFIG_RT_USING_SOFT_I2C3=y -CONFIG_RT_SOFT_I2C3_SCL_PIN=36 -CONFIG_RT_SOFT_I2C3_SDA_PIN=37 -CONFIG_RT_SOFT_I2C3_BUS_NAME="i2c3" -CONFIG_RT_SOFT_I2C3_TIMING_DELAY=25 -CONFIG_RT_SOFT_I2C3_TIMING_TIMEOUT=10 -CONFIG_RT_USING_SOFT_I2C4=y -CONFIG_RT_SOFT_I2C4_SCL_PIN=30 -CONFIG_RT_SOFT_I2C4_SDA_PIN=31 -CONFIG_RT_SOFT_I2C4_BUS_NAME="i2c4" -CONFIG_RT_SOFT_I2C4_TIMING_DELAY=25 -CONFIG_RT_SOFT_I2C4_TIMING_TIMEOUT=10 -# CONFIG_RT_USING_SOFT_I2C5 is not set -# CONFIG_RT_USING_SOFT_I2C6 is not set -# CONFIG_RT_USING_SOFT_I2C7 is not set -# CONFIG_RT_USING_SOFT_I2C8 is not set +# CONFIG_RT_USING_I2C is not set # CONFIG_RT_USING_PHY is not set # CONFIG_RT_USING_PHY_V2 is not set # CONFIG_RT_USING_ADC is not set diff --git a/apps/chrg/applications/bsp/chrg_i2c.c b/apps/chrg/applications/bsp/chrg_i2c.c deleted file mode 100644 index 1d00238..0000000 --- a/apps/chrg/applications/bsp/chrg_i2c.c +++ /dev/null @@ -1,121 +0,0 @@ -#include -#include - -#include "chrg_i2c.h" - -#define LOG_TAG "chrg.i2c" -#define DBG_LEVEL DBG_LOG -#include - -struct chrg_i2c_t chrgi2c[TOTAL_I2CS] = { - [IDX_I2C_1] = { - .dev = RT_NULL, - .name = DEV_NAME_I2C1, - .slave = SLAVE_PCF8574_ADDR, - .opened = 0, - .port_value = 0, - .index = IDX_I2C_1, - }, - [IDX_I2C_2] = { - .dev = RT_NULL, - .name = DEV_NAME_I2C2, - .slave = SLAVE_PCF8574_ADDR, - .opened = 0, - .port_value = 0, - .index = IDX_I2C_2, - }, - [IDX_I2C_3] = { - .dev = RT_NULL, - .name = DEV_NAME_I2C3, - .slave = SLAVE_PCF8574_ADDR, - .opened = 0, - .port_value = 0, - .index = IDX_I2C_3, - }, - [IDX_I2C_4] = { - .dev = RT_NULL, - .name = DEV_NAME_I2C4, - .slave = SLAVE_PCF8574_ADDR, - .opened = 0, - .port_value = 0, - .index = IDX_I2C_4, - } -}; - - - - -rt_uint8_t i2c_read_byte(struct chrg_i2c_t *pI2C, rt_uint8_t addr) -{ - rt_uint8_t data = 0; - rt_uint8_t buffer[2] = {0}; - struct rt_i2c_msg msg; - - buffer[0] = addr; - - msg.addr = pI2C->slave; - msg.flags = RT_I2C_WR; - msg.buf = buffer; - msg.len = 1; - rt_i2c_transfer(pI2C->dev, &msg, 1); - - msg.flags = RT_I2C_RD; - msg.buf = &data; - rt_i2c_transfer(pI2C->dev, &msg, 1); - - return data; -} - -rt_err_t i2c_write_byte(struct chrg_i2c_t *pI2C, rt_uint8_t addr, rt_uint8_t data) -{ - rt_uint8_t buffer[2] = {0}; - struct rt_i2c_msg msg; - - buffer[0] = addr; - buffer[1] = data; - - msg.addr = pI2C->slave; - msg.flags = RT_I2C_WR; - msg.buf = buffer; - msg.len = 2; - - if (rt_i2c_transfer(pI2C->dev, &msg, 1) != 1) { - return RT_ERROR; - } - - return RT_EOK; -} - - -static int chrg_i2c_init (void) -{ - struct chrg_i2c_t *pI2C = RT_NULL; - int i = 0; - rt_err_t ret = RT_EOK; - - for (i = 0; i < TOTAL_I2CS; i++) { - pI2C = &chrgi2c[i]; - pI2C->dev = (struct rt_i2c_bus_device *)rt_device_find(pI2C->name); - if (RT_NULL == pI2C->dev) { - LOG_E("dev '%s' not found.", pI2C->name); - continue; - } - - ret = rt_device_open(&pI2C->dev->parent, RT_NULL); - if (RT_EOK != ret) { - LOG_E("open '%s' failed.", pI2C->name); - pI2C->opened = 0; - continue; - } - - pI2C->opened = 1; - } - - return RT_EOK; -} - - -INIT_ENV_EXPORT(chrg_i2c_init); - - - diff --git a/apps/chrg/applications/bsp/chrg_i2c.h b/apps/chrg/applications/bsp/chrg_i2c.h deleted file mode 100644 index 3616c50..0000000 --- a/apps/chrg/applications/bsp/chrg_i2c.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef __CHRG_I2C_H__ -#define __CHRG_I2C_H__ - -#include -#include - -#define SLAVE_PCF8574_ADDR 0x20 - -#define DEV_NAME_I2C1 "i2c1" -#define DEV_NAME_I2C2 "i2c2" -#define DEV_NAME_I2C3 "i2c3" -#define DEV_NAME_I2C4 "i2c4" - -typedef enum { - IDX_I2C_1 = 0, // 0 - IDX_I2C_2, // 1 - IDX_I2C_3, // 2 - IDX_I2C_4, // 3 - - TOTAL_I2CS -} eIDX_I2C; - - -struct chrg_i2c_t { - struct rt_i2c_bus_device *dev; - const char *name; - rt_uint8_t slave; // slave chip addr - rt_uint8_t opened; // 已开启I2C - rt_uint8_t port_value; // pcf8574 IO值 - eIDX_I2C index; // 索引 - -}; - -extern struct chrg_i2c_t chrgi2c[TOTAL_I2CS]; - -extern rt_uint8_t i2c_read_byte(struct chrg_i2c_t *pI2C, rt_uint8_t addr); - -extern rt_err_t i2c_write_byte(struct chrg_i2c_t *pI2C, rt_uint8_t addr, rt_uint8_t data); - - -#endif - - diff --git a/apps/chrg/applications/bsp/chrg_intr.c b/apps/chrg/applications/bsp/chrg_intr.c deleted file mode 100644 index cd8cc6f..0000000 --- a/apps/chrg/applications/bsp/chrg_intr.c +++ /dev/null @@ -1,115 +0,0 @@ - -#include -#include - -#include "chrg_intr.h" -#include "chrg_i2c.h" -#include "chrg_pcf8574.h" - -#define LOG_TAG "chrg.intr" -#define DBG_LEVEL DBG_LOG -#include - -struct chrg_intr_t chrgintr[TOTAL_INTRS] = { - [IDX_INTR_I2C1] = { - .name = NAME_INTR_I2C1, - .index = IDX_INTR_I2C1, - .pin = PIN_INTR_I2C1, - .mode = PIN_MODE_INPUT_PULLUP, - .pulse = PIN_IRQ_MODE_FALLING, - .value = PIN_LOW, - .delay = 20, - }, - [IDX_INTR_I2C2] = { - .name = NAME_INTR_I2C2, - .index = IDX_INTR_I2C2, - .pin = PIN_INTR_I2C2, - .mode = PIN_MODE_INPUT_PULLUP, - .pulse = PIN_IRQ_MODE_FALLING, - .value = PIN_LOW, - .delay = 0, - }, - [IDX_INTR_I2C3] = { - .name = NAME_INTR_I2C3, - .index = IDX_INTR_I2C3, - .pin = PIN_INTR_I2C3, - .mode = PIN_MODE_INPUT_PULLUP, - .pulse = PIN_IRQ_MODE_FALLING, - .value = PIN_LOW, - .delay = 0, - }, - [IDX_INTR_I2C4] = { - .name = NAME_INTR_I2C4, - .index = IDX_INTR_I2C4, - .pin = PIN_INTR_I2C4, - .mode = PIN_MODE_INPUT_PULLUP, - .pulse = PIN_IRQ_MODE_FALLING, - .value = PIN_LOW, - .delay = 0, - } -}; - -static void chrg_intr_tmr_callback (void* data) -{ - struct chrg_intr_t *pINTR = (struct chrg_intr_t *)data; - - if (RT_NULL != pINTR) { - rt_ssize_t val = rt_pin_read(pINTR->pin); - if (pINTR->value == val) { - LOG_I("check pin '%s' intr %d.", pINTR->name, pINTR->value); - } - } -} - -static int chrg_intr_tmr_create (struct chrg_intr_t *pINTR) -{ - pINTR->tmr_fd = rt_timer_create(pINTR->name, chrg_intr_tmr_callback, - pINTR, pINTR->delay, RT_TIMER_FLAG_ONE_SHOT); - if (pINTR->tmr_fd == RT_NULL) { - LOG_E("tmr create '%s' failed.", pINTR->name); - return -1; - } - - return 0; -} - -static void chrg_intr_callback (void *args) -{ - struct chrg_intr_t *pINTR = (struct chrg_intr_t *)args; - - if (RT_NULL != pINTR) { - chrg_pcf8574_get_port((eIDX_I2C)pINTR->index); - //pINTR->value = rt_pin_read(pINTR->pin); - //if (pINTR->delay) { - // rt_timer_start(pINTR->tmr_fd); - //} - //LOG_I("pin '%s' intr %d.", pINTR->name, pINTR->value); - } - -} - -static int chrg_intr_init (void) -{ - int i = 0; - struct chrg_intr_t *pINTR = RT_NULL; - - for (i = 0; i < TOTAL_INTRS; i++) { - pINTR = &chrgintr[i]; - - rt_pin_mode(pINTR->pin, pINTR->mode); - rt_pin_attach_irq(pINTR->pin, pINTR->pulse, chrg_intr_callback, pINTR); - rt_pin_irq_enable(pINTR->pin, PIN_IRQ_ENABLE); - - if (pINTR->delay) { - chrg_intr_tmr_create(pINTR); - } - } - - return 0; -} - - -INIT_ENV_EXPORT(chrg_intr_init); - - - diff --git a/apps/chrg/applications/bsp/chrg_intr.h b/apps/chrg/applications/bsp/chrg_intr.h deleted file mode 100644 index 96777e8..0000000 --- a/apps/chrg/applications/bsp/chrg_intr.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef __CHRG_IRQ_H__ -#define __CHRG_IRQ_H__ - -#include -#include - -#include "drv_gpio.h" - -#include "chrg_i2c.h" - -#define NAME_INTR_I2C1 "i2c1irq" -#define NAME_INTR_I2C2 "i2c2irq" -#define NAME_INTR_I2C3 "i2c3irq" -#define NAME_INTR_I2C4 "i2c4irq" - -#define PIN_INTR_I2C1 GET_PIN(C, 1) -#define PIN_INTR_I2C2 GET_PIN(A, 1) -#define PIN_INTR_I2C3 GET_PIN(A, 7) -#define PIN_INTR_I2C4 GET_PIN(B, 13) - -typedef enum { - IDX_INTR_I2C1 = IDX_I2C_1, // 0 中断脚关联 I2C1 - IDX_INTR_I2C2 = IDX_I2C_2, // 1 中断脚关联 I2C2 - IDX_INTR_I2C3 = IDX_I2C_3, // 2 中断脚关联 I2C3 - IDX_INTR_I2C4 = IDX_I2C_4, // 3 中断脚关联 I2C4 - - TOTAL_INTRS -} eIDX_INTR; - -struct chrg_intr_t { - const char *name; - rt_int32_t pin; - rt_uint8_t mode; - rt_uint8_t pulse; - rt_uint16_t delay; // 消抖延时 ms - rt_ssize_t value; // 当前值 - rt_timer_t tmr_fd; - eIDX_INTR index; -}; - -extern struct chrg_intr_t chrgintr[TOTAL_INTRS]; - -#endif - - diff --git a/apps/chrg/applications/bsp/chrg_rel.c b/apps/chrg/applications/bsp/chrg_rel.c new file mode 100644 index 0000000..0e2b745 --- /dev/null +++ b/apps/chrg/applications/bsp/chrg_rel.c @@ -0,0 +1,104 @@ +#include +#include +#include + +#include "chrg_rel.h" + +struct chrg_rel_t chrgrel[TOTAL_CHS] = { + [IDX_CH_0] = {PIN_NORTH_CH0_P0, PIN_NORTH_CH0_P1, PIN_NORTH_CH0_P2}, + [IDX_CH_1] = {PIN_NORTH_CH1_P0, PIN_NORTH_CH1_P1, PIN_NORTH_CH1_P2}, + [IDX_CH_2] = {PIN_NORTH_CH2_P0, PIN_NORTH_CH2_P1, PIN_NORTH_CH2_P2}, + [IDX_CH_3] = {PIN_NORTH_CH3_P0, PIN_NORTH_CH3_P1, PIN_NORTH_CH3_P2} +}; + +// 继电器组切换 +void chrg_north_sw_rel (eIDX_CH ch, eIDX_ID id) +{ + if (ch >= TOTAL_CHS) { + return ; + } + + rt_pin_write(chrgrel[ch].p2, PIN_HIGH); + + if (ID_SOURCE == id) { + rt_pin_write(chrgrel[ch].p0, PIN_LOW); + rt_pin_write(chrgrel[ch].p1, PIN_HIGH); + } else if (ID_SINK == id) { + rt_pin_write(chrgrel[ch].p1, PIN_LOW); + rt_pin_write(chrgrel[ch].p0, PIN_HIGH); + } else { + rt_pin_write(chrgrel[ch].p1, PIN_LOW); + rt_pin_write(chrgrel[ch].p0, PIN_LOW); + } + +} + +static int charg_rel_init (void) +{ + int i = 0; + + for (i = 0; i < TOTAL_CHS; i++) { + rt_pin_mode(chrgrel[i].p0, PIN_MODE_OUTPUT); + rt_pin_mode(chrgrel[i].p1, PIN_MODE_OUTPUT); + rt_pin_mode(chrgrel[i].p2, PIN_MODE_OUTPUT); + + rt_pin_write(chrgrel[i].p2, PIN_HIGH); + rt_pin_write(chrgrel[i].p0, PIN_LOW); + rt_pin_write(chrgrel[i].p1, PIN_LOW); + } + + return 0; +} + + +INIT_DEVICE_EXPORT(charg_rel_init); + +#if 1 +int rel_test (int argc, char **argv) +{ + if (argc < 3) { + rt_kprintf("help : %s <0|1|2|3> [0, 1]", argv[0]); + return -1; + } + + int idx = atoi(argv[2]); + if ((idx > 3)||(idx < 0)) { + rt_kprintf("help : %s <0|1|2|3> [0, 1]", argv[0]); + return -1; + } + + if (strcmp(argv[1], "set") == 0) { + if (argc != 4) { + rt_kprintf("help : %s <0|1|2|3> [0, 1]", argv[0]); + return -1; + } + rt_uint8_t val = (rt_uint8_t)atoi(argv[3]); + chrg_north_sw_rel((eIDX_CH)idx, (eIDX_ID)val); + } else if (strcmp(argv[1], "get") == 0) { + rt_uint8_t data[3] = {0}; + data[0] = rt_pin_read(chrgrel[idx].p0); + data[1] = rt_pin_read(chrgrel[idx].p1); + data[2] = rt_pin_read(chrgrel[idx].p2); + if ((1 == data[0])&&(0 == data[1])&&(1 == data[2])) { + rt_kprintf("rel connect [%d] : sink\r\n", idx); + } else if ((0 == data[0])&&(1 == data[1])&&(1 == data[2])) { + rt_kprintf("rel connect [%d] : source\r\n", idx); + } else { + rt_kprintf("rel connect [%d] : p0=%d, p1=%d, p2=%d\r\n", + idx, data[0], data[1], data[2]); + } + + } else { + return -1; + } + + return 0; +} + +MSH_CMD_EXPORT(rel_test, test rel connect.); + +#endif + + + + diff --git a/apps/chrg/applications/bsp/chrg_rel.h b/apps/chrg/applications/bsp/chrg_rel.h new file mode 100644 index 0000000..d004213 --- /dev/null +++ b/apps/chrg/applications/bsp/chrg_rel.h @@ -0,0 +1,41 @@ +#ifndef __CHRG_REL_H__ +#define __CHRG_REL_H__ + +#include + +#include "chrg_switch.h" +#include "chrg_def.h" + +// 北向1路 继电器 +#define PIN_NORTH_CH0_P0 GET_PIN(C, 3) +#define PIN_NORTH_CH0_P1 GET_PIN(C, 2) +#define PIN_NORTH_CH0_P2 GET_PIN(C, 1) + +// 北向2路 继电器 +#define PIN_NORTH_CH1_P0 GET_PIN(A, 5) +#define PIN_NORTH_CH1_P1 GET_PIN(A, 4) +#define PIN_NORTH_CH1_P2 GET_PIN(A, 1) + +// 北向3路 继电器 +#define PIN_NORTH_CH2_P0 GET_PIN(C, 5) +#define PIN_NORTH_CH2_P1 GET_PIN(C, 4) +#define PIN_NORTH_CH2_P2 GET_PIN(A, 7) + +// 北向4路 继电器 +#define PIN_NORTH_CH3_P0 GET_PIN(B, 15) +#define PIN_NORTH_CH3_P1 GET_PIN(B, 14) +#define PIN_NORTH_CH3_P2 GET_PIN(B, 13) + +struct chrg_rel_t { + rt_base_t p0; // connect K1/K3 for sink + rt_base_t p1; // connect K2/K4 for source + rt_base_t p2; // connect K5 for PGND +}; + +extern struct chrg_rel_t chrgrel[TOTAL_CHS]; + +extern void chrg_north_sw_rel (eIDX_CH ch, eIDX_ID id); + +#endif + + diff --git a/apps/chrg/applications/thread/chrg_north.c b/apps/chrg/applications/thread/chrg_north.c index 98df354..fbb253f 100644 --- a/apps/chrg/applications/thread/chrg_north.c +++ b/apps/chrg/applications/thread/chrg_north.c @@ -15,8 +15,40 @@ struct chrg_north_t chrgnorth = { .tid = RT_NULL, .tty = RT_NULL, .rx_len = 0, + .sw[IDX_CH_0] = { + .id = ID_SINK, + }, + .sw[IDX_CH_1] = { + .id = ID_SINK, + }, + .sw[IDX_CH_2] = { + .id = ID_SINK, + }, + .sw[IDX_CH_3] = { + .id = ID_SINK, + }, }; +const rt_base_t sw_uart[TOTAL_CHS] = { + PIN_NORTH_UART_SW1, + PIN_NORTH_UART_SW2, + PIN_NORTH_UART_SW3, + PIN_NORTH_UART_SW4 +}; + +void chrg_north_sw_uart (eIDX_CH ch, eIDX_ID id) +{ + if (ch >= TOTAL_CHS) { + return ; + } + + if (ID_SOURCE == id) { + rt_pin_write(sw_uart[ch], PIN_HIGH); + } else { + rt_pin_write(sw_uart[ch], PIN_LOW); + } + +} int chrg_north_send (rt_uint8_t *data, rt_size_t length) { @@ -71,6 +103,12 @@ static int chrg_north_init (void) rt_err_t ret; struct chrg_north_t *pNOR = &chrgnorth; + int i = 0; + for (i = 0; i < TOTAL_CHS; i++) { + rt_pin_mode(sw_uart[i], PIN_MODE_OUTPUT); + chrg_north_sw_uart((eIDX_CH)i, ID_SINK); + } + pNOR->tty = chrg_tty_create(pNOR->devname, 2000000, 0, -1, 1); if (RT_NULL == pNOR->tty) { LOG_E("tty can't create."); diff --git a/apps/chrg/applications/thread/chrg_north.h b/apps/chrg/applications/thread/chrg_north.h index e3d1eae..2a2ad4c 100644 --- a/apps/chrg/applications/thread/chrg_north.h +++ b/apps/chrg/applications/thread/chrg_north.h @@ -10,6 +10,13 @@ #define THR_NAME_NORTH "thr.nor" #define DEV_NAME_NORTH "uart3" + +#define PIN_NORTH_UART_SW1 GET_PIN(C, 0) +#define PIN_NORTH_UART_SW2 GET_PIN(A, 0) +#define PIN_NORTH_UART_SW3 GET_PIN(A, 6) +#define PIN_NORTH_UART_SW4 GET_PIN(B, 12) + + struct chrg_north_t { const char *name; const char *devname; @@ -26,6 +33,8 @@ struct chrg_north_t { extern struct chrg_north_t chrgnorth; +extern void chrg_north_sw_uart (eIDX_CH ch, eIDX_ID id); + extern int chrg_north_send (rt_uint8_t *data, rt_size_t length); diff --git a/apps/chrg/applications/thread/chrg_roll.c b/apps/chrg/applications/thread/chrg_roll.c index 2138267..4f1328d 100644 --- a/apps/chrg/applications/thread/chrg_roll.c +++ b/apps/chrg/applications/thread/chrg_roll.c @@ -69,8 +69,10 @@ static void chrg_roll_thread_entry (void *data) pSW = &pNOR->sw[pNOR->idx]; if (ID_SOURCE == pSW->id) { + chrg_north_sw_uart(pNOR->idx, ID_SOURCE); source_get_vc(pSW->source.voltage, pSW->source.current); } else if (ID_SINK == pSW->id) { + chrg_north_sw_uart(pNOR->idx, ID_SINK); sink_get_vc(pSW->sink.loadv, pSW->sink.loadc); } } diff --git a/apps/chrg/applications/utils/chrg_pcf8574.c b/apps/chrg/applications/utils/chrg_pcf8574.c deleted file mode 100644 index 61b17b0..0000000 --- a/apps/chrg/applications/utils/chrg_pcf8574.c +++ /dev/null @@ -1,132 +0,0 @@ -#include -#include -#include - -#include "chrg_i2c.h" -#include "chrg_pcf8574.h" - -#define LOG_TAG "chrg.pcf" -#define DBG_LEVEL DBG_LOG -#include - - -// 读取所有8口IO状态 -rt_uint8_t chrg_pcf8574_get_port (eIDX_I2C idx) -{ - rt_uint8_t value = 0; - if (idx >= TOTAL_I2CS) { - return 0; - } - - rt_ssize_t ret = 0; - struct chrg_i2c_t *pI2C = &chrgi2c[idx]; - - if (!pI2C->opened) { - return 0; - } - - ret = rt_device_read(&pI2C->dev->parent, pI2C->slave, &value, 1); - if (ret <= 0) { - LOG_E("read failed. [%d]", ret); - return 0; - } - - pI2C->port_value = value; - - return value; -} - -// 读取指定管脚状态值 -rt_uint8_t chrg_pcf8574_get_pin (eIDX_I2C idx, uint8_t bit) -{ - rt_uint8_t data = chrg_pcf8574_get_port(idx); - if (data & (1 << bit)) { - return 1; - } - - return 0; -} - -// 设置所有8口IO状态值 -int chrg_pcf8574_set_port (eIDX_I2C idx, uint8_t value) -{ - if (idx >= TOTAL_I2CS) { - return -1; - } - - rt_ssize_t ret = 0; - struct chrg_i2c_t *pI2C = &chrgi2c[idx]; - - if (!pI2C->opened) { - return -1; - } - - ret = rt_device_write(&pI2C->dev->parent, pI2C->slave, &value, 1); - - return ret; -} - -// 设置指定管脚状态值 -int chrg_pcf8574_set_pin (eIDX_I2C idx, uint8_t bit, uint8_t value) -{ - if (idx >= TOTAL_I2CS) { - return -1; - } - - int ret = 0; - struct chrg_i2c_t *pI2C = &chrgi2c[idx]; - - if (!pI2C->opened) { - return -1; - } - - rt_uint8_t data = chrg_pcf8574_get_port(idx); - if (value == 0) { - data &= ~(1 << bit); - } else { - data |= 1 << bit; - } - - ret = chrg_pcf8574_set_port(idx, data); - - return ret; -} - -#if 1 -int pcf_test (int argc, char **argv) -{ - if (argc < 3) { - rt_kprintf("help : %s <0|1|2|3> [0, 255]", argv[0]); - return -1; - } - - int idx = atoi(argv[2]); - if ((idx > 3)||(idx < 0)) { - rt_kprintf("help : %s <0|1|2|3> [0, 255]", argv[0]); - return -1; - } - - if (strcmp(argv[1], "set") == 0) { - if (argc != 4) { - rt_kprintf("help : %s <0|1|2|3> [0, 255]", argv[0]); - return -1; - } - rt_uint8_t val = (rt_uint8_t)atoi(argv[3]); - chrg_pcf8574_set_port((eIDX_I2C)idx, val); - } else if (strcmp(argv[1], "get") == 0) { - rt_uint8_t data = chrg_pcf8574_get_port((eIDX_I2C)idx); - rt_kprintf("value : 0x%02X", data); - } else { - return -1; - } - - return 0; -} - -MSH_CMD_EXPORT(pcf_test, test pcf8574 port/pin.); - -#endif - - - - diff --git a/apps/chrg/applications/utils/chrg_pcf8574.h b/apps/chrg/applications/utils/chrg_pcf8574.h deleted file mode 100644 index e159358..0000000 --- a/apps/chrg/applications/utils/chrg_pcf8574.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __CHRG_PCF8574_H__ -#define __CHRG_PCF8574_H__ - -#include -#include -#include "chrg_i2c.h" - -// 读取所有8口IO状态 -extern rt_uint8_t chrg_pcf8574_get_port (eIDX_I2C idx); - -// 读取指定管脚状态值 -extern rt_uint8_t chrg_pcf8574_get_pin (eIDX_I2C idx, uint8_t bit); - -// 设置所有8口IO状态值 -extern int chrg_pcf8574_set_port (eIDX_I2C idx, uint8_t value); - -// 设置指定管脚状态值 -extern int chrg_pcf8574_set_pin (eIDX_I2C idx, uint8_t bit, uint8_t value); - - -#endif - - diff --git a/apps/chrg/chrg.uvprojx b/apps/chrg/chrg.uvprojx index 24bfff4..ac763ea 100644 --- a/apps/chrg/chrg.uvprojx +++ b/apps/chrg/chrg.uvprojx @@ -337,9 +337,9 @@ 0 - RT_USING_ARMLIBC, RT_USING_LIBC, __RTTHREAD__, __STDC_LIMIT_MACROS, STM32F405xx, __CLK_TCK=RT_TICK_PER_SECOND, USE_HAL_DRIVER + USE_HAL_DRIVER, STM32F405xx, __CLK_TCK=RT_TICK_PER_SECOND, __STDC_LIMIT_MACROS, RT_USING_LIBC, __RTTHREAD__, RT_USING_ARMLIBC - ..\..\rt-thread\libcpu\arm\common;..\..\rt-thread\components\finsh;board;..\..\rt-thread\components\libc\posix\io\eventfd;..\..\rt-thread\components\drivers\phy;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\drivers\include;.;applications;..\..\rt-thread\include;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers\config;..\..\rt-thread\components\libc\posix\io\poll;..\..\rt-thread\components\drivers\include;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers\drv_flash;..\..\rt-thread\components\libc\posix\io\epoll;applications\thread;..\..\rt-thread\components\fal\inc;..\..\libs\stm32f4\STM32F4_CMSIS\Include;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\libc\compilers\common\extension;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\libc\posix\ipc;..\..\rt-thread\components\libc\compilers\common\include;applications\utils;..\..\libs\cmsis-core\Include;board\CubeMX_Config\Inc;..\..\rt-thread\components\libc\compilers\common\extension\fcntl\octal;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers;applications\bsp;..\..\rt-thread\components\drivers\include;..\..\rt-thread\libcpu\arm\cortex-m4;..\..\libs\stm32f4\STM32F4_HAL\Inc\Legacy;..\..\rt-thread\components\drivers\smp_call;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\legacy\usb\usbdevice;board\ports;..\..\rt-thread\components\drivers\include;..\..\libs\stm32f4\STM32F4_HAL\Inc;..\..\rt-thread\components\drivers\include + applications\bsp;..\..\rt-thread\components\libc\posix\ipc;..\..\rt-thread\components\drivers\phy;..\..\rt-thread\components\finsh;..\..\libs\stm32f4\STM32F4_HAL\Inc;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers\drv_flash;..\..\rt-thread\include;..\..\libs\stm32f4\STM32F4_HAL\Inc\Legacy;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\libc\posix\io\eventfd;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers;..\..\rt-thread\components\libc\compilers\common\extension\fcntl\octal;..\..\rt-thread\components\legacy\usb\usbdevice;applications\utils;board;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\libc\compilers\common\extension;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\libc\posix\io\poll;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers;..\..\rt-thread\components\libc\posix\io\epoll;..\..\rt-thread\components\libc\compilers\common\include;applications\thread;board\ports;..\..\rt-thread\libcpu\arm\cortex-m4;..\..\libs\cmsis-core\Include;applications;board\CubeMX_Config\Inc;..\..\rt-thread\components\drivers\include;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers\config;..\..\libs\stm32f4\STM32F4_CMSIS\Include;..\..\rt-thread\components\drivers\include;.;..\..\rt-thread\components\drivers\smp_call;..\..\rt-thread\libcpu\arm\common;..\..\rt-thread\components\fal\inc @@ -394,14 +394,9 @@ Applications/bsp - chrg_pin.c + chrg_vcom.c 1 - applications\bsp\chrg_pin.c - - - chrg_tmr.c - 1 - applications\bsp\chrg_tmr.c + applications\bsp\chrg_vcom.c chrg_wdt.c @@ -409,9 +404,9 @@ applications\bsp\chrg_wdt.c - chrg_i2c.c + chrg_pin.c 1 - applications\bsp\chrg_i2c.c + applications\bsp\chrg_pin.c chrg_fal.c @@ -419,54 +414,54 @@ applications\bsp\chrg_fal.c - chrg_vcom.c + chrg_rel.c 1 - applications\bsp\chrg_vcom.c + applications\bsp\chrg_rel.c - chrg_tty.c + chrg_tmr.c 1 - applications\bsp\chrg_tty.c + applications\bsp\chrg_tmr.c chrg_clk.c 1 applications\bsp\chrg_clk.c + + chrg_tty.c + 1 + applications\bsp\chrg_tty.c + chrg_switch.c 1 applications\bsp\chrg_switch.c - - chrg_intr.c - 1 - applications\bsp\chrg_intr.c - Applications/thread + + chrg_roll.c + 1 + applications\thread\chrg_roll.c + chrg_north.c 1 applications\thread\chrg_north.c - - chrg_south.c - 1 - applications\thread\chrg_south.c - chrg_comm.c 1 applications\thread\chrg_comm.c - chrg_roll.c + chrg_south.c 1 - applications\thread\chrg_roll.c + applications\thread\chrg_south.c chrg_lcd.c @@ -493,11 +488,6 @@ 1 applications\utils\chrg_utils.c - - chrg_pcf8574.c - 1 - applications\utils\chrg_pcf8574.c - chrg_source.c 1 @@ -553,62 +543,6 @@ DeviceDrivers - - dev_can.c - 1 - ..\..\rt-thread\components\drivers\can\dev_can.c - - - 2 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 3 - - - 1 - - - - 2 - 0 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 0 - 2 - 2 - 2 - 2 - 2 - 0 - 0 - 2 - 2 - 2 - 2 - 2 - - - __RT_IPC_SOURCE__ - - - - - - - device.c 1 @@ -721,230 +655,6 @@ - - dev_i2c_bit_ops.c - 1 - ..\..\rt-thread\components\drivers\i2c\dev_i2c_bit_ops.c - - - 2 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 3 - - - 1 - - - - 2 - 0 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 0 - 2 - 2 - 2 - 2 - 2 - 0 - 0 - 2 - 2 - 2 - 2 - 2 - - - __RT_IPC_SOURCE__ - - - - - - - - - dev_i2c_core.c - 1 - ..\..\rt-thread\components\drivers\i2c\dev_i2c_core.c - - - 2 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 3 - - - 1 - - - - 2 - 0 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 0 - 2 - 2 - 2 - 2 - 2 - 0 - 0 - 2 - 2 - 2 - 2 - 2 - - - __RT_IPC_SOURCE__ - - - - - - - - - dev_i2c_dev.c - 1 - ..\..\rt-thread\components\drivers\i2c\dev_i2c_dev.c - - - 2 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 3 - - - 1 - - - - 2 - 0 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 0 - 2 - 2 - 2 - 2 - 2 - 0 - 0 - 2 - 2 - 2 - 2 - 2 - - - __RT_IPC_SOURCE__ - - - - - - - - - dev_soft_i2c.c - 1 - ..\..\rt-thread\components\drivers\i2c\dev_soft_i2c.c - - - 2 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 3 - - - 1 - - - - 2 - 0 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 0 - 2 - 2 - 2 - 2 - 2 - 0 - 0 - 2 - 2 - 2 - 2 - 2 - - - __RT_IPC_SOURCE__ - - - - - - - completion_comm.c 1 @@ -1632,11 +1342,6 @@ 1 board\board.c - - drv_can.c - 1 - ..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers\drv_can.c - drv_flash_f4.c 1 @@ -1678,30 +1383,35 @@ Fal - fal_partition.c + fal_flash.c 1 - ..\..\rt-thread\components\fal\src\fal_partition.c + ..\..\rt-thread\components\fal\src\fal_flash.c fal.c 1 ..\..\rt-thread\components\fal\src\fal.c - - fal_flash.c - 1 - ..\..\rt-thread\components\fal\src\fal_flash.c - fal_rtt.c 1 ..\..\rt-thread\components\fal\src\fal_rtt.c + + fal_partition.c + 1 + ..\..\rt-thread\components\fal\src\fal_partition.c + Finsh + + msh.c + 1 + ..\..\rt-thread\components\finsh\msh.c + cmd.c 1 @@ -1717,11 +1427,6 @@ 1 ..\..\rt-thread\components\finsh\msh_parse.c - - msh.c - 1 - ..\..\rt-thread\components\finsh\msh.c - @@ -2573,25 +2278,25 @@ klibc - rt_vsnprintf_tiny.c + rt_vsscanf.c 1 - ..\..\rt-thread\src\klibc\rt_vsnprintf_tiny.c + ..\..\rt-thread\src\klibc\rt_vsscanf.c kerrno.c 1 ..\..\rt-thread\src\klibc\kerrno.c + + rt_vsnprintf_tiny.c + 1 + ..\..\rt-thread\src\klibc\rt_vsnprintf_tiny.c + kstring.c 1 ..\..\rt-thread\src\klibc\kstring.c - - rt_vsscanf.c - 1 - ..\..\rt-thread\src\klibc\rt_vsscanf.c - kstdio.c 1 @@ -2632,11 +2337,6 @@ rt_usbd - - usbdevice_core.c - 1 - ..\..\rt-thread\components\legacy\usb\usbdevice\core\usbdevice_core.c - usbdevice.c 1 @@ -2647,6 +2347,11 @@ 1 ..\..\rt-thread\components\legacy\usb\usbdevice\class\cdc_vcom.c + + usbdevice_core.c + 1 + ..\..\rt-thread\components\legacy\usb\usbdevice\core\usbdevice_core.c + @@ -2667,110 +2372,25 @@ STM32F4-HAL - - stm32f4xx_hal_uart.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_uart.c - - - stm32f4xx_ll_usb.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_ll_usb.c - - - stm32f4xx_hal_crc.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_crc.c - - - stm32f4xx_hal.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal.c - - - stm32f4xx_hal_flash_ex.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_flash_ex.c - - - stm32f4xx_hal_pcd_ex.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pcd_ex.c - - - stm32f4xx_hal_pwr_ex.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pwr_ex.c - - - stm32f4xx_hal_rng.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rng.c - - - stm32f4xx_hal_tim_ex.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_tim_ex.c - - - stm32f4xx_hal_tim.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_tim.c - - - stm32f4xx_hal_iwdg.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_iwdg.c - - - stm32f4xx_hal_i2c.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_i2c.c - stm32f4xx_hal_flash.c 1 ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_flash.c - stm32f4xx_hal_i2c_ex.c + stm32f4xx_hal_uart.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_i2c_ex.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_uart.c - stm32f4xx_hal_rcc_ex.c + stm32f4xx_hal_usart.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rcc_ex.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_usart.c - stm32f4xx_hal_pcd.c + stm32f4xx_hal.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pcd.c - - - stm32f4xx_hal_can.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_can.c - - - stm32f4xx_hal_pccard.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pccard.c - - - stm32f4xx_hal_dma.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_dma.c - - - stm32f4xx_hal_flash_ramfunc.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_flash_ramfunc.c - - - stm32f4xx_hal_cec.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cec.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal.c stm32f4xx_hal_cryp_ex.c @@ -2783,24 +2403,29 @@ ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_gpio.c - stm32f4xx_hal_pwr.c + stm32f4xx_hal_cryp.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pwr.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cryp.c - stm32f4xx_hal_usart.c + stm32f4xx_hal_crc.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_usart.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_crc.c - stm32f4xx_hal_rcc.c + stm32f4xx_hal_pccard.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rcc.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pccard.c - stm32f4xx_hal_hcd.c + stm32f4xx_hal_cec.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_hcd.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cec.c + + + stm32f4xx_hal_pcd.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pcd.c stm32f4xx_hal_wwdg.c @@ -2808,14 +2433,69 @@ ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_wwdg.c - stm32f4xx_hal_cryp.c + stm32f4xx_hal_cortex.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cryp.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cortex.c - stm32f4xx_hal_lptim.c + stm32f4xx_hal_flash_ex.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_lptim.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_flash_ex.c + + + stm32f4xx_hal_flash_ramfunc.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_flash_ramfunc.c + + + stm32f4xx_hal_pcd_ex.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pcd_ex.c + + + stm32f4xx_hal_tim.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_tim.c + + + stm32f4xx_ll_usb.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_ll_usb.c + + + stm32f4xx_hal_pwr.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pwr.c + + + stm32f4xx_hal_hcd.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_hcd.c + + + stm32f4xx_hal_rcc_ex.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rcc_ex.c + + + stm32f4xx_hal_tim_ex.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_tim_ex.c + + + stm32f4xx_hal_rng.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rng.c + + + stm32f4xx_hal_iwdg.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_iwdg.c + + + stm32f4xx_hal_dma.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_dma.c stm32f4xx_hal_dma_ex.c @@ -2823,9 +2503,19 @@ ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_dma_ex.c - stm32f4xx_hal_cortex.c + stm32f4xx_hal_rcc.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cortex.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rcc.c + + + stm32f4xx_hal_lptim.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_lptim.c + + + stm32f4xx_hal_pwr_ex.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pwr_ex.c diff --git a/apps/chrg/rtconfig.h b/apps/chrg/rtconfig.h index 57a2484..5ac74da 100644 --- a/apps/chrg/rtconfig.h +++ b/apps/chrg/rtconfig.h @@ -154,37 +154,6 @@ #define RT_USING_SERIAL_V1 #define RT_SERIAL_USING_DMA #define RT_SERIAL_RB_BUFSZ 64 -#define RT_USING_CAN -#define RT_CANMSG_BOX_SZ 16 -#define RT_CANSND_BOX_NUM 1 -#define RT_CANSND_MSG_TIMEOUT 100 -#define RT_USING_I2C -#define RT_USING_I2C_BITOPS -#define RT_USING_SOFT_I2C -#define RT_USING_SOFT_I2C1 -#define RT_SOFT_I2C1_SCL_PIN 34 -#define RT_SOFT_I2C1_SDA_PIN 35 -#define RT_SOFT_I2C1_BUS_NAME "i2c1" -#define RT_SOFT_I2C1_TIMING_DELAY 25 -#define RT_SOFT_I2C1_TIMING_TIMEOUT 10 -#define RT_USING_SOFT_I2C2 -#define RT_SOFT_I2C2_SCL_PIN 4 -#define RT_SOFT_I2C2_SDA_PIN 5 -#define RT_SOFT_I2C2_BUS_NAME "i2c2" -#define RT_SOFT_I2C2_TIMING_DELAY 25 -#define RT_SOFT_I2C2_TIMING_TIMEOUT 10 -#define RT_USING_SOFT_I2C3 -#define RT_SOFT_I2C3_SCL_PIN 36 -#define RT_SOFT_I2C3_SDA_PIN 37 -#define RT_SOFT_I2C3_BUS_NAME "i2c3" -#define RT_SOFT_I2C3_TIMING_DELAY 25 -#define RT_SOFT_I2C3_TIMING_TIMEOUT 10 -#define RT_USING_SOFT_I2C4 -#define RT_SOFT_I2C4_SCL_PIN 30 -#define RT_SOFT_I2C4_SDA_PIN 31 -#define RT_SOFT_I2C4_BUS_NAME "i2c4" -#define RT_SOFT_I2C4_TIMING_DELAY 25 -#define RT_SOFT_I2C4_TIMING_TIMEOUT 10 #define RT_USING_WDT #define RT_USING_PIN #define RT_USING_HWTIMER