So I have a C struct like this below
struct spi_header
{
u8 SpiCmd :5;
u8 channel :1;
u8 kac :2;
};
which I need to use in python, so I tried using dictionary for this, as shown below
spi_header = { 'SpiCmd': , 'channel': , 'kac': }
I tried assigning range for the members like 'SpiCmd' : (0:5)
trying to split the bytes into the range specified in the C structure. But I get syntax error. I know it is, because the range can't be specified (5, 1, 2) like how I tried. So how do I write in python, can any help me with this?