72 lines
1.9 KiB
C
72 lines
1.9 KiB
C
|
|
/********************************** (C) COPYRIGHT *******************************
|
|||
|
|
* File Name : peripheral.h
|
|||
|
|
* Author : WCH
|
|||
|
|
* Version : V1.0
|
|||
|
|
* Date : 2018/12/11
|
|||
|
|
* Description :
|
|||
|
|
|
|||
|
|
*******************************************************************************/
|
|||
|
|
|
|||
|
|
#ifndef PERIPHERAL_H
|
|||
|
|
#define PERIPHERAL_H
|
|||
|
|
|
|||
|
|
#ifdef __cplusplus
|
|||
|
|
extern "C"
|
|||
|
|
{
|
|||
|
|
#endif
|
|||
|
|
#include "CH57x_common.h" //CH57X <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
|||
|
|
//#include "data_save.h"
|
|||
|
|
|
|||
|
|
#define BLE_PERIPHERAL_EN 0
|
|||
|
|
#define BLE_CENTRAL_EN 1
|
|||
|
|
/*********************************************************************
|
|||
|
|
* INCLUDES
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
/*********************************************************************
|
|||
|
|
* CONSTANTS
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
// Peripheral Task Events
|
|||
|
|
#define SBP_START_DEVICE_EVT 0x0001
|
|||
|
|
#define SBP_PERIODIC_EVT 0x0002
|
|||
|
|
#define SBP_READ_RSSI_EVT 0x0004
|
|||
|
|
#define SBP_PARAM_UPDATE_EVT 0x0008
|
|||
|
|
|
|||
|
|
/*********************************************************************
|
|||
|
|
* MACROS
|
|||
|
|
*/
|
|||
|
|
typedef struct
|
|||
|
|
{
|
|||
|
|
uint16 connHandle; // Connection handle of current connection
|
|||
|
|
uint16 connInterval;
|
|||
|
|
uint16 connSlaveLatency;
|
|||
|
|
uint16 connTimeout;
|
|||
|
|
} peripheralConnItem_t;
|
|||
|
|
|
|||
|
|
extern peripheralConnItem_t peripheralConnList;
|
|||
|
|
/*********************************************************************
|
|||
|
|
* FUNCTIONS
|
|||
|
|
*/
|
|||
|
|
//uint8 Set_BleDevice_Name(uint8* name, u8 len);
|
|||
|
|
/*
|
|||
|
|
* Task Initialization for the BLE Application
|
|||
|
|
*/
|
|||
|
|
extern void Peripheral_Init( void );
|
|||
|
|
|
|||
|
|
/*
|
|||
|
|
* Task Event Processor for the BLE Application
|
|||
|
|
*/
|
|||
|
|
extern uint16 Peripheral_ProcessEvent( uint8 task_id, uint16 events );
|
|||
|
|
|
|||
|
|
void peripheralChar4Notify( uint8 *pValue, uint16 len );
|
|||
|
|
|
|||
|
|
/*********************************************************************
|
|||
|
|
*********************************************************************/
|
|||
|
|
|
|||
|
|
#ifdef __cplusplus
|
|||
|
|
}
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
#endif
|