This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

assinging ram variable to attribute char value

Hi, i have assigned RAM address as:

#define RAM_MEMORY_TEST_ADDRESS (0x20002BD8)
 uint8_t * p_ram_test = (uint8_t *)RAM_MEMORY_TEST_ADDRESS;

to this p_ram_test i am assigning : p_ram_test = packet_form;// where packet form is also array of 16 elements of type uint8_t.

above things are done in main,c

In our_srvice.c I want to add p_ram_test to attr_char_value as:

attr_char_value.p_value = extern p_ram_test; but it showing error as expected an expression.

How to add ram variable to characteristic value?

  • I don't see the point assigning p_ram_test to RAM_MEMORY_TEST_ADDRESS and then assign it again to p_ram_test = packet_form. It will point to same address of packet_form.

    To include a variable into different file, you need to declare it and add extern in.

    So what you need to do is to declare in our_service.c extern uint8_t * p_ram_test;

    And then use p_ram_test normally (without extern)

Related