How to output in file uchar? [closed] - c++

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have array of unsigned char[128] = {0xFF, 0xBE,...0x99};. And need to output it to .txt or .bin file. But all fuctions that I tried could work only with const char*.
So, what should I use to output uchar[]?
I tried fstream and QFile.
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
static uchar headerFile[128] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //1
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //2
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //3
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //4
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //5
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //6
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //7
0xFF, 0xFF, 0x47, 0x01, 0x84, 0x75, 0x00, 0x00, 0x39, 0xC2, 0x3A, 0xBE, 0xC3, 0x72, 0xC4, 0x71,}; //8
int main()
{
QFile out("D:/DataOutput.bin");
if( out.open( QIODevice::WriteOnly ) ) {
out.write(&headerFile[0],128);
}
}
UPD: Delete loop.

This should work:
if (out.open(QIODevice::WriteOnly)) {
out.write(reinterpret_cast<const char*>(&headerFile[0]), 128);
}

Related

Receiving packets in Arduino

I have a sender that has a bitmap array that represents an image I've downloaded. The sender sends the pixels to the receiver, which the receiver should receive. I need to insert them into another bitmap array and display the picture.
Below is my sender sketch:
static const unsigned char PROGMEM myBitmap[] ={
0x00, 0x00, 0x00, 0x00, 0x11, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x21, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xc7, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc1, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xe3, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x31, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xf2, 0x71, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x11, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x31, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xf8, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x31, 0xff, 0xff, 0xc0, 0x3f, 0xff, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x71, 0xff, 0xff, 0xe0, 0x1f, 0xff, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x71, 0xff, 0xff, 0xf0, 0x07, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf3, 0xff, 0xff, 0xf0, 0x03, 0xef, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xff, 0xf0, 0x03, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xff, 0xf8, 0x01, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xff, 0xf0, 0x00, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xff, 0xe0, 0x00, 0x7f, 0x8f, 0xf8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xff, 0x80, 0x00, 0x7f, 0x0f, 0xf8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf9, 0xfe, 0xff, 0x80, 0x00, 0x3c, 0x0f, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xfe, 0xff, 0xc0, 0x00, 0x10, 0x0f, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xfe, 0xff, 0xc0, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xfe, 0xff, 0xc0, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xfe, 0x7f, 0xe0, 0x00, 0x00, 0x1f, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xfe, 0x7f, 0xff, 0x38, 0x00, 0xdf, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xfe, 0x7f, 0xff, 0xf8, 0x01, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xfe, 0x7f, 0xff, 0xf0, 0x07, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xfe, 0x3f, 0xff, 0xe0, 0x1c, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0x3f, 0xff, 0xc0, 0x39, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0x3f, 0xff, 0x80, 0x3f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0x3f, 0xff, 0x00, 0x3f, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xff, 0xfe, 0x00, 0x1f, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xff, 0xfc, 0x00, 0x1f, 0xf8, 0x0f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xff, 0xf8, 0x70, 0x1f, 0xf8, 0x0f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xff, 0xf0, 0xf8, 0x7f, 0xf8, 0x07, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xff, 0xf1, 0xfc, 0xff, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xfd, 0xff, 0xe3, 0xdc, 0xff, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xff, 0xe7, 0xdc, 0xff, 0xe0, 0x38, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xff, 0xcf, 0xdc, 0xff, 0xe0, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf9, 0xff, 0xff, 0xde, 0x0c, 0x7f, 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf9, 0xff, 0xff, 0xbf, 0x1e, 0x7d, 0xe3, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf9, 0xff, 0xff, 0xbf, 0x1e, 0xff, 0xc7, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf9, 0xff, 0xff, 0x7f, 0xbe, 0xff, 0xc7, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xcf, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xdf, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xfb, 0xff, 0xf8, 0xff, 0x9f, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xe7, 0xff, 0xff, 0xff, 0x8f, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xef, 0xff, 0xfb, 0xff, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xef, 0xff, 0xff, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf9, 0xff, 0xef, 0xff, 0xf3, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf9, 0xff, 0xff, 0xff, 0xe3, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, 0xff, 0xff, 0xf3, 0xfe, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xf8, 0x7f, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf9, 0xff, 0xff, 0xff, 0xf8, 0x3f, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xb8, 0xff, 0xff, 0xff, 0xf0, 0x0f, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xb9, 0xff, 0xff, 0xff, 0xf8, 0x0f, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x99, 0xff, 0xff, 0xff, 0xf8, 0x07, 0xfc, 0x3f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xd9, 0xff, 0xff, 0xff, 0xfc, 0x06, 0xfc, 0x3f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xd8, 0xff, 0xff, 0xff, 0xfc, 0x07, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xd8, 0xff, 0xff, 0xff, 0xfc, 0x03, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xd8, 0xff, 0xff, 0xff, 0xfe, 0x03, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xd8, 0xff, 0xff, 0xff, 0xfe, 0x03, 0xf8, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xd9, 0xff, 0xff, 0xff, 0xff, 0x01, 0xf8, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xd9, 0xff, 0xff, 0xff, 0xff, 0x01, 0xf9, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xd8, 0xff, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc8, 0xff, 0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc9, 0xff, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00
};
void setup() {
//initialize Serial Monitor
Serial.begin(115200);
while (!Serial);
Serial.println("LoRa Sender");
//set up LoRa transceiver module
LoRa.setPins(ss, rst, dio0);
//replace the LoRa.begin(---E-) argument with your location's frequency
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
while (!LoRa.begin(915E6)) {
Serial.println(".");
delay(500);
}
// Change sync word (0xF3) to match the receiver
// The sync word assures you don't get LoRa messages from other LoRa transceivers
// ranges from 0-0xFF
LoRa.setSyncWord(0xF3);
Serial.println("LoRa Initializing OK!");
}
void loop() {
LoRa.beginPacket();
Serial.print("Sending packet");
LoRa.printf("0x%02x\n",myBitmap[i]);
i=i+1;
LoRa.endPacket();
ID=ID+1;
Below is my receiver sketch:
void setup() {
//initialize Serial Monitor
Serial.begin(115200);
while (!Serial);
Serial.println("LoRa Receiver");
//setup LoRa transceiver module
LoRa.setPins(ss, rst, dio0);
//replace the LoRa.begin(---E-) argument with your location's frequency
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
while (!LoRa.begin(915E6)) {
Serial.println(".");
delay(500);
}
// Change sync word (0xF3) to match the receiver
// The sync word insures you don't get LoRa messages from other LoRa transceivers
// ranges from 0-0xFF
LoRa.setSyncWord(0xF3);
Serial.println("LoRa Initializing OK!");
}
void loop() {
char buff[4]={0};
char c;
// try to parse packet
static unsigned char PROGMEM myBitmap [200]={};
int packetSize = LoRa.parsePacket();
uint8_t ix = 0;
if (packetSize) {
char buff[4] = {0};
while (LoRa.available()) {
Serial.print("this is the data");
buff[ix]=(char)LoRa.read();
}
Serial.print("this is the string\n");
Serial.print(finall);
// print RSSI of packet
Serial.print("' with RSSI ");
Serial.println(LoRa.packetRssi());
}
}
The problem that is on the receiver, I am unable to create an array, put the pixels that are successfully sent from the sender in it.
Any help would be appreciated. Thank you.
Your message-reading loop doesn't increment the index counter:
buff[ix]=(char)LoRa.read();
should be
buff[ix++]=(char)LoRa.read();
In case there may be more than 255 chars in one read, I'd declare ix at least 16-bit:
uint16_t ix = 0;
Also, you are declaring buff twice.
Also, to be safe, are you sure 4 bytes is enough?
There are two issues in your code:
In your receiver code, buff[ix]=(char)LoRa.read(); never increments ix.
You cannot send 1,024 bytes of data. The LoRa chip's buffer is 256 bytes long.
The second point means that you need to split your array in smaller pieces, and implement a transfer protocol with a few key elements:
Frame counter
Data
Checksum
When the sender is done sending a frame – say 128 bytes – the receiver decodes the frame, saves it, and sends back an ACK of some sort, eg ACK xx yy zz nn where xx is the counter, yy zz the checksum, and nn the number of bytes received. If the sender agrees with that, it moves on the next frame. If not, it either retries, or sends a FAIL signal.
If you mean you don't know how to create an array, you can first make your program send the size of the array and do dynamic memory allocation.
unsigned char *arr = malloc(size);
Then you can copy the received buffer to here

How to copy X bytes or bits from an __m128i into standard memory

I have a loop that's adding int16s from two arrays together via _mm_add_epi16(). There's a small array and a large array, the results get written back to the large array.
The intrinsic may get less than 8x int16s (128 bits) from the small array if it's reached its end - how do I store the results of _mm_add_epi16() back into standard memory int16_t* when I don't want all of its 128 bits? Padding the array to power-of-two is not an option. Example:
int16_t* smallArray;
int16_t* largeArray;
__m128i inSmallArray = _mm_load_si128((__m128i*)smallArray);
__m128i* pInLargeArray = (__m128i*)largeArray;
__m128i inLargeArray = _mm_load_si128(pInLargeArray);
inLargeArray = _mm_add_epi16(inLargeArray, inSmallArray);
_mm_store_si128(pInLargeArray, inLargeArray);
My guess is that I need to substitute _mm_store_si128() with a "masked" store somehow.
There is a _mm_maskmoveu_si128 intrinsic, which translates to maskmovdqu (in SSE) or vmaskmovdqu (in AVX).
// Store masks. The highest bit in each byte indicates the byte to store.
alignas(16) const unsigned char masks[16][16] =
{
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00 },
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00 },
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00 },
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 }
};
void store_n(__m128i mm, unsigned int n, void* storage)
{
assert(n < 16u);
_mm_maskmoveu_si128(mm, reinterpret_cast< const __m128i& >(masks[n]), static_cast< char* >(storage));
}
The problem with this code is that maskmovdqu (and, presumably, vmaskmovdqu) instructions have an associated hint for non-temporal access to the target memory, which makes the instruction expensive and also requires a fence afterwards.
AVX adds new instructions vmaskmovps/vmaskmovpd (and AVX2 also adds vpmaskmovd/vpmaskmovq), which work similarly to vmaskmovdqu but do not have the non-temporal hint and only operate on 32 and 64-bit granularity.
// Store masks. The highest bit in each 32-bit element indicates the element to store.
alignas(16) const unsigned char masks[4][16] =
{
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00 }
};
void store_n(__m128i mm, unsigned int n, void* storage)
{
assert(n < 4u);
_mm_maskstore_epi32(static_cast< int* >(storage), reinterpret_cast< const __m128i& >(masks[n]), mm);
}
AVX-512 adds masked stores, and you could use vmovdqu8/vmovdqu16 with an appropriate mask to store 8 or 16-bit elements.
void store_n(__m128i mm, unsigned int n, void* storage)
{
assert(n < 16u);
_mm_mask_storeu_epi8(storage, static_cast< __mmask16 >((1u << n) - 1u), mm);
}
Note that the above requires AVX-512BW and VL extensions.
If you require 8 or 16-bit granularity and don't have AVX-512 then you're better off with a function that manually stores the vector register piece by piece.
void store_n(__m128i mm, unsigned int n, void* storage)
{
assert(n < 16u);
unsigned char* p = static_cast< unsigned char* >(storage);
if (n >= 8u)
{
_mm_storel_epi64(reinterpret_cast< __m128i* >(p), mm);
mm = _mm_unpackhi_epi64(mm, mm); // move high 8 bytes to the low 8 bytes
n -= 8u;
p += 8;
}
if (n >= 4u)
{
std::uint32_t data = _mm_cvtsi128_si32(mm);
std::memcpy(p, &data, sizeof(data)); // typically generates movd
mm = _mm_srli_si128(mm, 4);
n -= 4u;
p += 4;
}
if (n >= 2u)
{
std::uint16_t data = _mm_extract_epi16(mm, 0); // or _mm_cvtsi128_si32
std::memcpy(p, &data, sizeof(data));
mm = _mm_srli_si128(mm, 2);
n -= 2u;
p += 2;
}
if (n > 0u)
{
std::uint32_t data = _mm_cvtsi128_si32(mm);
*p = static_cast< std::uint8_t >(data);
}
}

