Okay I am stupid and I got screwed up by pointer arithmetic because buffer is int16_t changed it to void*, worked flawlessly