View previous topic :: View next topic |
Author |
Message |
vtrx
Joined: 11 Oct 2017 Posts: 142
|
Use an Internal Eeprom value |
Posted: Fri Nov 01, 2019 4:15 am |
|
|
How to use a value stored in the internal Eeprom to define a value in a table?
Example:
Code: | #ROM int8 0xF00000 = {0x00} |
Code: | const char USB_DEVICE_DESC[USB_DESC_DEVICE_LEN] ={
//starts of with device configuration. only one possible
USB_DESC_DEVICE_LEN, //the length of this report ==1
0x01, //the constant DEVICE (DEVICE 0x01) ==2
0x10,0x01, //usb version in bcd (pic167xx is 1.1) ==3,4
??, //USE HERE VALUE RECORDED AT THE POSITION 0
}; |
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Fri Nov 01, 2019 4:25 am |
|
|
You don't.
Your device descriptor would have to be made a RAM value (get rid
of const), then it can be written.
You can then use:
*(((byte *)&USB_DEVICE_DESC)+4) =read_eeprom(0);
Which will write the byte from the EEPROM into the device descriptor. |
|
|
vtrx
Joined: 11 Oct 2017 Posts: 142
|
|
Posted: Fri Nov 01, 2019 6:01 pm |
|
|
Could you show me the example above changed? |
|
|
|