V
V
veydlin2020-08-16 19:10:08
Python
veydlin, 2020-08-16 19:10:08

How to unpack bytes in Python?

I have this byte structure in C code

union Package {
    uint8 bytes[16];
    struct {
      float var1;
      double var2;
      int32 status;
    } __attribute__((packed)) info;
  };


I send it to raspberries via SPI, how to unpack this structure back in a more "beautiful" way?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question