import ctypes

ICD1553_SPOI_ALT_FEET_LSB = 1.0
GC_K_FEETS_TO_METERS = 0.3048  # Definizione di esempio, controlla il valore corretto
ICD1553_SPOI_ALT_METERS_LSB = ICD1553_SPOI_ALT_FEET_LSB * GC_K_FEETS_TO_METERS

class SpoiAltitude(ctypes.Union):
    _fields_ = [
        ("raw", ctypes.c_int16),
        ("spoi_baro_altitude", ctypes.c_int16),
        ]

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

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