Code from this link: https://github.com/openwch/arduino_core_ch32/blob/main/libraries/USBPD_SINK/src/usbpd_def.h
I am looking at the previous file. I did some search and found something about unsign int literal. However, I am not sure how it would make sense in this case and hope someone can explain it to me.
typedef struct { uint32_t MaxOperatingCurrent10mAunits : 10u; uint32_t OperatingCurrentIn10mAunits : 10u; uint32_t Reserved20_21 : 2u; // 00b uint32_t EPRModeCapable : 1u; uint32_t UnchunkedExtendedMessage : 1u; uint32_t NoUSBSuspend : 1u; uint32_t USBCommunicationsCapable : 1u; uint32_t CapabilityMismatch : 1u; uint32_t GiveBackFlag : 1u; uint32_t ObjectPosition : 4u; }USBPD_SinkFixedVariableRDO_t; Is this struct has the total size of 44 bytes assume 32bits padding? And what is the 10u, 2u at at the end of each struct member?
10has the typeint, the value10uhas the typeunsigned int.uint32_t something : 10;say that the membersomethingare using10bits.uint32_t44 bytes is strange... BTW: My gues is that on most systems the size is 4 bytes. BTW: Notice how all the numbers add up to 32 (10 + 10 + 2 +...)