The protocol is:
(four byte hour/minute/second field, for example (12:13:56 110))
bit00~bit01: 00
bit02~bit11: millisecond (110)
bit12~bit15: second-1s (6)
bit16~bit18: second-10s (5)
bit19~bit22: minute-1s (3)
bit23~bit25: minute-10s (1)
bit26~bit29: hour-1s (2)
bit30~bit31: hour-10s (1)
How should I define the upper structure?
I've tried to define this:
struct xxx_time
{
unsigned int pad:2;
unsigned int second0:4;
unsigned int second1:3;
unsigned int minute0:4;
unsigned int minute1:3;
unsigned int hour:4;
unsigned int hour1:2;
};
Is it right to define it this way? Is there any better way?