Search found 18 matches

by halfro
Thu Sep 07, 2017 6:25 pm
Forum: ESP-IDF
Topic: Sizeof(struct) call returns invalid struct size
Replies: 2
Views: 7035

Re: Sizeof(struct) call returns invalid struct size

Appropriate definition:

Code: Select all

typedef struct
{
    uint8_t _format;
    int8_t _exponent;
    uint16_t _unit;
    uint8_t _namespace;
    uint16_t _description;
} __attribute__ ((packed)) presentation_t;
by halfro
Thu Sep 07, 2017 11:56 am
Forum: ESP-IDF
Topic: Sizeof(struct) call returns invalid struct size
Replies: 2
Views: 7035

Sizeof(struct) call returns invalid struct size

I am writing down the structure representing the user descriptor value 0x2904: Reference is here:https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml typedef struct { uint8_t _format; int8_t _exponent; uint16_t _un...
by halfro
Tue Sep 05, 2017 9:59 pm
Forum: ESP-IDF
Topic: ESP32 MAC address - is it unique?
Replies: 6
Views: 35109

Re: ESP32 MAC address - is it unique?

That is a 50-50 question as the specific MAC is computed in software except the Wifi station mode which is equal to the base MAC from the EFUSE. The EFUSE MAC is ideally unique. I did some digging and the ethernet MAC, wifi soft access point mode MAC and bluetooth MAC(Classic/BLE) are all derived fr...
by halfro
Thu Aug 31, 2017 9:57 pm
Forum: ESP-IDF
Topic: Addition of multiple characteristics to a BLE service
Replies: 7
Views: 14406

Addition of multiple characteristics to a BLE service

I am currently needing to implement a BLE GATT server with 128 bit server and characteristic UUID's and I am using the GATTS_DEMO provided. I have dug through the internals till the btc level and I have implemented almost everything but I cant seem to figure out how to add multiple characteristics t...
by halfro
Thu Aug 10, 2017 4:45 pm
Forum: ESP-IDF
Topic: Accessing dynamic memory by array notation
Replies: 5
Views: 9153

Re: Accessing dynamic memory by array notation

Thank you everyone. Your insight helped. I believe I was writing out of bounds therefore the test codes were also reading out of bounds. Changing the code to: #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "stdio.h" void app_main(void) { int length=4; uint16_t *foo = (uint16_t*)m...
by halfro
Thu Aug 10, 2017 12:17 pm
Forum: ESP-IDF
Topic: Accessing dynamic memory by array notation
Replies: 5
Views: 9153

Re: Accessing dynamic memory by array notation

Thanks for the reply @Kolban. Sorry, This was meant to be a pointer variable to an unsigned 32 bit integer, not an actual 32 bit unsigned integer: uint32_t* foo=(uint32_t*)malloc(sizeof(uint32_t)*utf8string_length); The pointer points to the start of a sequence of UTF-8 characters in heap memory. A ...
by halfro
Wed Aug 09, 2017 10:12 pm
Forum: ESP-IDF
Topic: Accessing dynamic memory by array notation
Replies: 5
Views: 9153

Accessing dynamic memory by array notation

I have a variable that is dynamically allocated at runtime, meant to store utf8strings. The utf8strings are converted from a byte sequence received via BLE from a user. The variable in this example here is named foo: uint32_t foo=(uint32_t*)malloc(sizeof(uint32_t)*utf8string_length); Once I have dat...