add roll thread
This commit is contained in:
@@ -11,10 +11,10 @@
|
||||
#include <rtdbg.h>
|
||||
|
||||
rt_uint16_t usSDiscInStart = S_DISCRETE_INPUT_START;
|
||||
rt_uint8_t ucSDiscInBuf[(S_DISCRETE_INPUT_NDISCRETES+7)/8];
|
||||
rt_uint8_t ucSDiscInBuf[(S_DISCRETE_INPUT_NDISCRETES+BITS_UCHAR-1)/BITS_UCHAR];
|
||||
|
||||
rt_uint16_t usSCoilStart = S_COIL_START;
|
||||
rt_uint8_t ucSCoilBuf[(S_COIL_NCOILS+7)/8];
|
||||
rt_uint8_t ucSCoilBuf[(S_COIL_NCOILS+BITS_UCHAR-1)/BITS_UCHAR];
|
||||
|
||||
rt_uint16_t usSRegInStart = S_REG_INPUT_START;
|
||||
rt_uint16_t usSRegInBuf[S_REG_INPUT_NREGS];
|
||||
@@ -22,7 +22,7 @@ rt_uint16_t usSRegInBuf[S_REG_INPUT_NREGS];
|
||||
rt_uint16_t usSRegHoldStart = S_REG_HOLDING_START;
|
||||
rt_uint16_t usSRegHoldBuf[S_REG_HOLDING_NREGS];
|
||||
|
||||
#define BITS_UCHAR 8U
|
||||
|
||||
|
||||
struct chrg_comm_t chrgcomm = {
|
||||
.name = THR_NAME_COMM,
|
||||
@@ -58,16 +58,16 @@ struct chrg_comm_t chrgcomm = {
|
||||
* ucBits[2] = {0, 0};
|
||||
*
|
||||
* // Set bit 4 to 1 (read: set 1 bit starting at bit offset 4 to value 1)
|
||||
* xMBUtilSetBits( ucBits, 4, 1, 1 );
|
||||
* mb_set_bits( ucBits, 4, 1, 1 );
|
||||
*
|
||||
* // Set bit 7 to 1 and bit 8 to 0.
|
||||
* xMBUtilSetBits( ucBits, 7, 2, 0x01 );
|
||||
* mb_set_bits( ucBits, 7, 2, 0x01 );
|
||||
*
|
||||
* // Set bits 8 - 11 to 0x05 and bits 12 - 15 to 0x0A;
|
||||
* xMBUtilSetBits( ucBits, 8, 8, 0x5A);
|
||||
* mb_set_bits( ucBits, 8, 8, 0x5A);
|
||||
* \endcode
|
||||
*/
|
||||
void xMBUtilSetBits (rt_uint8_t *ucByteBuf, rt_uint16_t usBitOffset,
|
||||
void mb_set_bits (rt_uint8_t *ucByteBuf, rt_uint16_t usBitOffset,
|
||||
rt_uint8_t ucNBits, rt_uint8_t ucValue)
|
||||
{
|
||||
rt_uint16_t usWordBuf;
|
||||
@@ -76,7 +76,7 @@ void xMBUtilSetBits (rt_uint8_t *ucByteBuf, rt_uint16_t usBitOffset,
|
||||
rt_uint16_t usNPreBits;
|
||||
rt_uint16_t usValue = ucValue;
|
||||
|
||||
RT_ASSERT(ucNBits <= 8);
|
||||
RT_ASSERT(ucNBits <= BITS_UCHAR);
|
||||
RT_ASSERT((size_t)BITS_UCHAR == sizeof(rt_uint8_t) * 8);
|
||||
|
||||
/* Calculate byte offset for first byte containing the bit values starting
|
||||
@@ -121,10 +121,10 @@ void xMBUtilSetBits (rt_uint8_t *ucByteBuf, rt_uint16_t usBitOffset,
|
||||
* rt_uint8_t ucResult;
|
||||
*
|
||||
* // Extract the bits 3 - 10.
|
||||
* ucResult = xMBUtilGetBits( ucBits, 3, 8 );
|
||||
* ucResult = mb_get_bits( ucBits, 3, 8 );
|
||||
* \endcode
|
||||
*/
|
||||
rt_uint8_t xMBUtilGetBits (rt_uint8_t * ucByteBuf, rt_uint16_t usBitOffset, rt_uint8_t ucNBits)
|
||||
rt_uint8_t mb_get_bits (rt_uint8_t * ucByteBuf, rt_uint16_t usBitOffset, rt_uint8_t ucNBits)
|
||||
{
|
||||
rt_uint16_t usWordBuf;
|
||||
rt_uint16_t usMask;
|
||||
@@ -154,7 +154,7 @@ rt_uint8_t xMBUtilGetBits (rt_uint8_t * ucByteBuf, rt_uint16_t usBitOffset, rt_u
|
||||
return (rt_uint8_t)usWordBuf;
|
||||
}
|
||||
|
||||
static eMBException prveMBError2Exception (eMBErrorCode eErrorCode)
|
||||
static eMBException mb_error (eMBErrorCode eErrorCode)
|
||||
{
|
||||
eMBException eStatus;
|
||||
|
||||
@@ -180,17 +180,7 @@ static eMBException prveMBError2Exception (eMBErrorCode eErrorCode)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Modbus slave input register callback function.
|
||||
*
|
||||
* @param pucRegBuffer input register buffer
|
||||
* @param usAddress input register address
|
||||
* @param usNRegs input register number
|
||||
*
|
||||
* @return result
|
||||
*/
|
||||
eMBErrorCode eMBRegInputCB (rt_uint8_t *pucRegBuffer, rt_uint16_t usAddress, rt_uint16_t usNRegs)
|
||||
eMBErrorCode mb_reg_input_cb (rt_uint8_t *pucRegBuffer, rt_uint16_t usAddress, rt_uint16_t usNRegs)
|
||||
{
|
||||
eMBErrorCode eStatus = MB_ENOERR;
|
||||
rt_uint16_t iRegIndex;
|
||||
@@ -203,7 +193,7 @@ eMBErrorCode eMBRegInputCB (rt_uint8_t *pucRegBuffer, rt_uint16_t usAddress, rt_
|
||||
&& (usAddress + usNRegs <= REG_INPUT_START + REG_INPUT_NREGS)) {
|
||||
iRegIndex = usAddress - usRegInStart;
|
||||
while (usNRegs > 0) {
|
||||
*pucRegBuffer++ = (rt_uint8_t)(pusRegInputBuf[iRegIndex] >> 8);
|
||||
*pucRegBuffer++ = (rt_uint8_t)(pusRegInputBuf[iRegIndex] >> BITS_UCHAR);
|
||||
*pucRegBuffer++ = (rt_uint8_t)(pusRegInputBuf[iRegIndex] & 0xFF);
|
||||
iRegIndex++;
|
||||
usNRegs--;
|
||||
@@ -215,17 +205,7 @@ eMBErrorCode eMBRegInputCB (rt_uint8_t *pucRegBuffer, rt_uint16_t usAddress, rt_
|
||||
return eStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modbus slave holding register callback function.
|
||||
*
|
||||
* @param pucRegBuffer holding register buffer
|
||||
* @param usAddress holding register address
|
||||
* @param usNRegs holding register number
|
||||
* @param eMode read or write
|
||||
*
|
||||
* @return result
|
||||
*/
|
||||
eMBErrorCode eMBRegHoldingCB (rt_uint8_t *req, rt_uint8_t *pucRegBuffer, rt_uint16_t usAddress,
|
||||
eMBErrorCode mb_reg_holding_cb (rt_uint8_t *req, rt_uint8_t *pucRegBuffer, rt_uint16_t usAddress,
|
||||
rt_uint16_t usNRegs, eMBRegisterMode eMode)
|
||||
{
|
||||
eMBErrorCode eStatus = MB_ENOERR;
|
||||
@@ -242,7 +222,7 @@ eMBErrorCode eMBRegHoldingCB (rt_uint8_t *req, rt_uint8_t *pucRegBuffer, rt_uint
|
||||
/* read current register values from the protocol stack. */
|
||||
case MB_REG_READ:
|
||||
while (usNRegs > 0) {
|
||||
*pucRegBuffer++ = (rt_uint8_t)(pusRegHoldingBuf[iRegIndex] >> 8);
|
||||
*pucRegBuffer++ = (rt_uint8_t)(pusRegHoldingBuf[iRegIndex] >> BITS_UCHAR);
|
||||
*pucRegBuffer++ = (rt_uint8_t)(pusRegHoldingBuf[iRegIndex] & 0xFF);
|
||||
iRegIndex++;
|
||||
usNRegs--;
|
||||
@@ -252,7 +232,7 @@ eMBErrorCode eMBRegHoldingCB (rt_uint8_t *req, rt_uint8_t *pucRegBuffer, rt_uint
|
||||
/* write current register values with new values from the protocol stack. */
|
||||
case MB_REG_WRITE:
|
||||
while (usNRegs > 0) {
|
||||
pusRegHoldingBuf[iRegIndex] = *req++ << 8;
|
||||
pusRegHoldingBuf[iRegIndex] = *req++ << BITS_UCHAR;
|
||||
pusRegHoldingBuf[iRegIndex] |= *req++;
|
||||
iRegIndex++;
|
||||
usNRegs--;
|
||||
@@ -266,17 +246,7 @@ eMBErrorCode eMBRegHoldingCB (rt_uint8_t *req, rt_uint8_t *pucRegBuffer, rt_uint
|
||||
return eStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modbus slave coils callback function.
|
||||
*
|
||||
* @param pucRegBuffer coils buffer
|
||||
* @param usAddress coils address
|
||||
* @param usNCoils coils number
|
||||
* @param eMode read or write
|
||||
*
|
||||
* @return result
|
||||
*/
|
||||
eMBErrorCode eMBRegCoilsCB (rt_uint8_t *req, rt_uint8_t *pucRegBuffer, rt_uint16_t usAddress,
|
||||
eMBErrorCode mb_reg_coils_cb (rt_uint8_t *req, rt_uint8_t *pucRegBuffer, rt_uint16_t usAddress,
|
||||
rt_uint16_t usNCoils, eMBRegisterMode eMode)
|
||||
{
|
||||
eMBErrorCode eStatus = MB_ENOERR;
|
||||
@@ -286,37 +256,37 @@ eMBErrorCode eMBRegCoilsCB (rt_uint8_t *req, rt_uint8_t *pucRegBuffer, rt_uint16
|
||||
rt_uint16_t COIL_NCOILS = S_COIL_NCOILS;
|
||||
rt_uint16_t usCoilStart = usSCoilStart;
|
||||
|
||||
iNReg = (usNCoils+7)/8;
|
||||
iNReg = (usNCoils+BITS_UCHAR-1)/BITS_UCHAR;
|
||||
|
||||
if ((usAddress >= COIL_START) && (usAddress + usNCoils <= COIL_START + COIL_NCOILS)) {
|
||||
iRegIndex = (rt_uint16_t)(usAddress - usCoilStart) / 8;
|
||||
iRegBitIndex = (rt_uint16_t)(usAddress - usCoilStart) % 8;
|
||||
iRegIndex = (rt_uint16_t)(usAddress - usCoilStart) / BITS_UCHAR;
|
||||
iRegBitIndex = (rt_uint16_t)(usAddress - usCoilStart) % BITS_UCHAR;
|
||||
switch (eMode) {
|
||||
/* read current coil values from the protocol stack. */
|
||||
case MB_REG_READ:
|
||||
while (iNReg > 0) {
|
||||
*pucRegBuffer++ = xMBUtilGetBits(&pucCoilBuf[iRegIndex++], iRegBitIndex, 8);
|
||||
*pucRegBuffer++ = mb_get_bits(&pucCoilBuf[iRegIndex++], iRegBitIndex, BITS_UCHAR);
|
||||
iNReg--;
|
||||
}
|
||||
pucRegBuffer--;
|
||||
/* last coils */
|
||||
usNCoils = usNCoils % 8;
|
||||
usNCoils = usNCoils % BITS_UCHAR;
|
||||
/* filling zero to high bit */
|
||||
*pucRegBuffer = *pucRegBuffer << (8 - usNCoils);
|
||||
*pucRegBuffer = *pucRegBuffer >> (8 - usNCoils);
|
||||
*pucRegBuffer = *pucRegBuffer << (BITS_UCHAR - usNCoils);
|
||||
*pucRegBuffer = *pucRegBuffer >> (BITS_UCHAR - usNCoils);
|
||||
break;
|
||||
|
||||
/* write current coil values with new values from the protocol stack. */
|
||||
case MB_REG_WRITE:
|
||||
while (iNReg > 1) {
|
||||
xMBUtilSetBits(&pucCoilBuf[iRegIndex++], iRegBitIndex, 8, *req++);
|
||||
mb_set_bits(&pucCoilBuf[iRegIndex++], iRegBitIndex, BITS_UCHAR, *req++);
|
||||
iNReg--;
|
||||
}
|
||||
/* last coils */
|
||||
usNCoils = usNCoils % 8;
|
||||
/* xMBUtilSetBits has bug when ucNBits is zero */
|
||||
usNCoils = usNCoils % BITS_UCHAR;
|
||||
/* mb_set_bits has bug when ucNBits is zero */
|
||||
if (usNCoils != 0) {
|
||||
xMBUtilSetBits(&pucCoilBuf[iRegIndex++], iRegBitIndex, usNCoils, *req++);
|
||||
mb_set_bits(&pucCoilBuf[iRegIndex++], iRegBitIndex, usNCoils, *req++);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -327,16 +297,7 @@ eMBErrorCode eMBRegCoilsCB (rt_uint8_t *req, rt_uint8_t *pucRegBuffer, rt_uint16
|
||||
return eStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modbus slave discrete callback function.
|
||||
*
|
||||
* @param pucRegBuffer discrete buffer
|
||||
* @param usAddress discrete address
|
||||
* @param usNDiscrete discrete number
|
||||
*
|
||||
* @return result
|
||||
*/
|
||||
eMBErrorCode eMBRegDiscreteCB (rt_uint8_t *pucRegBuffer, rt_uint16_t usAddress, rt_uint16_t usNDiscrete)
|
||||
eMBErrorCode mb_reg_discrete_cb (rt_uint8_t *pucRegBuffer, rt_uint16_t usAddress, rt_uint16_t usNDiscrete)
|
||||
{
|
||||
eMBErrorCode eStatus = MB_ENOERR;
|
||||
rt_uint16_t iRegIndex , iRegBitIndex , iNReg;
|
||||
@@ -344,23 +305,23 @@ eMBErrorCode eMBRegDiscreteCB (rt_uint8_t *pucRegBuffer, rt_uint16_t usAddress,
|
||||
rt_uint16_t DISCRETE_INPUT_START = S_DISCRETE_INPUT_START;
|
||||
rt_uint16_t DISCRETE_INPUT_NDISCRETES = S_DISCRETE_INPUT_NDISCRETES;
|
||||
rt_uint16_t usDiscreteInputStart = usSDiscInStart;
|
||||
iNReg = usNDiscrete / 8 + 1;
|
||||
iNReg = (usNDiscrete+BITS_UCHAR-1) / BITS_UCHAR;
|
||||
|
||||
if ((usAddress >= DISCRETE_INPUT_START)
|
||||
&& ((usAddress + usNDiscrete) <= (DISCRETE_INPUT_START + DISCRETE_INPUT_NDISCRETES))) {
|
||||
iRegIndex = (rt_uint16_t) (usAddress - usDiscreteInputStart) / 8;
|
||||
iRegBitIndex = (rt_uint16_t) (usAddress - usDiscreteInputStart) % 8;
|
||||
iRegIndex = (rt_uint16_t) (usAddress - usDiscreteInputStart) / BITS_UCHAR;
|
||||
iRegBitIndex = (rt_uint16_t) (usAddress - usDiscreteInputStart) % BITS_UCHAR;
|
||||
|
||||
while (iNReg > 0) {
|
||||
*pucRegBuffer++ = xMBUtilGetBits(&pucDiscreteInputBuf[iRegIndex++], iRegBitIndex, 8);
|
||||
*pucRegBuffer++ = mb_get_bits(&pucDiscreteInputBuf[iRegIndex++], iRegBitIndex, BITS_UCHAR);
|
||||
iNReg--;
|
||||
}
|
||||
pucRegBuffer--;
|
||||
/* last discrete */
|
||||
usNDiscrete = usNDiscrete % 8;
|
||||
usNDiscrete = usNDiscrete % BITS_UCHAR;
|
||||
/* filling zero to high bit */
|
||||
*pucRegBuffer = *pucRegBuffer << (8 - usNDiscrete);
|
||||
*pucRegBuffer = *pucRegBuffer >> (8 - usNDiscrete);
|
||||
*pucRegBuffer = *pucRegBuffer << (BITS_UCHAR - usNDiscrete);
|
||||
*pucRegBuffer = *pucRegBuffer >> (BITS_UCHAR - usNDiscrete);
|
||||
} else {
|
||||
eStatus = MB_ENOREG;
|
||||
}
|
||||
@@ -387,13 +348,13 @@ eMBException funcReadCoils (rt_uint8_t *reqFrame, rt_uint16_t reqLen,
|
||||
return MB_EX_ILLEGAL_DATA_VALUE;
|
||||
}
|
||||
|
||||
ucNBytes = (cntCoils+7)/8;
|
||||
ucNBytes = (cntCoils+BITS_UCHAR-1)/BITS_UCHAR;
|
||||
|
||||
resFrame[1] = MB_READ_COILS;
|
||||
resFrame[2] = ucNBytes;
|
||||
eRegStatus = eMBRegCoilsCB(RT_NULL, &resFrame[3], regAddress, cntCoils, MB_REG_READ);
|
||||
eRegStatus = mb_reg_coils_cb(RT_NULL, &resFrame[3], regAddress, cntCoils, MB_REG_READ);
|
||||
if (eRegStatus != MB_ENOERR) {
|
||||
eStatus = prveMBError2Exception(eRegStatus);
|
||||
eStatus = mb_error(eRegStatus);
|
||||
} else {
|
||||
*resLen = 3+ucNBytes;
|
||||
}
|
||||
@@ -420,13 +381,13 @@ eMBException funcReadDiscreteInputs (rt_uint8_t *reqFrame, rt_uint16_t reqLen,
|
||||
return MB_EX_ILLEGAL_DATA_VALUE;
|
||||
}
|
||||
|
||||
ucNBytes = (cntDisCrete+7)/8;
|
||||
ucNBytes = (cntDisCrete+BITS_UCHAR-1)/BITS_UCHAR;
|
||||
|
||||
resFrame[1] = MB_READ_DISCRETE_INPUTS;
|
||||
resFrame[2] = ucNBytes;
|
||||
eRegStatus = eMBRegDiscreteCB(&resFrame[3], regAddress, cntDisCrete);
|
||||
eRegStatus = mb_reg_discrete_cb(&resFrame[3], regAddress, cntDisCrete);
|
||||
if (eRegStatus != MB_ENOERR) {
|
||||
eStatus = prveMBError2Exception(eRegStatus);
|
||||
eStatus = mb_error(eRegStatus);
|
||||
} else {
|
||||
*resLen = 3+ucNBytes;
|
||||
}
|
||||
@@ -456,9 +417,9 @@ eMBException funcReadHoldingRegister (rt_uint8_t *reqFrame, rt_uint16_t reqLen,
|
||||
resFrame[1] = MB_READ_HOLDING_REGISTER;
|
||||
resFrame[2] = cntReg * 2;
|
||||
|
||||
eRegStatus = eMBRegHoldingCB(RT_NULL, &resFrame[3], regAddress, cntReg, MB_REG_READ);
|
||||
eRegStatus = mb_reg_holding_cb(RT_NULL, &resFrame[3], regAddress, cntReg, MB_REG_READ);
|
||||
if (eRegStatus != MB_ENOERR) {
|
||||
eStatus = prveMBError2Exception(eRegStatus);
|
||||
eStatus = mb_error(eRegStatus);
|
||||
} else {
|
||||
*resLen = 3+cntReg * 2;
|
||||
}
|
||||
@@ -488,9 +449,9 @@ eMBException funcReadInputRegister (rt_uint8_t *reqFrame, rt_uint16_t reqLen,
|
||||
resFrame[1] = MB_READ_INPUT_REGISTER;
|
||||
resFrame[2] = cntReg * 2;
|
||||
|
||||
eRegStatus = eMBRegDiscreteCB(&resFrame[3], regAddress, cntReg);
|
||||
eRegStatus = mb_reg_discrete_cb(&resFrame[3], regAddress, cntReg);
|
||||
if (eRegStatus != MB_ENOERR) {
|
||||
eStatus = prveMBError2Exception(eRegStatus);
|
||||
eStatus = mb_error(eRegStatus);
|
||||
} else {
|
||||
*resLen = 3+cntReg*2;
|
||||
}
|
||||
@@ -527,9 +488,9 @@ eMBException funcWriteCoil (rt_uint8_t *reqFrame, rt_uint16_t reqLen,
|
||||
memcpy(resFrame, reqFrame, reqLen);
|
||||
*resLen = reqLen-2;
|
||||
|
||||
eRegStatus = eMBRegCoilsCB(RT_NULL, ucBuf, regAddress, 1, MB_REG_WRITE);
|
||||
eRegStatus = mb_reg_coils_cb(RT_NULL, ucBuf, regAddress, 1, MB_REG_WRITE);
|
||||
if (eRegStatus != MB_ENOERR) {
|
||||
eStatus = prveMBError2Exception(eRegStatus);
|
||||
eStatus = mb_error(eRegStatus);
|
||||
}
|
||||
|
||||
return eStatus;
|
||||
@@ -552,9 +513,9 @@ eMBException funcWriteHoldingRegister (rt_uint8_t *reqFrame, rt_uint16_t reqLen,
|
||||
memcpy(resFrame, reqFrame, reqLen);
|
||||
*resLen = reqLen-2;
|
||||
|
||||
eRegStatus = eMBRegHoldingCB(&reqFrame[4], &resFrame[3], regAddress, 1, MB_REG_WRITE);
|
||||
eRegStatus = mb_reg_holding_cb(&reqFrame[4], &resFrame[3], regAddress, 1, MB_REG_WRITE);
|
||||
if (eRegStatus != MB_ENOERR) {
|
||||
eStatus = prveMBError2Exception(eRegStatus);
|
||||
eStatus = mb_error(eRegStatus);
|
||||
}
|
||||
|
||||
return eStatus;
|
||||
@@ -577,7 +538,7 @@ eMBException funcWriteMultipleCoils (rt_uint8_t *reqFrame, rt_uint16_t reqLen,
|
||||
regAddress = u8v_to_u16(&reqFrame[2]);
|
||||
cntCoils = u8v_to_u16(&reqFrame[4]);
|
||||
ucByteCount = reqFrame[6];
|
||||
ucByteCountVerify = (cntCoils+7)/8;
|
||||
ucByteCountVerify = (cntCoils+BITS_UCHAR-1)/BITS_UCHAR;
|
||||
|
||||
if ((0 == cntCoils)
|
||||
||(cntCoils > MB_PDU_FUNC_WRITE_MUL_COILCNT_MAX)
|
||||
@@ -588,9 +549,9 @@ eMBException funcWriteMultipleCoils (rt_uint8_t *reqFrame, rt_uint16_t reqLen,
|
||||
memcpy(resFrame, reqFrame, reqLen);
|
||||
*resLen = 6;
|
||||
|
||||
eRegStatus = eMBRegCoilsCB(reqFrame, &resFrame[3], regAddress, cntCoils, MB_REG_WRITE);
|
||||
eRegStatus = mb_reg_coils_cb(reqFrame, &resFrame[3], regAddress, cntCoils, MB_REG_WRITE);
|
||||
if (eRegStatus != MB_ENOERR) {
|
||||
eStatus = prveMBError2Exception(eRegStatus);
|
||||
eStatus = mb_error(eRegStatus);
|
||||
}
|
||||
|
||||
return eStatus;
|
||||
@@ -622,9 +583,9 @@ eMBException funcWriteMultipleHoldingRegister (rt_uint8_t *reqFrame, rt_uint16_t
|
||||
memcpy(resFrame, reqFrame, reqLen);
|
||||
*resLen = 6;
|
||||
|
||||
eRegStatus = eMBRegHoldingCB(reqFrame, &resFrame[3], regAddress, cntReg, MB_REG_WRITE);
|
||||
eRegStatus = mb_reg_holding_cb(reqFrame, &resFrame[3], regAddress, cntReg, MB_REG_WRITE);
|
||||
if (eRegStatus != MB_ENOERR) {
|
||||
eStatus = prveMBError2Exception(eRegStatus);
|
||||
eStatus = mb_error(eRegStatus);
|
||||
}
|
||||
|
||||
return eStatus;
|
||||
@@ -654,8 +615,8 @@ static int chrg_comm_parse_msg (struct chrg_comm_t *pCOMM)
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (0 != usMBCRC16(pCOMM->rx_buf, pCOMM->rx_len)) {
|
||||
rt_kprintf("crc %04X ", usMBCRC16(pCOMM->rx_buf, pCOMM->rx_len-2));
|
||||
if (0 != mb_crc16(pCOMM->rx_buf, pCOMM->rx_len)) {
|
||||
rt_kprintf("crc %04X ", mb_crc16(pCOMM->rx_buf, pCOMM->rx_len-2));
|
||||
return -3;
|
||||
}
|
||||
|
||||
@@ -692,7 +653,7 @@ static int chrg_comm_parse_msg (struct chrg_comm_t *pCOMM)
|
||||
pCOMM->tx_len = 3;
|
||||
}
|
||||
|
||||
crc = usMBCRC16(pCOMM->tx_buf, pCOMM->tx_len);
|
||||
crc = mb_crc16(pCOMM->tx_buf, pCOMM->tx_len);
|
||||
u16_to_u8v(crc, &pCOMM->tx_buf[pCOMM->tx_len]);
|
||||
pCOMM->tx_len += 2;
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
|
||||
#include "chrg_tty.h"
|
||||
|
||||
#define THR_NAME_POLL "thr.poll"
|
||||
#define THR_NAME_SEND "thr.send"
|
||||
|
||||
#define MODBUS_ADDRESS_DEFAULT 0x01
|
||||
|
||||
#define BITS_UCHAR 8U
|
||||
|
||||
#define S_DISCRETE_INPUT_START 0
|
||||
#define S_DISCRETE_INPUT_NDISCRETES 16
|
||||
#define S_COIL_START 0
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <rtthread.h>
|
||||
|
||||
#include "chrg_north.h"
|
||||
|
||||
#include "chrg_roll.h"
|
||||
#include "chrg_utils.h"
|
||||
|
||||
#define LOG_TAG "chrg.nor"
|
||||
@@ -59,7 +59,7 @@ static void chrg_north_thread_entry (void *data)
|
||||
//rt_kprintf("%s\r\n", (char *)pNOR->rx_buf);
|
||||
//chrg_tty_send(pTTY, pNOR->rx_buf, len);
|
||||
|
||||
|
||||
chrg_roll_evt_send();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ struct chrg_north_t {
|
||||
rt_uint16_t rx_len;
|
||||
rt_uint8_t rx_buf[SIZE_BUF_TTY];
|
||||
|
||||
eIDX_CH idx; // 当前通路
|
||||
struct chrg_switch_t sw[TOTAL_CHS];
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#include "chrg_north.h"
|
||||
#include "chrg_south.h"
|
||||
#include "chrg_sink.h"
|
||||
#include "chrg_source.h"
|
||||
#include "chrg_roll.h"
|
||||
|
||||
#define LOG_TAG "chrg.roll"
|
||||
#include <rtdbg.h>
|
||||
|
||||
struct chrg_roll_t chrgroll = {
|
||||
.name = THR_NAME_ROLL,
|
||||
.tid = RT_NULL,
|
||||
.idx = 0,
|
||||
.en_nor = {1, 1, 1, 1},
|
||||
.en_sou = {1, 1, 1, 1, 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
rt_uint8_t chrg_roll_get_idx (void)
|
||||
{
|
||||
rt_uint8_t idx = 0;
|
||||
struct chrg_roll_t *pROLL = &chrgroll;
|
||||
|
||||
rt_mutex_take(pROLL->mutex, RT_WAITING_FOREVER);
|
||||
idx = pROLL->idx;
|
||||
rt_mutex_release(pROLL->mutex);
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
void chrg_roll_evt_send (void)
|
||||
{
|
||||
struct chrg_roll_t *pROLL = &chrgroll;
|
||||
if (RT_NULL != pROLL->evt) {
|
||||
rt_event_send(pROLL->evt, ROLL_EVT_RECVED);
|
||||
}
|
||||
}
|
||||
|
||||
static void chrg_roll_thread_entry (void *data)
|
||||
{
|
||||
struct chrg_roll_t *pROLL = (struct chrg_roll_t *)data;
|
||||
|
||||
if (RT_NULL == pROLL) {
|
||||
return ;
|
||||
}
|
||||
|
||||
rt_uint8_t idx = 0;
|
||||
rt_err_t ret = RT_EOK;
|
||||
rt_uint32_t recved = 0;
|
||||
struct chrg_north_t *pNOR = &chrgnorth;
|
||||
struct chrg_south_t *pSOU = &chrgsouth;
|
||||
struct chrg_switch_t *pSW = RT_NULL;
|
||||
|
||||
while (1) {
|
||||
rt_mutex_take(pROLL->mutex, RT_WAITING_FOREVER);
|
||||
pROLL->idx = idx%(TOTAL_CHS+TOTAL_SOUTH_CHS);
|
||||
rt_mutex_release(pROLL->mutex);
|
||||
|
||||
if (pROLL->idx < TOTAL_CHS) {
|
||||
if (0 == pROLL->en_nor[pROLL->idx]) {
|
||||
idx++;
|
||||
rt_thread_mdelay(1);
|
||||
continue;
|
||||
} else {
|
||||
pNOR->idx = (eIDX_CH)pROLL->idx;
|
||||
chrg_switch_north(pNOR->idx);
|
||||
|
||||
pSW = &pNOR->sw[pNOR->idx];
|
||||
if (ID_SOURCE == pSW->id) {
|
||||
source_get_vc(pSW->source.voltage, pSW->source.current);
|
||||
} else if (ID_SINK == pSW->id) {
|
||||
sink_get_vc(pSW->sink.loadv, pSW->sink.loadc);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (0 == pROLL->en_sou[pROLL->idx]) {
|
||||
idx++;
|
||||
rt_thread_mdelay(1);
|
||||
continue;
|
||||
} else {
|
||||
pSOU->idx = (eIDX_SOUTH_CH)(pROLL->idx - TOTAL_CHS);
|
||||
chrg_switch_south(pSOU->idx);
|
||||
|
||||
pSW = &pSOU->sw[pSOU->idx];
|
||||
if (ID_SOURCE == pSW->id) {
|
||||
source_get_vc(pSW->source.voltage, pSW->source.current);
|
||||
} else if (ID_SINK == pSW->id) {
|
||||
sink_get_vc(pSW->sink.loadv, pSW->sink.loadc);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
idx++;
|
||||
|
||||
ret = rt_event_recv(pROLL->evt, ROLL_EVT_RECVED,
|
||||
(RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR), 100, &recved); // wait 100ms
|
||||
if (RT_EOK != ret) {
|
||||
//LOG_E("evt recv failed. [%d]", ret);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (recved & ROLL_EVT_RECVED) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int chrg_roll_init (void)
|
||||
{
|
||||
struct chrg_roll_t *pROLL = &chrgroll;
|
||||
|
||||
pROLL->mutex = rt_mutex_create(pROLL->name, RT_IPC_FLAG_FIFO);
|
||||
if (RT_NULL == pROLL->mutex) {
|
||||
LOG_E("create mutex '%s' failed.", pROLL->name);
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
pROLL->evt = rt_event_create(pROLL->name, RT_IPC_FLAG_FIFO);
|
||||
if (RT_NULL == pROLL->evt) {
|
||||
LOG_E("create ev '%s' failed.", pROLL->name);
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
pROLL->tid = rt_thread_create(pROLL->name, chrg_roll_thread_entry, pROLL, 2048,
|
||||
RT_MAIN_THREAD_PRIORITY, 20);
|
||||
if (RT_NULL != pROLL->tid) {
|
||||
rt_thread_startup(pROLL->tid);
|
||||
} else {
|
||||
LOG_E("create thread '%s' failed.", pROLL->name);
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
|
||||
INIT_APP_EXPORT(chrg_roll_init);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef __CHRG_ROLL_H__
|
||||
#define __CHRG_ROLL_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#include "chrg_switch.h"
|
||||
|
||||
#define THR_NAME_ROLL "thr.roll"
|
||||
|
||||
#define ROLL_EVT_RECVED (1<<0) // 收到数据
|
||||
|
||||
|
||||
struct chrg_roll_t {
|
||||
const char *name;
|
||||
struct rt_thread *tid;
|
||||
|
||||
rt_mutex_t mutex;
|
||||
rt_event_t evt;
|
||||
|
||||
rt_uint8_t idx; // 轮巡索引 0-3:nor 4-11:sou
|
||||
|
||||
rt_uint8_t en_nor[TOTAL_CHS]; // 北向通路使能
|
||||
rt_uint8_t en_sou[TOTAL_SOUTH_CHS]; // 南向通路使能
|
||||
};
|
||||
|
||||
extern struct chrg_roll_t chrgroll;
|
||||
|
||||
extern rt_uint8_t chrg_roll_get_idx (void);
|
||||
|
||||
extern void chrg_roll_evt_send (void);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <rtthread.h>
|
||||
|
||||
#include "chrg_south.h"
|
||||
|
||||
#include "chrg_roll.h"
|
||||
#include "chrg_utils.h"
|
||||
|
||||
#define LOG_TAG "chrg.sou"
|
||||
@@ -53,9 +53,13 @@ static void chrg_south_thread_entry (void *data)
|
||||
continue;
|
||||
}
|
||||
|
||||
// pick data & update sw
|
||||
|
||||
//rt_kprintf("%s\r\n", (char *)pSOU->rx_buf);
|
||||
//chrg_tty_send(pTTY, pSOU->rx_buf, len);
|
||||
|
||||
chrg_roll_evt_send();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ struct chrg_south_t {
|
||||
rt_uint16_t rx_len;
|
||||
rt_uint8_t rx_buf[SIZE_BUF_TTY];
|
||||
|
||||
eIDX_SOUTH_CH idx; // 当前通路
|
||||
struct chrg_switch_t sw[TOTAL_SOUTH_CHS];
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
|
||||
#include "chrg_sink.h"
|
||||
|
||||
int sink_get_vc (rt_uint16_t vol, rt_uint16_t cur)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ struct chrg_sink_t {
|
||||
rt_uint8_t cc_lvl; // 设置CC线电平等级(0-10,默认7)
|
||||
};
|
||||
|
||||
|
||||
extern int sink_get_vc (rt_uint16_t vol, rt_uint16_t cur);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ struct chrg_src_t {
|
||||
|
||||
};
|
||||
|
||||
|
||||
extern int source_get_vc (rt_uint16_t vol, rt_uint16_t cur);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -53,7 +53,7 @@ static const rt_uint8_t aucCRCLo[] = {
|
||||
0x41, 0x81, 0x80, 0x40
|
||||
};
|
||||
|
||||
rt_uint16_t usMBCRC16 (rt_uint8_t *pucFrame, rt_uint16_t usLen)
|
||||
rt_uint16_t mb_crc16 (rt_uint8_t *pucFrame, rt_uint16_t usLen)
|
||||
{
|
||||
rt_uint8_t ucCRCHi = 0xFF;
|
||||
rt_uint8_t ucCRCLo = 0xFF;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
extern rt_uint16_t usMBCRC16 (rt_uint8_t * pucFrame, rt_uint16_t usLen);
|
||||
extern rt_uint16_t mb_crc16 (rt_uint8_t * pucFrame, rt_uint16_t usLen);
|
||||
|
||||
extern rt_uint8_t calc_crc8 (rt_uint8_t *data, rt_uint8_t length);
|
||||
|
||||
|
||||
+169
-164
@@ -53,7 +53,7 @@
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>1</CreateHexFile>
|
||||
<DebugInformation>0</DebugInformation>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>0</BrowseInformation>
|
||||
<ListingPath>.\build\keil\List\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
@@ -313,7 +313,7 @@
|
||||
</ArmAdsMisc>
|
||||
<Cads>
|
||||
<interw>1</interw>
|
||||
<Optim>1</Optim>
|
||||
<Optim>0</Optim>
|
||||
<oTime>0</oTime>
|
||||
<SplitLS>0</SplitLS>
|
||||
<OneElfS>1</OneElfS>
|
||||
@@ -328,8 +328,8 @@
|
||||
<uC99>1</uC99>
|
||||
<uGnu>0</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>3</v6Lang>
|
||||
<v6LangP>3</v6LangP>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
@@ -337,9 +337,9 @@
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define>__STDC_LIMIT_MACROS, RT_USING_LIBC, RT_USING_ARMLIBC, USE_HAL_DRIVER, STM32F405xx, __RTTHREAD__, __CLK_TCK=RT_TICK_PER_SECOND</Define>
|
||||
<Define>STM32F405xx, RT_USING_ARMLIBC, __CLK_TCK=RT_TICK_PER_SECOND, USE_HAL_DRIVER, __STDC_LIMIT_MACROS, __RTTHREAD__, RT_USING_LIBC</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\..\rt-thread\components\drivers\phy;..\..\rt-thread\components\drivers\include;applications\thread;..\..\rt-thread\components\libc\compilers\common\extension\fcntl\octal;..\..\rt-thread\libcpu\arm\common;applications;..\..\rt-thread\components\libc\compilers\common\extension;..\..\rt-thread\components\drivers\include;.;applications\utils;..\..\libs\stm32f4\STM32F4_CMSIS\Include;..\..\rt-thread\include;board\ports;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers\config;..\..\libs\stm32f4\STM32F4_HAL\Inc;..\..\rt-thread\components\libc\posix\ipc;..\..\rt-thread\components\libc\compilers\common\include;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers;..\..\rt-thread\components\libc\posix\io\epoll;board\CubeMX_Config\Inc;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers\drv_flash;..\..\rt-thread\components\finsh;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\drivers\smp_call;..\..\rt-thread\libcpu\arm\cortex-m4;..\..\rt-thread\components\libc\posix\io\poll;..\..\rt-thread\components\fal\inc;..\..\libs\cmsis-core\Include;..\..\rt-thread\components\drivers\include;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\libc\posix\io\eventfd;applications\bsp;..\..\rt-thread\components\drivers\include;..\..\libs\stm32f4\STM32F4_HAL\Inc\Legacy;board;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\drivers\include</IncludePath>
|
||||
<IncludePath>..\..\rt-thread\components\libc\posix\io\eventfd;board\ports;..\..\libs\cmsis-core\Include;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers;..\..\rt-thread\components\finsh;..\..\rt-thread\components\libc\compilers\common\extension;..\..\rt-thread\components\libc\compilers\common\include;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\drivers\include;..\..\libs\stm32f4\STM32F4_HAL\Inc\Legacy;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers\config;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers;..\..\rt-thread\libcpu\arm\common;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers\drv_flash;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\libc\posix\ipc;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\drivers\phy;applications\utils;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\drivers\include;applications\thread;applications\bsp;applications;..\..\rt-thread\include;board;..\..\rt-thread\libcpu\arm\cortex-m4;..\..\rt-thread\components\libc\posix\io\epoll;..\..\rt-thread\components\drivers\include;.;..\..\libs\stm32f4\STM32F4_CMSIS\Include;..\..\rt-thread\components\drivers\smp_call;..\..\rt-thread\components\libc\compilers\common\extension\fcntl\octal;..\..\rt-thread\components\drivers\include;..\..\libs\stm32f4\STM32F4_HAL\Inc;..\..\rt-thread\components\libc\posix\io\poll;..\..\rt-thread\components\fal\inc;board\CubeMX_Config\Inc;..\..\rt-thread\components\drivers\include</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
@@ -393,65 +393,75 @@
|
||||
<Group>
|
||||
<GroupName>Applications/bsp</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>chrg_switch.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\bsp\chrg_switch.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_tty.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\bsp\chrg_tty.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_pin.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\bsp\chrg_pin.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_can.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\bsp\chrg_can.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_fal.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\bsp\chrg_fal.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_intr.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\bsp\chrg_intr.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_tmr.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\bsp\chrg_tmr.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_wdt.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\bsp\chrg_wdt.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_clk.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\bsp\chrg_clk.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_switch.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\bsp\chrg_switch.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_i2c.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\bsp\chrg_i2c.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_fal.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\bsp\chrg_fal.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_tmr.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\bsp\chrg_tmr.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_can.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\bsp\chrg_can.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_intr.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\bsp\chrg_intr.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_tty.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\bsp\chrg_tty.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_wdt.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\bsp\chrg_wdt.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Applications/thread</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>chrg_lcd.c</FileName>
|
||||
<FileName>chrg_north.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\thread\chrg_lcd.c</FilePath>
|
||||
<FilePath>applications\thread\chrg_north.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_roll.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\thread\chrg_roll.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_south.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\thread\chrg_south.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_comm.c</FileName>
|
||||
@@ -459,14 +469,9 @@
|
||||
<FilePath>applications\thread\chrg_comm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_north.c</FileName>
|
||||
<FileName>chrg_lcd.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\thread\chrg_north.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_south.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\thread\chrg_south.c</FilePath>
|
||||
<FilePath>applications\thread\chrg_lcd.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
@@ -479,25 +484,25 @@
|
||||
<FilePath>applications\utils\chrg_source.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_sink.c</FileName>
|
||||
<FileName>chrg_pcf8574.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\utils\chrg_sink.c</FilePath>
|
||||
<FilePath>applications\utils\chrg_pcf8574.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_utils.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\utils\chrg_utils.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_pcf8574.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\utils\chrg_pcf8574.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_pkg.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\utils\chrg_pkg.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>chrg_sink.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\utils\chrg_sink.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
@@ -1621,16 +1626,16 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\rt-thread\components\fal\src\fal_partition.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fal_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\rt-thread\components\fal\src\fal_flash.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fal.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\rt-thread\components\fal\src\fal.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fal_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\rt-thread\components\fal\src\fal_flash.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fal_rtt.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -1641,6 +1646,11 @@
|
||||
<Group>
|
||||
<GroupName>Finsh</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>cmd.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\rt-thread\components\finsh\cmd.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>msh.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -1656,11 +1666,6 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\rt-thread\components\finsh\shell.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>cmd.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\rt-thread\components\finsh\cmd.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
@@ -2511,11 +2516,6 @@
|
||||
<Group>
|
||||
<GroupName>klibc</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>kstring.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\rt-thread\src\klibc\kstring.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>kstdio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -2526,16 +2526,21 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\rt-thread\src\klibc\rt_vsscanf.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>kerrno.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\rt-thread\src\klibc\kerrno.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>kstring.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\rt-thread\src\klibc\kstring.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rt_vsnprintf_tiny.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\rt-thread\src\klibc\rt_vsnprintf_tiny.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
@@ -2571,65 +2576,120 @@
|
||||
<Group>
|
||||
<GroupName>STM32F4-CMSIS</GroupName>
|
||||
<Files>
|
||||
<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>
|
||||
<File>
|
||||
<FileName>startup_stm32f405xx.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_CMSIS\Source\Templates\arm\startup_stm32f405xx.s</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>STM32F4-HAL</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_i2c.c</FileName>
|
||||
<FileName>stm32f4xx_hal_gpio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_i2c.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_uart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_uart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_i2c_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_i2c_ex.c</FilePath>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_gpio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_lptim.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_lptim.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_flash_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_flash_ex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_can.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_can.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_rcc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rcc.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_dma_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_dma_ex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_tim.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_tim.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_flash.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_cortex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cortex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_iwdg.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_iwdg.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_uart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_uart.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_rcc_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rcc_ex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_flash_ex.c</FileName>
|
||||
<FileName>stm32f4xx_hal_i2c_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_flash_ex.c</FilePath>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_i2c_ex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_pwr_ex.c</FileName>
|
||||
<FileName>stm32f4xx_hal_usart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pwr_ex.c</FilePath>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_usart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_crc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_crc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_tim_ex.c</FileName>
|
||||
@@ -2642,14 +2702,9 @@
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_flash_ramfunc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_rng.c</FileName>
|
||||
<FileName>stm32f4xx_hal_i2c.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rng.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_cortex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cortex.c</FilePath>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_i2c.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal.c</FileName>
|
||||
@@ -2657,39 +2712,9 @@
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_can.c</FileName>
|
||||
<FileName>stm32f4xx_hal_pwr_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_can.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_iwdg.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_iwdg.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_pwr.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pwr.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_crc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_crc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_tim.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_tim.c</FilePath>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pwr_ex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_wwdg.c</FileName>
|
||||
@@ -2697,29 +2722,9 @@
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_wwdg.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_hal_gpio.c</FileName>
|
||||
<FileName>stm32f4xx_hal_cec.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_gpio.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_cryp_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cryp_ex.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_cryp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cryp.c</FilePath>
|
||||
<FilePath>..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cec.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
|
||||
Reference in New Issue
Block a user