Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Neyzoter committed May 10, 2019
1 parent c155b48 commit 9a598d5
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 52 deletions.
2 changes: 1 addition & 1 deletion HARDWARE/GPIO/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void GP_IO_Init(void)
GPIO_Init(LED2_PORT, &GPIO_InitStructure); //LED2初始化
GPIO_InitStructure.GPIO_Pin = LED3_PIN;
GPIO_Init(LED3_PORT, &GPIO_InitStructure); //LED3初始化
TEST_LED_OFF(1);WORKING_LED_OFF(0);ID_LED_OFF(1);//关灯
INFO_LED_OFF(1);WORKING_LED_OFF(0);ID_LED_OFF(1);//关灯

/* 蜂鸣器初始化*/
GPIO_InitStructure.GPIO_Pin = BEEP_PIN;
Expand Down
148 changes: 102 additions & 46 deletions HARDWARE/GPIO/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,45 +13,83 @@

//-------------include---------------//
#include "sys.h"
#include "config.h"

/**
* @brief 子板LED端口定义
* @{
*/
#define LED1_PORT GPIOB
#define LED1_PIN GPIO_Pin_6
#define LED2_PORT GPIOB
#define LED2_PIN GPIO_Pin_7
#define LED3_PORT GPIOB
#define LED3_PIN GPIO_Pin_5

#define LED1 PBout(6)
//!LED1关闭
#define LED1_OFF(x) (LED1 = x)
//!LED1取反
#define LED1_CONV() (LED1 = ~LED1)

#define LED2 PBout(7)
//!LED2关闭
#define LED2_OFF(x) (LED2 = x)
//!LED2取反
#define LED2_CONV() (LED2 = ~LED2)

#define LED3 PBout(5)
//!LED3关闭
#define LED3_OFF(x) (LED3 = x)
//!LED3取反
#define LED3_CONV() (LED3 = ~LED3)

//!测试灯
#define TEST_LED_CONV() LED1_CONV()
#define TEST_LED_OFF(x) LED1_OFF(x)
//!工作灯
#define WORKING_LED_CONV() LED2_CONV()
#define WORKING_LED_OFF(x) LED2_OFF(x)
//!nodeId灯
#define ID_LED_CONV() LED3_CONV()
#define ID_LED_OFF(x) LED3_OFF(x)
#ifdef HARDWARE_VERSION_V1
#define LED1_PORT GPIOC
#define LED1_PIN GPIO_Pin_0
#define LED2_PORT GPIOD
#define LED2_PIN GPIO_Pin_2
#define LED3_PORT GPIOB
#define LED3_PIN GPIO_Pin_3

#define LED1 PCout(0)
//!LED1关闭
#define LED1_OFF(x) (LED1 = x)
//!LED1取反
#define LED1_CONV() (LED1 = ~LED1)

#define LED2 PDout(2)
//!LED2关闭
#define LED2_OFF(x) (LED2 = x)
//!LED2取反
#define LED2_CONV() (LED2 = ~LED2)

#define LED3 PBout(3)
//!LED3关闭
#define LED3_OFF(x) (LED3 = x)
//!LED3取反
#define LED3_CONV() (LED3 = ~LED3)

//!测试灯
#define INFO_LED_CONV() LED1_CONV()
#define INFO_LED_OFF(x) LED1_OFF(x)
//!工作灯
#define WORKING_LED_CONV() LED2_CONV()
#define WORKING_LED_OFF(x) LED2_OFF(x)
//!nodeId灯
#define ID_LED_CONV() LED3_CONV()
#define ID_LED_OFF(x) LED3_OFF(x)
#elif defined(HARDWARE_VERSION_V3)
#define LED1_PORT GPIOB
#define LED1_PIN GPIO_Pin_6
#define LED2_PORT GPIOB
#define LED2_PIN GPIO_Pin_7
#define LED3_PORT GPIOB
#define LED3_PIN GPIO_Pin_5

#define LED1 PBout(6)
//!LED1关闭
#define LED1_OFF(x) (LED1 = x)
//!LED1取反
#define LED1_CONV() (LED1 = ~LED1)

#define LED2 PBout(7)
//!LED2关闭
#define LED2_OFF(x) (LED2 = x)
//!LED2取反
#define LED2_CONV() (LED2 = ~LED2)

#define LED3 PBout(5)
//!LED3关闭
#define LED3_OFF(x) (LED3 = x)
//!LED3取反
#define LED3_CONV() (LED3 = ~LED3)

//!测试灯
#define INFO_LED_CONV() LED1_CONV()
#define INFO_LED_OFF(x) LED1_OFF(x)
//!工作灯
#define WORKING_LED_CONV() LED2_CONV()
#define WORKING_LED_OFF(x) LED2_OFF(x)
//!nodeId灯
#define ID_LED_CONV() LED3_CONV()
#define ID_LED_OFF(x) LED3_OFF(x)
#endif

/**
* @}
Expand All @@ -61,12 +99,21 @@
* @brief 蜂鸣器定义
* @{
*/
#define BEEP_PORT GPIOB
#define BEEP_PIN GPIO_Pin_1
#ifdef HARDWARE_VERSION_V1
#define BEEP_PORT GPIOC
#define BEEP_PIN GPIO_Pin_1

#define BEEP PBout(1)
#define BEEP_ON(x) (BEEP = x)
#define BEEP_CONV() (BEEP = ~BEEP)
#define BEEP PCout(1)
#define BEEP_ON(x) (BEEP = x)
#define BEEP_CONV() (BEEP = ~BEEP)
#elif defined(HARDWARE_VERSION_V3)
#define BEEP_PORT GPIOB
#define BEEP_PIN GPIO_Pin_1

