raw voltage values
This commit is contained in:
parent
4374fc2c37
commit
65240ee603
@ -1 +1 @@
|
|||||||
Subproject commit c879e0dd70ae36d9db3c6d50ef0c62bc9259055d
|
Subproject commit 6a651ce129cf9d0ce562aa676cbdd9789ff6011e
|
@ -1,6 +1,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "BLE_UUID.h"
|
||||||
#include "esp_attr.h"
|
#include "esp_attr.h"
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
@ -9,6 +10,7 @@
|
|||||||
#include "freertos/projdefs.h"
|
#include "freertos/projdefs.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "freertos/portmacro.h"
|
#include "freertos/portmacro.h"
|
||||||
|
#include "host/ble_uuid.h"
|
||||||
#include "spinlock.h"
|
#include "spinlock.h"
|
||||||
|
|
||||||
#include "esp_adc/adc_continuous.h"
|
#include "esp_adc/adc_continuous.h"
|
||||||
@ -22,6 +24,7 @@
|
|||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
#include "BLEh.h"
|
#include "BLEh.h"
|
||||||
|
#include "simple_gatt_value_server.h"
|
||||||
|
|
||||||
#include "BLE.h"
|
#include "BLE.h"
|
||||||
|
|
||||||
@ -108,7 +111,21 @@ void app_main(void){
|
|||||||
|
|
||||||
nvs_flash_init();
|
nvs_flash_init();
|
||||||
|
|
||||||
|
uint32_t raw_mv_meas[ADC_IN_PIN_NUM];
|
||||||
|
|
||||||
|
struct char_pres_format mv_char_pres_format = {
|
||||||
|
.format = FORMAT_UINT32,
|
||||||
|
.unit = VOLTS_UNIT_UUID,
|
||||||
|
.exponent = -3,
|
||||||
|
.namespc = 1,
|
||||||
|
.descrH = NSP_DESC_MAIN & 0xff,
|
||||||
|
.descrL = (NSP_DESC_MAIN>>8) & 0xff,
|
||||||
|
};
|
||||||
|
|
||||||
|
simple_gatt_value_server(&raw_mv_meas, sizeof(uint32_t), ADC_IN_PIN_NUM, mv_char_pres_format, &gatt_svcs[RAW_VALUES_SVC_ID], BLE_UUID16_DECLARE(VOLTAGE_CHAR));
|
||||||
|
|
||||||
set_gatt_services(gatt_svcs, SVCS_NUM);
|
set_gatt_services(gatt_svcs, SVCS_NUM);
|
||||||
|
|
||||||
initBLE("ALIM");
|
initBLE("ALIM");
|
||||||
|
|
||||||
ESP_ERROR_CHECK(adc_continuous_register_event_callbacks(adc_handle, &adc_event, NULL));
|
ESP_ERROR_CHECK(adc_continuous_register_event_callbacks(adc_handle, &adc_event, NULL));
|
||||||
|
18
main/BLE.c
18
main/BLE.c
@ -23,24 +23,6 @@ struct ble_gatt_svc_def gatt_svcs[] = {
|
|||||||
[RAW_VALUES_SVC_ID] = {
|
[RAW_VALUES_SVC_ID] = {
|
||||||
.type = BLE_GATT_SVC_TYPE_PRIMARY,
|
.type = BLE_GATT_SVC_TYPE_PRIMARY,
|
||||||
.uuid = BLE_UUID16_DECLARE(METROLOGY_SERVICE),
|
.uuid = BLE_UUID16_DECLARE(METROLOGY_SERVICE),
|
||||||
.characteristics = (struct ble_gatt_chr_def[]){
|
|
||||||
[0] = {
|
|
||||||
.uuid = BLE_UUID16_DECLARE(VOLTAGE_CHAR),
|
|
||||||
.access_cb = gatt_char_access_placeholder,
|
|
||||||
.flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_NOTIFY,
|
|
||||||
.min_key_size = 0,
|
|
||||||
.arg = NULL,
|
|
||||||
.descriptors = (struct ble_gatt_dsc_def[]){
|
|
||||||
[0] = {
|
|
||||||
.uuid = BLE_UUID16_DECLARE(CHAR_PRES_FORMAT),
|
|
||||||
.att_flags = BLE_GATT_CHR_F_READ,
|
|
||||||
.access_cb = gatt_char_access_placeholder,
|
|
||||||
},
|
|
||||||
{ 0 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ 0 },
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
[CONFIGURATION_SVC_ID] = {
|
[CONFIGURATION_SVC_ID] = {
|
||||||
.type = BLE_GATT_SVC_TYPE_PRIMARY,
|
.type = BLE_GATT_SVC_TYPE_PRIMARY,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user