I find that my DigitalOut instance is not retaining its output level. My codes looks like this:
//Global variable
DigitalOut port5(p51);
void f1(int val){
port5 = val;
}
void main(int){
f1(1);
//do other stuff
}
What I find is that port5 doesn't stay high. Why is that? My code is actually more complicated but basically does the same thing.
If I place a while(1) as the last line in the f1 function, however, port5 remains high.
Any thoughts on why this would happen?
Edit: This seems to happen even if I don't use DigitalOut and write to the GPIO direction and in/out registers directly. Once the function terminates, the output levels no longer stick.
I find that my DigitalOut instance is not retaining its output level. My codes looks like this:
What I find is that port5 doesn't stay high. Why is that? My code is actually more complicated but basically does the same thing.
If I place a while(1) as the last line in the f1 function, however, port5 remains high.
Any thoughts on why this would happen?
Edit: This seems to happen even if I don't use DigitalOut and write to the GPIO direction and in/out registers directly. Once the function terminates, the output levels no longer stick.