NordicSemiconductor / zcbor

Low footprint C/C++ CBOR library and Python tool providing code generation from CDDL descriptions.
Apache License 2.0
118 stars 37 forks source link

How do I define uint16? #459

Open dwjbosman opened 1 month ago

dwjbosman commented 1 month ago

I have an array of 6000 uint16 elements

SampleValue = 0..65535

MeasurementResponse = [
    samples: [1*6000 SampleValue] 
]

The generated C code

struct MeasurementResponse {
    uint32_t SampleValue_m[6000];
    size_t uint_count;
};

Over the wire, this is encoded reasonbly compact. But in memory uint32_t is used. Is possible somehow to indicate in the CDDL that uint16_t is to be used?