#include "Printable.h"

struct STATUS : public Printable {
  uint8_t s0: 1;
  uint8_t s1: 1;
  uint8_t s2: 1;
  uint8_t s3: 1;
  uint8_t cnt: 4;

  virtual size_t printTo(Print & p) const {
    size_t charsPrinted = 0;
    charsPrinted = p.print(F("S0 = ")); charsPrinted += p.println(s0);
    charsPrinted += p.print(F("S1 = ")); charsPrinted += p.println(s1);
    charsPrinted += p.print(F("S2 = ")); charsPrinted += p.println(s2);
    charsPrinted += p.print(F("S3 = ")); charsPrinted += p.println(s3);
    return charsPrinted;
  }
};

STATUS status;

void setup() {
  Serial.begin(115200);
  delay(2000);
  status.s1 = 1;
  Serial.print(F("sizeof(status) = ")); Serial.println(sizeof(status));
  Serial.print(status);
}

void loop() {
  status.cnt++;
  Serial.println(status.cnt);
  
  delay(2000);
}