I've got an issue with a program and interrupts.
In trying to sort it out, I've been trying to decipher a warning and want to know if it is something I should be worried about, or just ignore it.
ARDUINO-V01.ino:318:63: warning: invalid conversion from 'volatile void*' to 'void*' [-fpermissive] memcpy(&COMM_SEND_BUFFER, &g.cur_pos, bytes_to_send++); ^ In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:25:0, from sketch\ARDUINO-V01.ino.cpp:1: c:\program files (x86)\arduino\hardware\tools\avr\avr\include\string.h:191:14: note: initializing argument 1 of 'void* memcpy(void*, const void*, size_t)' extern void *memcpy(void *, const void *, size_t);
The warning is complaining about a buffer I'm using for TwoWire comms.
I've defined the buffer as :
volatile byte COMM_SEND_BUFFER[BUFFER_LENGTH];
and later in the code, I use memcpy to transfer data into it, ready to send out as needed
.... COMM_SEND_BUFFER = I2C_MOTOR_POSITION; char bytes_to_send = sizeof(g.cur_pos); memcpy(&COMM_SEND_BUFFER, &g.cur_pos, bytes_to_send++); ....
** The above is only one instance of how I use the array. Other calls stuff different data in to the array.
Everything appears to work correctly, in that I can see the data that's stuffed into it at one end, and read the same data back on the other end when it gets received.
The array is declared as volatile because it also gets updated in the Wire.onRequest ISR
Should I not worry about declaring it as volatile as I do update the buffer in my main code as well?
I have another byte array, also volatile, for the receive portion. Similarly, there are warnings for that one as well.