initial commit from esp-idf example
This commit is contained in:
32
include/common.h
Normal file
32
include/common.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef COMMON_H
|
||||
#define COMMON_H
|
||||
|
||||
/* Includes */
|
||||
/* STD APIs */
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* ESP APIs */
|
||||
#include "esp_log.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
/* FreeRTOS APIs */
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
|
||||
/* NimBLE stack APIs */
|
||||
#include "host/ble_hs.h"
|
||||
#include "host/ble_uuid.h"
|
||||
#include "host/util/util.h"
|
||||
#include "nimble/ble.h"
|
||||
#include "nimble/nimble_port.h"
|
||||
#include "nimble/nimble_port_freertos.h"
|
||||
|
||||
/* Defines */
|
||||
#define TAG "NimBLE_GATT_Server"
|
||||
#define DEVICE_NAME "NimBLE_GATT"
|
||||
|
||||
#endif // COMMON_H
|
||||
18
include/gap.h
Normal file
18
include/gap.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef GAP_SVC_H
|
||||
#define GAP_SVC_H
|
||||
|
||||
/* Includes */
|
||||
/* NimBLE GAP APIs */
|
||||
#include "host/ble_gap.h"
|
||||
#include "services/gap/ble_svc_gap.h"
|
||||
|
||||
/* Defines */
|
||||
#define BLE_GAP_APPEARANCE_GENERIC_TAG 0x0200
|
||||
#define BLE_GAP_URI_PREFIX_HTTPS 0x17
|
||||
#define BLE_GAP_LE_ROLE_PERIPHERAL 0x00
|
||||
|
||||
/* Public function declarations */
|
||||
void adv_init(void);
|
||||
int gap_init(void);
|
||||
|
||||
#endif // GAP_SVC_H
|
||||
18
include/gatt_svc.h
Normal file
18
include/gatt_svc.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef GATT_SVR_H
|
||||
#define GATT_SVR_H
|
||||
|
||||
/* Includes */
|
||||
/* NimBLE GATT APIs */
|
||||
#include "host/ble_gatt.h"
|
||||
#include "services/gatt/ble_svc_gatt.h"
|
||||
|
||||
/* NimBLE GAP APIs */
|
||||
#include "host/ble_gap.h"
|
||||
|
||||
/* Public function declarations */
|
||||
void send_heart_rate_indication(void);
|
||||
void gatt_svr_register_cb(struct ble_gatt_register_ctxt *ctxt, void *arg);
|
||||
void gatt_svr_subscribe_cb(struct ble_gap_event *event);
|
||||
int gatt_svc_init(void);
|
||||
|
||||
#endif // GATT_SVR_H
|
||||
15
include/heart_rate.h
Normal file
15
include/heart_rate.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef HEART_RATE_H
|
||||
#define HEART_RATE_H
|
||||
|
||||
/* Includes */
|
||||
/* ESP APIs */
|
||||
#include "esp_random.h"
|
||||
|
||||
/* Defines */
|
||||
#define HEART_RATE_TASK_PERIOD (1000 / portTICK_PERIOD_MS)
|
||||
|
||||
/* Public function declarations */
|
||||
uint8_t get_heart_rate(void);
|
||||
void update_heart_rate(void);
|
||||
|
||||
#endif // HEART_RATE_H
|
||||
19
include/led.h
Normal file
19
include/led.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef LED_H
|
||||
#define LED_H
|
||||
|
||||
/* Includes */
|
||||
/* ESP APIs */
|
||||
#include "driver/gpio.h"
|
||||
#include "led_strip.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
/* Defines */
|
||||
#define BLINK_GPIO CONFIG_BLINK_GPIO
|
||||
|
||||
/* Public function declarations */
|
||||
uint8_t get_led_state(void);
|
||||
void led_on(void);
|
||||
void led_off(void);
|
||||
void led_init(void);
|
||||
|
||||
#endif // LED_H
|
||||
Reference in New Issue
Block a user