86 lines
2.8 KiB
C
86 lines
2.8 KiB
C
/*******************************************************************************
|
|
* @file main.h
|
|
* @brief VesiScan-Basic
|
|
******************************************************************************/
|
|
|
|
#ifndef MAIN_H__
|
|
#define MAIN_H__
|
|
|
|
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
#include <stdarg.h>
|
|
#include <stdbool.h>
|
|
|
|
/*==============================================================================
|
|
* Firmware identification : Default values, can be overridden by NVS
|
|
*============================================================================*/
|
|
#define FIRMWARE_VERSION "TSTFW042"
|
|
#define HARDWARE_VERSION "VB0HW0000"
|
|
#define SERIAL_NUMBER "VBT260300ZZ"
|
|
#define DEFAULT_PASSKEY "123456"
|
|
|
|
/*==============================================================================
|
|
* Data length constants
|
|
*============================================================================*/
|
|
#define SERIAL_NO_LENGTH 12
|
|
#define HW_NO_LENGTH 12
|
|
#define PASSKEY_LENGTH 6
|
|
#define SERIAL_NO_BUF_SIZE (SERIAL_NO_LENGTH + 1)
|
|
#define HW_NO_BUF_SIZE (HW_NO_LENGTH + 1)
|
|
#define PASSKEY_BUF_SIZE (PASSKEY_LENGTH + 1)
|
|
|
|
/*==============================================================================
|
|
* Enumerations
|
|
*============================================================================*/
|
|
|
|
typedef enum
|
|
{
|
|
OFF = 0,
|
|
ON = 1
|
|
} on_off_cont_t;
|
|
|
|
typedef enum
|
|
{
|
|
CMD_BLE = 0,
|
|
CMD_UART = 1
|
|
} which_cmd_t;
|
|
|
|
typedef enum
|
|
{
|
|
BLE_DISCONNECTED_ST = 0,
|
|
BLE_CONNECTED_ST = 1
|
|
} ble_status_t;
|
|
|
|
/*==============================================================================
|
|
* Timing constants
|
|
*============================================================================*/
|
|
#define POWER_ON_DELAY 5 /* Power button poll interval (ms) */
|
|
#define POWER_OFF_DELAY 2000 /* LED display before power off (ms) */
|
|
|
|
/*==============================================================================
|
|
* Function declarations
|
|
*============================================================================*/
|
|
|
|
void sleep_mode_enter(void);
|
|
void sleep_mode_enter_reason(const char *reason);
|
|
void device_power_off(void);
|
|
void device_power_off_reason(const char *reason);
|
|
void device_power_keep_on(void);
|
|
void power_button_suspend(bool suspend);
|
|
|
|
/*==============================================================================
|
|
* Global variables (extern)
|
|
*============================================================================*/
|
|
extern volatile bool ble_connection_st;
|
|
extern volatile bool processing;
|
|
extern char SERIAL_NO[SERIAL_NO_BUF_SIZE];
|
|
extern char HW_NO[HW_NO_BUF_SIZE];
|
|
extern char m_static_passkey[PASSKEY_BUF_SIZE];
|
|
extern uint8_t m_passkey_changed;
|
|
extern bool bond_data_delete;
|
|
extern uint32_t m_life_cycle;
|
|
extern uint8_t m_reset_status;
|
|
|
|
#endif /* MAIN_H__ */
|