> I suggest the following changes: > > for (int i = 0; i < ra->init_record_number; i++) { > a[r->init_offset16] = r->init_data16; // Write 16 bits > r++; > > > # define D16(p, r, v) { IF(init_data16) v, IF(init_offset16) (offsetof(p, > r)/2)} That would be the right choice for those peripherals that have 16 bit registers 16 bits apart. (Though I would still use pointer arithmetic even for a.) But IIRC, STM32F does not have such. IIRC, the 16 bit registers it has are 32 bits apart for all peripherals. At least the timers are so, with a sprinkle of 32 bit data registers for TIM2 (and some others in STM32F4). See the register maps. --Pekka