Convert String to Const Char XYZ[] PROGMEM {}

How to convert a String to Const Char XYZ[] PROGMEM?
Specific issue:
I am working on Arduino + OLED project (using the squix library) in which I am displaying image defined by WiFi_Logo_bits[] using the following code
void drawImageDemo() {
display.drawXbm(0, 0, WiFi_Logo_width, WiFi_Logo_height, WiFi_Logo_bits); // variables are defined below
}
Everything works as it as, but now I want to dynamically get the image data from internet and store in WiFi_Logo_bits[]. I am successfully able to retrieve the data for ex: {0xFE, 0xDE, 0x01......} as String, but cannot assign the value to WiFi_Logo_bits[] PROGMEM as I am having problem with datatypes conversion.
Variables above are defined as below:
#define WiFi_Logo_width 119
#define WiFi_Logo_height 63
const char WiFi_Logo_bits[] PROGMEM = {
0xF2, 0xFF, 0xE7, 0xFF, 0xFF, 0xFE, 0x1F, 0x04, 0x91, 0xF8, 0x01, 0x00,
0x00, 0x00, 0x00, 0xF2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x04, 0x91,
0xF0, 0x03, 0x00, 0x00, 0x10, 0x00, 0xF2, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F,
0x0C, 0x86, 0x81, 0xF8, 0x00, 0x00, 0x00, 0x10, 0x00, 0xE3, 0xFF, 0xFF,
0xFF, 0xFF, 0x17, 0x04, 0x83, 0xE4, 0xF9, 0x06, 0x00, 0x00, 0x00, 0x00,
0xE1, 0xFF, 0xFD, 0xFF, 0xFF, 0x01, 0x82, 0xC0, 0xC9, 0xF8, 0x04, 0x00,
0x00, 0x00, 0x00, 0xD0, 0xFF, 0xFB, 0xFF, 0xBF, 0x00, 0x40, 0xE0, 0x20,
0xFA, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE2, 0xFF, 0xFF, 0xFF, 0x1D, 0x20,
0x20, 0xE0, 0x70, 0xFC, 0x09, 0x00, 0x00, 0x00, 0x40, 0xFC, 0xFF, 0x7B,
0xFF, 0x0B, 0x00, 0x18, 0x70, 0x14, 0xF9, 0x04, 0x00, 0x00, 0x00, 0x00,
0xFE, 0xFF, 0x9F, 0xBF, 0x02, 0x00, 0x04, 0x18, 0xB1, 0xF8, 0x6C, 0x00,
0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xDF, 0x01, 0x04, 0x02, 0x86, 0x88,
0xFB, 0x3E, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x9F, 0x00, 0x00,
0xC1, 0x01, 0x3A, 0x60, 0x1E, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF,
0x1F, 0x00, 0xC1, 0x20, 0xA0, 0x42, 0x72, 0x0E, 0x00, 0x00, 0x00, 0x00,
0xFE, 0xFF, 0xB7, 0x9F, 0x00, 0x40, 0x10, 0xB0, 0x61, 0xF4, 0x8E, 0x00,
0x00, 0x00, 0x00, 0xFC, 0xFF, 0xE7, 0x2F, 0x00, 0x30, 0x08, 0x0A, 0x05,
0x01, 0x8E, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xFD, 0x0F, 0x00, 0x18,
0x8C, 0x02, 0x87, 0x66, 0x1F, 0x03, 0x00, 0x00, 0x00, 0xBF, 0xFF, 0xFF,
0x1F, 0x00, 0x08, 0x03, 0x80, 0xAE, 0x24, 0x3E, 0x0F, 0x00, 0x00, 0x20,
0xBF, 0x7F, 0xFF, 0x2D, 0x00, 0x04, 0x83, 0x80, 0x8D, 0x24, 0xBF, 0x1B,
0x00, 0xA0, 0x14, 0x9F, 0xFF, 0xBE, 0x03, 0x00, 0x82, 0x61, 0x70, 0xA2,
0x25, 0xFE, 0xB5, 0x00, 0x10, 0x63, 0xFF, 0x2F, 0xFE, 0x05, 0x00, 0x83,
0x10, 0x0C, 0x54, 0x51, 0xFE, 0x63, 0x00, 0x00, 0x00, 0xFF, 0x83, 0xCF,
0x11, 0x80, 0x41, 0x00, 0x02, 0xDA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 0xFF, 0xFF, 0xFF, 0xBF, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x60, 0x1B, 0x1C, 0x70, 0x16, 0xFE, 0xFF, 0xFF, 0x7F, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xA8, 0x0A, 0x0E, 0x78, 0x04, 0xFC, 0xFF,
0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x28, 0x0E, 0x78,
0x4D, 0xF4, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0,
0x8A, 0x07, 0x7C, 0x4C, 0xF8, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x40, 0x91, 0x03, 0x21, 0x90, 0xFD, 0xFF, 0xFF, 0xFF, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x95, 0x83, 0x1A,};
The PROGMEM type modifier tells the compiler the array values should be put into flash memory - that makes the variable not only logically const, but also even physically (even if your program would allow modifying the const variable, it couldn't, because flash can't simply be written to like other memory. It would need to re-flash the device on the fly)
The short answer is: If something is declared const PROGMEM, you cannot change it.
In theory you can modify PROGMEM, but:
It must be stored in one flash memory block (it must be erased and programmed as block)
It can't be erased/programmed from regular program sections but from bootloader section (doesn't apply for most ATTinys as they don't have bootloader section). This requires your own bootloader to support it.
Or you can use EEPROM to store this array:
It is not such a big problem to change it. It just needs similar functions to read/write EEMEM variables.
But draw methods in the library are pretty much relying on PROGMEM, so you have to write your own drawXbm function (method if you extend current library).