#define BEEP PBout(1)
#define BEEP_ON(x) (BEEP = x)
#define BEEP_CONV() (BEEP = ~BEEP)
#endif
/**
* @}
*/
Expand Down Expand Up @@ -107,15 +154,24 @@


/**
* @brief 模数字信号电平检测
* @brief 数字信号电平检测
* @{
*/
#define DIG1_PORT GPIOB
#define DIG1_PIN GPIO_Pin_3
#define DIG2_PORT GPIOD
#define DIG2_PIN GPIO_Pin_2
#define DIGITAL_INPUT1 ((~GPIO_ReadInputDataBit(DIG1_PORT,DIG1_PIN)) & 0x01)//电路中会把高读取为0,低读取为1,故取反
#define DIGITAL_INPUT2 ((~GPIO_ReadInputDataBit(DIG2_PORT,DIG2_PIN)) & 0x01)
#ifdef HARDWARE_VERSION_V1
#define DIG1_PORT GPIOA
#define DIG1_PIN GPIO_Pin_1
#define DIG2_PORT GPIOA
#define DIG2_PIN GPIO_Pin_0
#define DIGITAL_INPUT1 ((~GPIO_ReadInputDataBit(DIG1_PORT,DIG1_PIN)) & 0x01)//电路中会把高读取为0,低读取为1,故取反
#define DIGITAL_INPUT2 ((~GPIO_ReadInputDataBit(DIG2_PORT,DIG2_PIN)) & 0x01)
#elif defined(HARDWARE_VERSION_V3)
#define DIG1_PORT GPIOB
#define DIG1_PIN GPIO_Pin_3
#define DIG2_PORT GPIOD
#define DIG2_PIN GPIO_Pin_2
#define DIGITAL_INPUT1 ((~GPIO_ReadInputDataBit(DIG1_PORT,DIG1_PIN)) & 0x01)//电路中会把高读取为0,低读取为1,故取反
#define DIGITAL_INPUT2 ((~GPIO_ReadInputDataBit(DIG2_PORT,DIG2_PIN)) & 0x01)
#endif
/**
* @}
*/
Expand Down
2 changes: 1 addition & 1 deletion HARDWARE/QUEUE/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define MAX_TEST_NAME_LENGTH 64 /*!< 测试名称最长长度>*/
#define PACKAGE_TIME_IO_LENGTH 16 /*!< 时间、IO、ADC数量等长度>*/
#define PACKAGE_HEAD_FRAME_LENGTH (MAX_TEST_NAME_LENGTH+PACKAGE_TIME_IO_LENGTH) /*!< 帧头总长度>*/
#define DEFAULT_TEST_NAME "DefaultName/2019-03-09T00:00:00\0" /*!< 默认测试名称>*/
#define DEFAULT_TEST_NAME "DefaultName/2019-02-09T00:00:00\0" /*!< 默认测试名称>*/
/**
* @}
*/
Expand Down
6 changes: 3 additions & 3 deletions HARDWARE/WIFI/userwifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
u32 SYSTEMTIME = 0; //系统时间
u32 YYMMDD =0; //年月日
u8 Time_Sync_Flag = 0; //最近时钟是否同步
volatile u8 Wifi_Send_EN = 0; //数据采集和发送使能,是CAN和ADC采集的总开关
volatile u8 Wifi_Send_EN = 1; //数据采集和发送使能,是CAN和ADC采集的总开关
u8 CAN_Get_EN = CAN1_ENABLE_BIT_SLC|CAN2_ENABLE_BIT_SLC; //CAN数据发送使能(第0位使能can1,第1位使能can2),默认开启(必须满足Wifi_Send_EN=1,才能采集)
u8 ADC_Get_EN = 1; //ADC数据采集使能,默认开启(必须满足Wifi_Send_EN=1,才能采集)
Queue adc_queue; //ADC数据存储
Expand Down Expand Up @@ -309,14 +309,14 @@ u8 order_anay(u8 arr[])
memcpy(&YYMMDD,&arr[1],4);
memcpy(&SYSTEMTIME,&arr[5],4);
Time_Sync_Flag = 1;
TEST_LED_CONV();
INFO_LED_CONV();
}
break;
case GET_TIME_SYNC_MAIN_CLOCK:
memcpy(&YYMMDD,&arr[1],4);
memcpy(&SYSTEMTIME,&arr[5],4);
Time_Sync_Flag = 1;
TEST_LED_CONV();
INFO_LED_CONV();
return NOT_NEED_RETURN_INFO;
case RETURN_INFO://返回了回复信号
return NOT_NEED_RETURN_INFO;//表示不需要返回信息
Expand Down
13 changes: 13 additions & 0 deletions USER/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,19 @@ typedef enum
* @}
*/


/**
* @brief 硬件版本
* @{
*/

#define HARDWARE_VERSION_V3
/**
* @}
*/



//!缓存需要保存到Flash中的数据,包括数据长度、参数、分隔符、结束符、CRC等
extern u8 catPara[PARA_CAT_CH_MAX_LENGTH];
//!节点ID
Expand Down
2 changes: 1 addition & 1 deletion USER/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ int main(void)
if(RSI_WIFI_OPER_MODE == RSI_WIFI_CLIENT_MODE_VAL){
if(IAM_MASTER_CLOCK == 'Y'){
if(sync_interval_time >= SYNC_INTERVAL_TIME&&Wifi_Send_EN){
TEST_LED_CONV();//翻转
INFO_LED_CONV();//翻转
sync_interval_time = 0;
Send_Sync_Time();//时钟同步一下
}
Expand Down

0 comments on commit 9a598d5

Please sign in to comment.