Page 1 of 1

"lvalue required as left operand of assignment" When Writing to GPIO_REGs

Posted: Sat May 13, 2017 6:04 pm
by Fuzzyzilla
Hello!
I am trying to make code for an 8080 parallel connection.
I've run into a problem very early though!
Attempting to edit the register "GPIO_OUT_REG," which, in the technical datasheet is listed as R/W capable, throws an error:

Code: Select all

sketch_may13a:19: error: lvalue required as left operand of assignment

   GPIO_OUT_REG|= 0b11000000000|(*readLoc);//Enable write and chip, write data
("readLoc" is a byte* pointing to the address of a uint16_t[128*128], but that's not the error here. And yes, it has been reinterpret_casted. Even writing a static value does not work.)

<Speculation>
In one of the attempts, it showed me that GPIO_OUT_REG is #defined relative to another variable:

Code: Select all

 #define GPIO_OUT_REG          (DR_REG_GPIO_BASE + 0x0004)
This is an issue for assignment of the variable, I'm pretty sure!
</Speculation>

Re: "lvalue required as left operand of assignment" When Writing to GPIO_REGs

Posted: Sun May 14, 2017 2:36 am
by ESP_Sprite
GPIO_OUT_REG is the memory address of the out register, not the register itself. You're supposed to use it with e.g. REG_WRITE, or alternatively use the struct defines in gpio_struct.h and do GPIO.out=0x123.

Re: "lvalue required as left operand of assignment" When Writing to GPIO_REGs

Posted: Sun May 14, 2017 4:58 am
by Fuzzyzilla
Cool! Having all of those IO functions in one place is super useful!
Thanks!