Partial extended multiplexing support
Should somewhat support SG_MUL_VAL_s.
I included an example dbc so you can generate the code and see what comes out.
Looks like a good start, the generated code is not properly indented and does not match the style of the other code. The logical wrong values needs some work as well. In the rest of the messages if there is an error condition the check is performed and we immediately return, eliminating the need for the wrong value temporary variables.
The indentation should now be fixed.
What should I do in this case to remove wrong value variable?
bool wrong_value_muxed_muxer = true;
if (o->can_0x692_extended_multiplex.muxed_muxer == 1) {
wrong_value_muxed_muxer = false;
/* muxed1: start-bit 32, length 32, endianess intel, scaling 1, offset 0 */
x = ((uint32_t)(o->can_0x692_extended_multiplex.muxed1)) & 0xffffffff;
x <<= 32;
i |= x;
}
if (o->can_0x692_extended_multiplex.muxed_muxer == 4) {
wrong_value_muxed_muxer = false;
/* muxed2: start-bit 32, length 32, endianess intel, scaling 1, offset 0 */
x = ((uint32_t)(o->can_0x692_extended_multiplex.muxed2)) & 0xffffffff;
x <<= 32;
i |= x;
}
if(wrong_value_muxed_muxer) {
return -1;
}
Is this acceptable or would you rather I implement it differently?
if (o->can_0x692_extended_multiplex.muxed_muxer == 1) {
/* muxed1: start-bit 32, length 32, endianess intel, scaling 1, offset 0 */
x = ((uint32_t)(o->can_0x692_extended_multiplex.muxed1)) & 0xffffffff;
x <<= 32;
i |= x;
} else if (o->can_0x692_extended_multiplex.muxed_muxer == 4) {
/* muxed2: start-bit 32, length 32, endianess intel, scaling 1, offset 0 */
x = ((uint32_t)(o->can_0x692_extended_multiplex.muxed2)) & 0xffffffff;
x <<= 32;
i |= x;
} else {
return -1;
}
The if...else if...else chain is acceptable, also a switch statement would be fine as well.
In that case it should be already implemented. Do you want me to squash the commits? (At least the ones about multiplexing)
Looks good, no need to squash, I'm not too fussed about that.