You don't have to use those includes. The Arduino already includes them.
If you don't use the Arduino IDE, can you write that as comment in the top of the sketch ?
The struct is already a typedef. Once you have the type 'ui16s', then you don't need the keyword 'struct'.
When using the pointer to an element of an array, I prefer to stay close to the PROGMEM documentation en PROGMEM tutorial by Nick Gammon and use: & ( ci_vals [ i ] )
I think it is okay to assign the number 0 or 1 to a bitfield of only 1 bit.
That results into this:
struct ui16s {
uint16_t ui:16;
uint8_t scale:7;
uint8_t sign:1;
};
const uint8_t length = 6;
const uint16_t means[] PROGMEM = {
10, 20, 32, 29, 37, 28
};
const ui16s ci_vals[] PROGMEM = {
{10, 2, 0},
{20, 4, 1},
{32, 2, 1},
{11, 1, 0},
{15, 0, 1},
{24, 0, 0}
};
void setup() {
Serial.begin(9600);
for (uint8_t i = 0; i < length; ++i) {
ui16s val;
memcpy_P(&val, &(ci_vals[i]), sizeof(ui16s));
Serial.println(pgm_read_word(&(means[i])));
Serial.print(val.sign ? "-" : "");
Serial.print(val.ui);
Serial.print(" / 2 ^ ");
Serial.println(val.scale);
Serial.println();
}
}
void loop() {
}