95 lines
3.5 KiB
C
95 lines
3.5 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 HARDWARE_VERSION "VB0HW0000"
|
|
#define SERIAL_NUMBER "VBT2608000Z"
|
|
#define DEFAULT_PASSKEY "123456"
|
|
#define FIRMWARE_VERSION "VBTFW0206"
|
|
|
|
/*
|
|
* Firmware Version History
|
|
* Date | FW version | Image version | Description
|
|
* 2026-07-31 | VBTFW0200 | 2.0.0+0 | Initial release
|
|
* 2026-08-05 | VBTFW0201 | 2.0.1+0 | Added allowlist, fixed bond delete issue
|
|
* 2026-08-05 | VBTFW0202 | 2.0.2+0 | Added production command(mpd?)
|
|
* 2026-08-25 | VBTFW0203 | 2.0.3+0 | Fixed piezo power on/off timing, piezo sweep timing, and BLE settings
|
|
* 2026-08-28 | VBTFW0204 | 2.0.4+0 | Align IMU direct read(mbb?) FSR with FIFO scale
|
|
* 2026-08-28 | VBTFW0205 | 2.0.5+0 | Fixed BLE connection interval(15~30ms -> 30~60ms) for battery life improvement
|
|
*/
|
|
|
|
/*==============================================================================
|
|
* 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_production_done;
|
|
extern bool bond_data_delete;
|
|
extern uint32_t m_life_cycle;
|
|
extern uint8_t m_reset_status;
|
|
|
|
#endif /* MAIN_H__ */
|