Commit e260a633 authored by 郑萍's avatar 郑萍

Merge branch 'yedea_RS485' of...

Merge branch 'yedea_RS485' of http://tyw-server.synology.me:12345/chenjiale/jiancetai into yadea_C011_jiancetai_z
parents abe373bc 484f5b83
#include "common_include.h"
void R485_Send_0x40(void)
{
memset(R485_ID40h.Msg, 0, 64);
R485_Send(0x40, R485_ID40h.Msg, sizeof(R485_ID40h.Msg));
}
void R485_Send_0x41(void)
{
memset(R485_ID41h.Msg, 0, 64);
R485_ID41h.Sig.AlarmStatus = 1;
R485_ID41h.Sig.ALMCommunicationStatus = 1;
R485_Send(0x41, R485_ID41h.Msg, sizeof(R485_ID41h.Msg));
}
void R485_Send_0x42(void)
{
memset(R485_ID42h.Msg, 0, 64);
R485_Send(0x42, R485_ID42h.Msg, sizeof(R485_ID42h.Msg));
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
#ifndef API_485TR_H_
#define API_485TR_H_
#include "common_include.h"
#define RS485_RX_BUF_LEN 1024 * 4
#define RS485_RX_DATA_LEN 64
#define RS485_RECEIVE_ID_0X48 0X48
#define RS485_RECEIVE_ID_0X49 0X49
#define RS485_RECEIVE_ID_0X4A 0X4A
#define RS485_RECEIVE_ID_0X45 0X45
typedef enum
{
RS485_Tx_ID48_Idx = 0,
RS485_Tx_ID49_Idx,
RS485_Tx_ID4A_Idx,
RS485_Tx_ID_Idx_Max,
}RS485_Receive_ID_Idx_en_t;
typedef enum
{
RS485_Rx_ID40_Idx = 0,
RS485_Rx_ID41_Idx,
RS485_Rx_ID42_Idx,
RS485_Rx_ID_Idx_Max,
}RS485_Transmit_ID_Idx_en_t;
typedef struct
{
uint8_t RS485Data[RS485_RX_BUF_LEN - 1];
uint8_t length;
} RS485DataPacket;
typedef enum
{
R485_Normal = 0,
R485_Lost = 0x55,
}_en_485_Rx_Status_t;
typedef struct
{
uint8_t u8RecVal[RS485_RX_DATA_LEN];
uint8_t u8Received;
uint8_t u8Status;
uint16_t u16LostTime;
uint8_t u8ReceivedFlag;
} RS485ValidDataPacket_st_t;
extern uint32_t R485_Send(const uint16_t cmdID, const uint8_t* pData, uint8_t len);
#endif /* API_ADC_H_ */
......@@ -19,22 +19,22 @@ void ADCInit(void)
{
InitADC();
stc_port_pin_config_t stc_port_pin_configadc = {
.enOutputFunction = PortOutputResourceGPIO,
.enPullResistor = PortPullResistorNone,
.bInputEnable = TRUE,
.enGpioDirection = PortGpioInput};
// stc_port_pin_config_t stc_port_pin_configadc = {
// .enOutputFunction = PortOutputResourceGPIO,
// .enPullResistor = PortPullResistorNone,
// .bInputEnable = TRUE,
// .enGpioDirection = PortGpioInput};
//Quiescent Current 静态电流
Port_SetPinConfig(1, 3, &stc_port_pin_configadc );
InitADCch(Quiescent_Current);
// //Quiescent Current ��̬����
// Port_SetPinConfig(1, 3, &stc_port_pin_configadc );
// InitADCch(Quiescent_Current);
//5V基准
Port_SetPinConfig(1, 7, &stc_port_pin_configadc );
InitADCch(KL5V_AD_CH);
// //5V��׼
// Port_SetPinConfig(1, 7, &stc_port_pin_configadc );
// InitADCch(KL5V_AD_CH);
Port_SetPinConfig(1, 4, &stc_port_pin_configadc );
InitADCch(KEY5_AD_CH);
// Port_SetPinConfig(1, 4, &stc_port_pin_configadc );
// InitADCch(KEY5_AD_CH);
}
......@@ -67,16 +67,16 @@ void GetADCVolue(void)
Adc12b_TriggerConversion(&ADC12B0, DMS_UP_AD_CH);
Adc12b_TriggerConversion(&ADC12B0, DMS_DOWN_AD_CH);
*/
Adc12b_TriggerConversion(&ADC12B0, Quiescent_Current); //静态电流
Adc12b_TriggerConversion(&ADC12B0, KL5V_AD_CH); //5V
Adc12b_TriggerConversion(&ADC12B0, KEY5_AD_CH);
// Adc12b_TriggerConversion(&ADC12B0, Quiescent_Current); //��̬����
// Adc12b_TriggerConversion(&ADC12B0, KL5V_AD_CH); //5V
// Adc12b_TriggerConversion(&ADC12B0, KEY5_AD_CH);
}
void App_SwapShort(uint16_t *pData1,uint16_t *pData2);
void App_SortShort(uint16_t *SortData,uint8_t len);
/*-------------------------------------------------------------------------
* Function Name : App_SwapShort
* Description : 交换数据
* Description : ��������
* Input : None
* Output : None
* Return : None
......
......@@ -86,7 +86,7 @@ void Api_GPIO_Init(void)
//AD�ɼ���
Port_SetPinConfig(1, 3, &stc_IN_pin_config); //
Port_SetPinConfig(1, 7, &stc_IN_pin_config); //
Port_SetPinConfig(1, 4, &stc_IN_pin_config); //NEW BUTTON 7 AD �ɼ�
// Port_SetPinConfig(1, 4, &stc_IN_pin_config); //NEW BUTTON 7 AD �ɼ�
Port_SetPinConfig(1, 15, &stc_IN_pin_config); // b+~
Port_SetPinConfig(1, 10, &stc_IN_pin_config); // test
//AD�ɼ���
......@@ -132,7 +132,7 @@ void Api_GPIO_Init(void)
Port_SetPinConfig(1, 24, &stc_OUT_pin_config); //R_MT
//Port_SetPinConfig(2, 14, &stc_OUT_pin_config); //����
Port_SetPinConfig(1, 18, &stc_OUT_pin_config); //������
Port_SetPinConfig(1, 4, &stc_OUT_pin_config);
Port_SetPinConfig(0, 0, &stc_OUT_pin_config); //WBATTER
//IIC����
Port_SetPinConfig(1, 8, &stc_OUT_pin_config); //I2C_SCL_OUT
......@@ -163,7 +163,7 @@ void Api_GPIO_Init(void)
Port_SetPinConfig(1, 5, &stc_OUT_pin_config); //GS0
//��̬������
//Port_SetPortPinLevel(1, 4, PortGpioLow);
Port_SetPortPinLevel(1, 5, PortGpioHigh);
// Port_SetPortPinLevel(1, 5, PortGpioHigh);
Port_SetPinConfig(2, 13, &stc_OUT_pin_config); //backlight down
......
......@@ -15,7 +15,7 @@ extern uint16_t IntervalTimerDelta;
extern volatile uint32_t ClusterValidTimerCnts;
extern uint8_t SetTimeBlinkCount;
extern uint16_t HJ_SWitchDownTime;
extern uint32_t Time_100us;
extern uint32_t Timer10msCnts;
extern void TimeProcessing(void);
extern void TIMER1_1ms_Init(void);
......
......@@ -99,7 +99,7 @@ static void MfsUartFifoUseInit(pstc_uart_type_t pstcUart,
uint16_t u16RxCbFillLevel);
static void MfsUartFifoReset(pstc_uart_type_t pstcUart);
#define PDL_WAIT_LOOP_HOOK() Pdl_WaitLoopHook()
/*****************************************************************************/
/* Local variable definitions ('static') */
/*****************************************************************************/
......@@ -767,6 +767,20 @@ en_result_t Mfs_Uart_Init(pstc_uart_type_t pstcUart,
** take all data (in case of
** Mfs_Uart_Write#bBlocking = FALSE only)
******************************************************************************/
void Pdl_WaitLoopHook( void )
{
// Satisfy compiler regarding "order of volatile accesses" warning in if-statement
uint32_t u32CurrentLowerLimit = HWDG_RUNLLC;
// Clear hardware watchdog if lower limit of window has been exceeded
if (HWDG_CNT > u32CurrentLowerLimit)
{
IRQ_DISABLE_LOCAL();
HWDG_TRG0 = HWDG_TRG0CFG;
HWDG_TRG1 = HWDG_TRG1CFG;
IRQ_RESTORE();
}
}
en_result_t Mfs_Uart_Write(pstc_uart_type_t pstcUart,
uint8_t *pu8Data,
uint16_t u16WriteCnt,
......@@ -849,7 +863,7 @@ en_result_t Mfs_Uart_Write(pstc_uart_type_t pstcUart,
/* Wait until all data has been transfered to the MFS HW FIFO (when blocking) */
while (pstcBuffer->u16FillCount != 0)
{
//PDL_WAIT_LOOP_HOOK();
PDL_WAIT_LOOP_HOOK();
}
}
}
......
......@@ -427,7 +427,8 @@
#include "NM_includes.h"
#include "bsp_Presskey.h"
#include "ScanQrCodeConfig.h"
#include "api_RS485.h"
#include "R485_Communication_Matrix.h"
#include "BenchTpCommon.h"
/*****************************************************************************/
/* Global pre-processor symbols/macros ('#define') */
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment