我有一个结构:
typedef struct {
uint8_t month; // 1..12 [4 bits]
uint8_t date; // 1..31 [5 bits]
uint8_t hour; // 00..23 [5 bits]
uint8_t minute; // 00..59 [6 bits]
uint8_t second; // 00..59 [6 bits]
} TimeStamp;
Run Code Online (Sandbox Code Playgroud)
但我想打包它所以它只消耗4个字节而不是5个字节.
有没有办法改变位以创建更严格的结构?
它可能看起来不多,但是它会进入EEPROM,因此在4Kb页面中保存1个字节是额外的512个字节(我可以使用剩下的6个额外的其他东西).