Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

problem using uint32_t return argument in EFR32FG14

yefj

Advanced Member level 3
Advanced Member level 3
Joined
Sep 12, 2019
Messages
701
Helped
0
Reputation
0
Reaction score
2
Trophy points
18
Activity points
3,868
Hello, I am trying to store the value which returns GPIO_IntGet function.
the function it self is shown in the end ,
I have defined a uint32_t variable and put it on the left side of the function signature.
How ever i get an error.
Where did i go wrong in collecting the retuned value?

Code:
// Clear all even pin interrupt flags
    uint32_t res;
    res=GPIO_IntGet(void);

ERROR:
^~~~~~~~~~~
C:/Users/Asus/Documents/peripheral_examples-master/peripheral_examples-master/series1/gpio/switch_led_interrupt/src/main_s1.c:51:11: warning: variable 'res' set but not used [-Wunused-but-set-variable]
uint32_t res;
^~~
make: *** [src/main_s1.o] Error 1

01:18:37 Build Finished (took 1s.227ms)

1675466927333.png


1675467346017.png
 

betwixt

Super Moderator
Staff member
Advanced Member level 7
Joined
Jul 4, 2009
Messages
15,793
Helped
5,085
Reputation
10,195
Reaction score
4,947
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
133,746
You read the value but never use it. Because it is declared inside the function it is a local variable and not usable elsewhere. If you need the value, make it global or return it from the function and ideally declare it volatile as it might change unexpectedly when the ISR is called.

Brian.
 

    yefj

    Points: 2
    Helpful Answer Positive Rating

yefj

Advanced Member level 3
Advanced Member level 3
Joined
Sep 12, 2019
Messages
701
Helped
0
Reputation
0
Reaction score
2
Trophy points
18
Activity points
3,868
by mistake i put the word void inside signature, when i changed to empty () it worked fine.
res=GPIO_IntGet()
Thanks.
 

LaTeX Commands Quick-Menu:

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top