This commit is contained in:
hathach committed 2017-04-03 13:53:38 +07:00
1 parent c7f8a8d67f
commit d955303a78
3 files changed
+15 -9

No files matched your search

+2
View File
@@ -68,6 +68,8 @@ enum
#define rtos_free(ptr) ({ cprintf("[free] %s:%d\r\n" ,__PRETTY_FUNCTION__, __LINE__/*malloc_usable_size(ptr)*/); vPortFree(ptr); })
#else
#define rtos_malloc_type(_type) (_type*) rtos_malloc(sizeof(_type))
static inline void* rtos_malloc(size_t _size)
{
return (xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED) ? malloc(_size) : pvPortMalloc(_size);
+4 -6
View File
@@ -52,15 +52,16 @@ class AdafruitBluefruit;
class BLECentral
{
public:
BLECentral(void); // Constructor
typedef void (*connect_callback_t ) (uint16_t conn_handle);
typedef void (*disconnect_callback_t ) (uint16_t conn_handle, uint8_t reason);
typedef void (*scan_callback_t ) (ble_gap_evt_adv_report_t*);
BLECentral(void); // Constructor
void begin(void);
/*------------------------------------------------------------------*/
/* Scan & Parser
*------------------------------------------------------------------*/
typedef void (*scan_callback_t) (ble_gap_evt_adv_report_t*);
void setScanCallback(scan_callback_t fp);
err_t startScanning(uint16_t timeout = 0);
err_t stopScanning(void);
@@ -86,9 +87,6 @@ class BLECentral
/*------------------------------------------------------------------*/
/* CALLBACKS
*------------------------------------------------------------------*/
typedef void (*connect_callback_t) (uint16_t conn_handle);
typedef void (*disconnect_callback_t) (uint16_t conn_handle, uint8_t reason);
void setConnectCallback ( connect_callback_t fp);
void setDisconnectCallback( disconnect_callback_t fp);
+9 -3
View File
@@ -33,6 +33,8 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**************************************************************************/
#ifndef BLUEFRUIT_H_
#define BLUEFRUIT_H_
#include <Arduino.h>
#include "bluefruit_common.h"
@@ -70,6 +72,8 @@
#include "central_services/BLECentralUart.h"
#include "AdaCallback.h"
#define BLE_MAX_DATA_PER_MTU (GATT_MTU_SIZE_DEFAULT - 3)
@@ -81,6 +85,9 @@ extern "C"
class AdafruitBluefruit
{
public:
typedef void (*connect_callback_t ) (void);
typedef void (*disconnect_callback_t) (uint8_t reason);
// Constructor
AdafruitBluefruit(void);
@@ -132,9 +139,6 @@ class AdafruitBluefruit
/*------------------------------------------------------------------*/
/* Callbacks
*------------------------------------------------------------------*/
typedef void (*connect_callback_t) (void);
typedef void (*disconnect_callback_t) (uint8_t reason);
void setConnectCallback ( connect_callback_t fp);
void setDisconnectCallback( disconnect_callback_t fp);
@@ -206,3 +210,5 @@ COMMENT_OUT(
};
extern AdafruitBluefruit Bluefruit;
#endif