dzamlo / svd

Apache License 2.0
0 stars 0 forks source link

Merge similar field together #2

Closed dzamlo closed 8 years ago

dzamlo commented 8 years ago

Very similar field should be merged together.

For example, instead of:

value.set_MODER0(1);
value.set_MODER3(0);

It would be possible to use:

value.set_MODER(0, 1);
value.set_MODER(3, 0);
dzamlo commented 8 years ago

If there is only one group of fields for one register, it should somehow implement Index/IndexMut. So that you could do that:

let mut moder = STM32F7x7::GPIOB::read_MODER();
moder[0] = 1;
moder[3] = 0;
if moder[0] == 1 {
    // ...
},
dzamlo commented 8 years ago

The criteria to merge fields should be the following: