- BLE peripheral applications - dr_piezo and bladder_patch projects Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
71 lines
2.1 KiB
C
71 lines
2.1 KiB
C
/*******************************************************************************
|
|
* @file main.h
|
|
* @author CandyPops Co.
|
|
* @version V1.0.0
|
|
* @date 2022-09-05
|
|
* @brief
|
|
******************************************************************************/
|
|
|
|
#ifndef MAIN_H__
|
|
#define MAIN_H__
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdarg.h>
|
|
#include <stdbool.h>
|
|
#include "boards.h"
|
|
|
|
typedef enum
|
|
{
|
|
OFF = 0,
|
|
ON = 1
|
|
}on_off_cont_t;
|
|
|
|
typedef enum
|
|
{
|
|
CMD_BLE = 0,
|
|
CMD_UART = 1
|
|
}which_cmd_t;
|
|
|
|
#if FEATURE_CHAMBER_AUTO_TEST
|
|
typedef enum
|
|
{
|
|
SIMPLE_AUTO_MODE = 0,
|
|
HALF_AUTO_MODE = 1,
|
|
FULL_AUTO_MODE = 2,
|
|
NONE_AUTO_MODE = 3
|
|
}auto_meas_mode_t;
|
|
#endif
|
|
typedef enum
|
|
{
|
|
BLE_DISCONNECTED_ST = 0,
|
|
BLE_CONNECTED_ST = 1
|
|
}ble_status_t;
|
|
#if FEATURE_SECURE_CONNECTION
|
|
static void advertising_start(bool erase_bonds);
|
|
#endif
|
|
void sleep_mode_enter(void);
|
|
static void t_power_off_timeout_handler(void * p_context);
|
|
void device_power_off(void);
|
|
static void power_control_handler(on_off_cont_t device_power_st);
|
|
static void main_s(void * p_context);
|
|
static void PM_s(void * p_context);
|
|
//static void main_re(void * p_context);
|
|
static void main_routine_handler(void * p_context);
|
|
void received_command_process(uint8_t const *data_array, which_cmd_t cmd_t,uint8_t length);
|
|
void data_tx_handler(char const *p_data_to_send);
|
|
void binary_tx_handler(uint8_t const *ble_bin_buff , uint16_t length);
|
|
void dr_binary_tx_safe(uint8_t const *ble_bin_buff, uint16_t length);
|
|
void dr_sd_delay_ms(uint32_t ms);
|
|
void single_format_data(uint8_t *buffer, const char *tag, const uint16_t value) ;
|
|
void format_data(uint8_t *buffer, const char *tag, const uint16_t *data_array, size_t length);
|
|
|
|
void format_data_byte(uint8_t *buffer, const char *tag, const uint8_t *data_array, size_t length);
|
|
void ascii_format_data(uint8_t *buffer, const char *tag, const char *data_ascii, size_t length);
|
|
|
|
extern volatile bool data_tx_in_progress;
|
|
extern volatile bool ble_connection_st;
|
|
extern volatile bool processing;
|
|
#endif //MAIN_H__
|
|
|