It uses an expression (&u8x8) in its code. Searching has not told me what this express expands to or means. I would appreciate someone clarifying this for me.
Thank you,
Joe
It uses an expression (&u8x8) in its code. Searching has not told me what this express expands to or means. I would appreciate someone clarifying this for me.
Thank you,
Joe
"address of variable u8x8" probably (the address of the first character in) an array of characters.
How much do you know about pointers ?
Is there a variable named u8x8 declared in the sketch ?
Please post the full sketch that contains the expression that you are asking about, using code tags when you do
U8X8 Library.
So, the ampersand stands for 'address'? as in a pointer?
Yes - "address of" the first element of the array. (Also called "pointer to" the first element, but I believe that is not always correct)
Take an hour (or many) to look at pointers, linked lists and structures. These will be essential as your programs increase in complexity.
Thank you, I know about pointers (class about 40 yrs ago) just didn't know what the ampersand meant when not use as an and operator. I was digging through a program and it's libraries trying to find when the SW bit bang got the 0x3C or 0x78 address to send when I came upon this. I know the program did it since I saw the address being sent by a logic analyzer, but was trying to find in the code where it happened. This program: GitHub - avaldebe/TinyI2CScanner: Micro I2C-Scanner with 0.96" Oled and ATtiny85
what does the * mean? ei: 'const uint8_t *font;" is it also a pointer? or something else?
The asterisk says "a pointer to a constant uint8_t named font"
The asterisk is also called the "dereference" operator.
I found examples of a variable, address and pointer/deref:
int myAge = 43; // An int variable
int* ptr = &myAge; // A pointer variable, with the name ptr, that stores the address of myAge
// Output the value of myAge (43)
printf("%d\n", myAge);
// Output the memory address of myAge (0x7ffe5367e044)
printf("%p\n", &myAge);
// Output the memory address of myAge with the pointer (0x7ffe5367e044)
printf("%p\n", ptr);
In the U8g2 library, the only file that seems to set the i2c address is src/clib/u8x8_cad.c and the address is in the form 0x078 with the extra leading zero for some reason.
Thank you, found the Arduino language reference. Don't know why I didn't think of that before.
Also finally dragged out my old C Course book and reviewed pointers. Boy my 80 yr old brain gets boggled with that.
David: Thank you. Did a grep on the files for 0x3c or 0x78 and didn't find it because it is 0x078.