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

User avatar
Fuzzyzilla
Posts: 22
Joined: Sun Apr 23, 2017 3:19 am

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

Postby Fuzzyzilla » Sat May 13, 2017 6:04 pm

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>

ESP_Sprite
Posts: 9715
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_Sprite » Sun May 14, 2017 2:36 am

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.

User avatar
Fuzzyzilla
Posts: 22
Joined: Sun Apr 23, 2017 3:19 am

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

Postby Fuzzyzilla » Sun May 14, 2017 4:58 am

Cool! Having all of those IO functions in one place is super useful!
Thanks!

Who is online

Users browsing this forum: No registered users and 122 guests