import ctypes

ICD1553_ACCELERATION_FEET_LSB = 0.03125
GC_K_METERS_TO_FEETS = 3.28084  # Definizione di esempio, controlla il valore corretto
ICD1553_ACCELERATION_METERS_LSB = ICD1553_ACCELERATION_FEET_LSB / GC_K_METERS_TO_FEETS

class Acceleration(ctypes.Union):
    _fields_ = [
        ("raw", ctypes.c_int16),
        ("longitudinal_acc", ctypes.c_int16),
        ("lateral_acc", ctypes.c_int16),
        ("normal_acc", ctypes.c_int16),
        ]

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

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