import ctypes

ICD1553_CRS_SLAVE_RNG_METERS_LSB = 8 * 0.3048  # 8 * GC_K_FEETS_TO_METERS

class CrsSlaveRange(ctypes.Union):
    _fields_ = [("raw", ctypes.c_uint16),
                ("acq_crs_rng", ctypes.c_uint16)]

    def get(self):
        return self.raw * ICD1553_CRS_SLAVE_RNG_METERS_LSB

    def set(self, value):
        self.raw = int(value / ICD1553_CRS_SLAVE_RNG_METERS_LSB)