123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- #ifndef _SYSMGR_H_
- #define _SYSMGR_H_
- #include "nrf_drv_spi.h"
- #include "app_util_platform.h"
- #include "nrf_gpio.h"
- #include "nrf_delay.h"
- #include "boards.h"
- #include "app_error.h"
- #include <string.h>
- #include "nrf_log.h"
- #include "nrf_log_ctrl.h"
- #include "nrf_log_default_backends.h"
- #include "ble_gap.h"
- #include "fds.h"
- #include "nrf_fstorage.h"
- struct stSystemTimer__ {
- volatile int MS_1;
- volatile int UART_LAST_RECV_TIMER;
- volatile int SEND_TEST_TIMER;
- volatile int LED_TOGGLE_TIMER;
- volatile int TMR_SYS_OFF;
- volatile int SEND_TIMER;
- volatile int BUZZER_TIMER;
- char EMG_SEND_RUN;
- volatile int TIM_KEY;
- volatile int SLEEP_TIMER;
- };
- typedef struct stSystemTimer__ stSystemTimer;
- struct stSystemManager__ {
- char EmgSendButton;
- char TestSendButton;
- char RxEvent;
- char SendRepeat;
- char SendFlag;
- int BleConnectTime;
- int SendRepeatTimerLimit;
- char BuzzerType;
- char BuzzerBusy;
- unsigned char Batt;
- char BleSendReady;
- char BleSendStatus;
- char BleConnected;
- char BleSendRetry;
- char PeerAddr[6];
- char StrPeerAddr[15];
- char RegPeerAddr[6];
- char StrRegPeerAddr[15];
- char SysReady;
- char SleepEnter;
- char FWUpdate;
-
- char GpReg;
- char GoSleep;
- uint32_t ResetReason;
- char AesEncData[16];
- };
- typedef struct stSystemManager__ stSystemManager;
- #define AES_ENC_CAR 1
- #define AES_ENC_EMG 2
- #define AES_ENC_PCA 3
- #define AES_ENC_WES_EMG 4
- #define AES_ENC_WES_ALV 5
- #define AES_ENC_WES_TST 6
- #define AES_ENC_WES_REG 7
- /* A dummy structure to save in flash. */
- #define CONFIG_FILE (0x8010)
- #define CONFIG_REC_KEY (0x7010)
- typedef struct
- {
- uint32_t boot_count;
- char device_name[16];
- bool config1_on;
- bool config2_on;
- } configuration_t;
- typedef struct
- {
- char Mac[10][15];
- int Count;
- }RegMacPool_t;
- void ParkSysInit();
- void ParkPowerOff();
- void SendEmgData(void);
- extern stSystemTimer SystemTimer;
- extern stSystemManager SystemManager;
- #define KEY_SELECT 0
- #define KEY_UP 1
- #define KEY_DOWN 3
- #define KEY_BACK 2
- typedef struct tsHSKey{
- unsigned char onFlag;
- unsigned char softRelease;
- unsigned char pressedSec;
- unsigned int pressTime;
- unsigned int longPressTimeOne;
- unsigned int longPressTimeKeep;
- unsigned int prevTime;
- }HSKey;
- void ReadKEY(void);
- void KeyInit(void);
- void KeySelectLongPressedOne(void);
- void m_standby_counter_clerar();
- void PortInputCfg(void);
- void lfclk_config(void);
- void rtc_config(void);
- void SaveReceiverMac(char* mac);
- void LoadReceiverMac();
- void FlashTest();
- void WesEncryptEcb(uint8_t* in);
- void WesDecryptEcb(char* in, char* out);
- extern ble_gap_addr_t old_ble_addr;
- extern ble_gap_addr_t new_ble_addr;
- extern RegMacPool_t RegMacPool;
- #endif
|