       // custom registers for driver (aka "device 0")
       //
       switch (reg) {
+
+         // current free memory
+         //
          case IDX_REG_FREE_RAM:
-            if (pos == 0 && (len == 4 || len == 0)) {
-               *((uint32_t*) data) = freeRam();
-               return 4;
-            } else {
-               return SRDP_ERR_INVALID_REG_POSLEN;
-            }         
+            *((uint32_t*) data) = freeRam();
+            return 4;
+
          default:
             return SRDP_ERR_NO_SUCH_REGISTER;
       }

   } else {
      return SRDP_ERR_NO_SUCH_DEVICE;
   }
}


void log_message(void* userdata, const char* msg, int level) {
   Serial.println(msg);
}



int register_write(void* userdata, int dev, int reg, int pos, int len, const uint8_t* data) {

   if (dev == IDX_DEV) {

      switch (reg) {
         
         // LED 1 (red)
         // LED 2 (green)
         //
         case IDX_REG_LED1:
            digitalWrite(IDX_REG_LED1, data[0] ? HIGH : LOW);
            return 1;

         case IDX_REG_LED2:
            digitalWrite(IDX_REG_LED2, data[0] ? HIGH : LOW);
            return 1;

         // LED 3 (RGB)
         //
         case IDX_REG_LED3:
            led3.write(data[0], data[1], data[2]);
            return 3;

         // Poti 1/2, Button 1/2 : #watch
         //
         case IDX_REG_POT1_WATCH:
            pot1.setWatched(data[0] != 0);
            return 1;
         case IDX_REG_POT2_WATCH:
            pot2.setWatched(data[0] != 0);
            return 1;
         case IDX_REG_BTN1_WATCH:
            btn1.setWatched(data[0] != 0);
            return 1;
         case IDX_REG_BTN2_WATCH:
            btn2.setWatched(data[0] != 0);
            return 1;

         // Poti 1/2 : #max
         //
         case IDX_REG_POT1_MAX:
            pot1.scale(0, *((const uint16_t*) data));
            return 2;
         case IDX_REG_POT2_MAX:
            pot2.scale(0, *((const uint16_t*) data));
            return 2;

         // Poti 1/2 : #updateRate
         //
         case IDX_REG_POT1_URATE:
            pot1.setUpdateRate(*((const uint16_t*) data));
            return 2;
         case IDX_REG_POT2_URATE:
            pot2.setUpdateRate(*((const uint16_t*) data));
            return 2;

         case IDX_REG_BTN1:         
         case IDX_REG_BTN2:
