----------------------------------------------------------------------------
--
--                              -*- Mode: Ada -*-
--
-- Filename        : Gyro.ads
-- Description     : All you need to operate the gyroscope
-- Author          : Uwe R. Zimmer
-- Created On      :
-- Last Modified By: Uwe R. Zimmer
-- Last Modified On:
-- Update Count    : Version 0.91
-- Status          : Beta
--
----------------------------------------------------------------------------

with Metrics;        use Metrics;
with Ada.Real_Time;  use Ada.Real_Time;

package Gyro is

----------------------------------------------------------------------------
--
-- Definitions for the Gyrodata
--
----------------------------------------------------------------------------

   type GyroTicksType is new Natural;

   type GyroReading  is record
                           AngularRateX,
                           AngularRateY,
                           AngularRateZ  : Speed_angular;
                           AccelerationX,
                           AccelerationY,
                           AccelerationZ : AccelG;
                           Temperature   : TemperatureC;
                           TimeStamp     : Time;
                           GyroTicks     : GyroTicksType;
                        end record;

   type GyroReadingArray is array (Positive range <>) of GyroReading;

----------------------------------------------------------------------------
--
--
--
----------------------------------------------------------------------------

   protected GyroInterface is

      procedure InitGyro;    -- Inits and Shutdowns can be recursively
      entry ShutdownGyro;    -- iterated (also from different tasks)

      entry GetCurrentGyroReading   (Reading      : out GyroReading);
      entry GetCurrentGyroTimeStamp (TimeStamp    : out Time);
      entry GetAllGyroDataSince     (TimeStamp    :  in Time;
                                     Readings     : out GyroReadingArray;
                                     NoOfReadings : out Natural);

      entry WaitforNewGyroData;

      entry SuspendSensing;   -- due to the laserhandling is time consuming,
      entry ResumeSensing;    -- the driver task can be suspended

   end GyroInterface;

end Gyro;