Getting wxImage in a panel

I've a problem to get a wxImage into a wxPanel.
I want to create a .exe with some pics in the exe, but I want to avoid to give the PNG-Pics with the exe.
So far, I get the PNGs into the exe with this:
wxStaticBitmap *image = new wxStaticBitmap(p_img, wxID_ANY,
wxBitmap("Bild.png", wxBITMAP_TYPE_PNG),
wxPoint(0,0),
wxSize(width, height);
where p_img ist the panel and Bild.png the picture.
Now, I have followed http://wiki.wxwidgets.org/WxImage And have now a wxImage... But I don't know how I can get the wxImage in the panel.
wxMemoryInputStream istream1(Bild_png, sizeof Bild_png);
wxImage Bild_png(istream1, wxBITMAP_TYPE_PNG);
I hope somebody has a idea.
-Casisto
My System:
OS: Win 8.1; wxW 2.9.4; IDE: CodeLite5.1
You can pass wxImage into wxBitmap constructor (wxBitmap Class Reference):
wxBitmap(const wxImage &img, int depth=wxBITMAP_SCREEN_DEPTH)
And then you can create wxStaticBitmap. So the code would be something like that:
wxImage Bild_png(istream1, wxBITMAP_TYPE_PNG);
wxStaticBitmap *staticBitmap = new wxStaticBitmap(p_img, wxID_ANY, wxBitmap(Bild_png));
As I understand you want to use the images and do not want to ship with exe as a physical files on the file system.
For Windows platform resource only Dll can be used. If you want cross platform you can use following technique:
Convert your PNG file to C++ style array.
And use this C++ array to create wxImage object.
You can download the application to get C++ array from:
http://sourceforge.net/projects/png2cscc/
you will get C++ array like below and put this array in some source file of your project.
static const unsigned int the_sizeof_swdXW_bytes = 2304 ;
static const unsigned char the_swdXW_bytes[ the_sizeof_swdXW_bytes ] =
{
0xED, 0xF8, 0xFC, 0xFF, 0xEB, 0xF4, 0xF9, 0xFF, 0xEF, 0xF3, 0xFC, 0xFF, 0xF4, 0xF7, 0xFF, 0xFF,
0xF7, 0xF7, 0xFF, 0xFF, 0xEE, 0xF1, 0xFA, 0xFF, 0xEB, 0xF0, 0xF6, 0xFF, 0xF1, 0xF9, 0xFC, 0xFF,
0xEE, 0xF8, 0xFA, 0xFF, 0xED, 0xF6, 0xF5, 0xFF, 0xEC, 0xF2, 0xF2, 0xFF, 0xE6, 0xEA, 0xE9, 0xFF,
0xE1, 0xE3, 0xE2, 0xFF, 0xDC, 0xE0, 0xDF, 0xFF, 0xDC, 0xE0, 0xE1, 0xFF, 0xD8, 0xDD, 0xD9, 0xFF,
0xD0, 0xD1, 0xC9, 0xFF, 0xE2, 0xE2, 0xD6, 0xFF, 0xB4, 0xB1, 0xA8, 0xFF, 0x81, 0x7E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0xFF, 0xB2, 0xB1, 0xAC, 0xFF,
0xAB, 0xA7, 0xA4, 0xFF, 0x8D, 0x89, 0x88, 0xFF, 0x3E, 0x3C, 0x3D, 0xFF, 0x6E, 0x6D, 0x72, 0xFF,
0x41, 0x40, 0x46, 0xFF, 0x14, 0x14, 0x1C, 0xFF, 0x13, 0x15, 0x21, 0xFF, 0x16, 0x18, 0x24, 0xFF,
0x11, 0x13, 0x1F, 0xFF, 0x16, 0x18, 0x24, 0xFF, 0x11, 0x14, 0x1D, 0xFF, 0x16, 0x19, 0x22, 0xFF,
0x15, 0x1A, 0x20, 0xFF, 0x11, 0x14, 0x19, 0xFF, 0x10, 0x10, 0x12, 0xFF, 0x2B, 0x23, 0x20, 0xFF,
0x7E, 0x67, 0x61, 0xFF, 0x85, 0x6E, 0x68, 0xFF, 0x6B, 0x5F, 0x5F, 0xFF, 0xCB, 0xC5, 0xC9, 0xFF
};

trouble reading structure from stream, or bytes rather

I'm trying to read a LAS File 1.3 Header from a file.
In every single header that I've seen, The first thing i expect to read is the Format Signature which is always "LASF".
When i try and read the file, All I'm seeing is 'ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ'
I know the header size is 227, I tried to even just read a length of 227 straight from the file but i still don't read what I'm supposed to. I hope this makes sense.
this is what i've tried:
typedef struct Header
{
char File_Signature[4];
USHORT SourceID;
USHORT Reserved1;
UINT GUID1;
USHORT GUID2;
USHORT GUID3;
char GUID4[8];
BYTE VersionMajor;
BYTE VersionMinor;
char SystemID[32];
char GeneratingSoftware[32];
USHORT DOY;
USHORT YEAR;
USHORT HeaderSize;
UINT PointOffset;
INT NumberOfVariableLengthRecords;
BYTE PointDataFormatID;
USHORT PointDataRecordLength;
INT NumberOfPointRecords;
UINT NumberofPointsByReturn1;
UINT NumberofPointsByReturn2;
UINT NumberofPointsByReturn3;
UINT NumberofPointsByReturn4;
UINT NumberofPointsByReturn5;
double XScaleFactor;
double YScaleFactor;
double ZScaleFactor;
double Xoffset;
double Yoffset;
double Zoffset;
double MaxX;
double MinX;
double MaxY;
double MinY;
double MaxZ;
double MinZ;
} LasHeader;
void OpenLasFile()
{
//THIS DOES NOT WORK
char buffer[227];
ifstream myFile ("C:\atlass\area_cov.las");
myFile.read (buffer, 227);
//NOT WORK, TRIED THIS TOO
ifstream input_file("C:\atlass\area_cov.las", ios::binary);
LasHeader header;
input_file.read((char*)&header, sizeof(header));
input_file.close();
//ALL DATA OUTPUT'ed ARE 'ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ'
}
This is a block of binary from the file I'm trying to read.
4C4153460000000001000000020003003132333435363738010241746C6173732041746C6173436F72652020202020202020202020202020202041746C6173436F726520202020202020202020202020202020202020202020201E01DC07E300E300000000000000011C0014012F0014012F0000000000000000000000000000000000FCA9F1D24D62503FFCA9F1D24D62503FFCA9F1D24D62503F00000000B05320410000000024FF53410000000000000000E7B3FA8388A920411B5611E9BC1B20417710D27C2711544114A5EC807EF45341C520B072685D684037894160E5D012C021BE92FF06661701A9600000D803C902E2000100AC7136BDE325044137
My question is: Why am i Reading garbage values, what have i done wrong?
-------------------- UPDATE --------------------------
I tested this and it worked, So it must be a problem reading the file, can anyone help?
what worked was:
unsigned char rawData[552] =
{
0x4C, 0x41, 0x53, 0x46, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x01, 0x02, 0x41, 0x74, 0x6C, 0x61, 0x73, 0x73,
0x20, 0x41, 0x74, 0x6C, 0x61, 0x73, 0x43, 0x6F, 0x72, 0x65, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x41, 0x74, 0x6C, 0x61, 0x73, 0x43,
0x6F, 0x72, 0x65, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1E, 0x01, 0xDC, 0x07, 0xE3, 0x00,
0xE3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1C, 0x00, 0x14, 0x01, 0x2F, 0x00, 0x14,
0x01, 0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFC, 0xA9, 0xF1, 0xD2, 0x4D, 0x62, 0x50, 0x3F, 0xFC, 0xA9, 0xF1, 0xD2, 0x4D,
0x62, 0x50, 0x3F, 0xFC, 0xA9, 0xF1, 0xD2, 0x4D, 0x62, 0x50, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xB0,
0x53, 0x20, 0x41, 0x00, 0x00, 0x00, 0x00, 0x24, 0xFF, 0x53, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xE7, 0xB3, 0xFA, 0x83, 0x88, 0xA9, 0x20, 0x41, 0x1B, 0x56, 0x11, 0xE9, 0xBC,
0x1B, 0x20, 0x41, 0x77, 0x10, 0xD2, 0x7C, 0x27, 0x11, 0x54, 0x41, 0x14, 0xA5, 0xEC, 0x80, 0x7E,
0xF4, 0x53, 0x41, 0xC5, 0x20, 0xB0, 0x72, 0x68, 0x5D, 0x68, 0x40, 0x37, 0x89, 0x41, 0x60, 0xE5,
0xD0, 0x12, 0xC0, 0x21, 0xBE, 0x92, 0xFF, 0x06, 0x66, 0x17, 0x01, 0xA9, 0x60, 0x00, 0x00, 0xD8,
0x03, 0xC9, 0x02, 0xE2, 0x00, 0x01, 0x00, 0xAC, 0x71, 0x36, 0xBD, 0xE3, 0x25, 0x04, 0x41, 0x37,
0xB9, 0x92, 0xFF, 0x77, 0x58, 0x17, 0x01, 0xD7, 0x60, 0x00, 0x00, 0xE2, 0x0A, 0xC9, 0x02, 0xE2,
0x00, 0x01, 0x00, 0x4B, 0x90, 0x11, 0x90, 0xE3, 0x25, 0x04, 0x41, 0x00, 0xBF, 0x92, 0xFF, 0x98,
0x3A, 0x17, 0x01, 0x2B, 0x62, 0x00, 0x00, 0x23, 0x0A, 0x49, 0x02, 0xE4, 0x00, 0x01, 0x00, 0xBF,
0xF5, 0x61, 0xBD, 0xE3, 0x25, 0x04, 0x41, 0x1A, 0xBD, 0x92, 0xFF, 0x30, 0x11, 0x17, 0x01, 0xE4,
0x62, 0x00, 0x00, 0xDF, 0x08, 0x49, 0x02, 0xE4, 0x00, 0x01, 0x00, 0xF8, 0x6E, 0xF3, 0xA6, 0xE3,
0x25, 0x04, 0x41, 0x01, 0xBE, 0x92, 0xFF, 0x67, 0xE7, 0x16, 0x01, 0x83, 0x63, 0x00, 0x00, 0xCB,
0x06, 0x49, 0x02, 0xE5, 0x00, 0x01, 0x00, 0x0B, 0xF3, 0x1E, 0xA7, 0xE3, 0x25, 0x04, 0x41, 0xF2,
0xBB, 0x92, 0xFF, 0x99, 0xD9, 0x16, 0x01, 0x6D, 0x63, 0x00, 0x00, 0x03, 0x09, 0x49, 0x02, 0xE5,
0x00, 0x01, 0x00, 0x82, 0x1C, 0x94, 0x90, 0xE3, 0x25, 0x04, 0x41, 0xFA, 0xBE, 0x92, 0xFF, 0x98,
0xBE, 0x16, 0x01, 0x13, 0x63, 0x00, 0x00, 0xFF, 0x08, 0x49, 0x02, 0xE5, 0x00, 0x01, 0x00, 0xE5,
0xF0, 0x49, 0xA7, 0xE3, 0x25, 0x04, 0x41, 0xEE, 0xBC, 0x92, 0xFF, 0xDE, 0xB0, 0x16, 0x01, 0x04,
0x63, 0x00, 0x00, 0x8E, 0x0B, 0x49, 0x02, 0xE5, 0x00, 0x01, 0x00, 0x95, 0xA0, 0xBF, 0x90, 0xE3,
0x25, 0x04, 0x41, 0xD2, 0xBD, 0x92, 0xFF, 0x19, 0x88, 0x16, 0x01, 0xA9, 0x63, 0x00, 0x00, 0xD1,
0x08, 0x49, 0x02, 0xE7, 0x00, 0x01, 0x00, 0xA7, 0x24, 0xEB, 0x90, 0xE3, 0x25, 0x04, 0x41, 0xA8,
0xBE, 0x92, 0xFF, 0x29, 0x64, 0x16, 0x01, 0x97, 0x63, 0x00, 0x00, 0xFD, 0x04, 0x49, 0x02, 0xE7,
0x00, 0x01, 0x00, 0xC4, 0xF0, 0x11, 0x91, 0xE3, 0x25, 0x04, 0x41, 0x79, 0xD0, 0x92, 0xFF, 0xD0,
0x70, 0x17, 0x01, 0x30, 0x61, 0x00, 0x00, 0x60, 0x02, 0xC9, 0x02, 0xE2, 0x00, 0x01, 0x00, 0x91,
0x65, 0xC1, 0x44, 0xE4, 0x25, 0x04, 0x41, 0x12, 0xC7, 0x92, 0xFF, 0x02, 0x5E, 0x17, 0x01, 0x79,
0x61, 0x00, 0x00, 0x79, 0x05, 0xC9, 0x02, 0xE2,
} ;
LasHeader test;
memcpy(&test, rawData, sizeof(test));
The issue is here:
ifstream myFile ("C:\atlass\area_cov.las");
Backslash is a special character in C strings that forms escape sequences. In this particular case, \a is replaced by a bell character (0x0B), so it is trying to open the wrong path and failing.
Instead, you need to escape all the backslashes that occur in the path by doubling them:
ifstream myFile ("C:\\atlass\\area_cov.las");