//
// Copyright (c) 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using Antmicro.Renode.Core;
using Antmicro.Renode.Core.Structure;
using Antmicro.Renode.Core.Structure.Registers;
using Antmicro.Renode.Logging;
using Antmicro.Renode.Peripherals.Bus;
using Antmicro.Renode.Peripherals.Sensor;
using System;

namespace Antmicro.Renode.Peripherals.Sensors
{
    public class CamCtrl : IDoubleWordPeripheral, IKnownSize
    {
        public CamCtrl()
        {
            TriggerOut = new GPIO();
        }

        public void Reset()
        {
            TriggerOut.Unset();
        }

        public uint ReadDoubleWord(long offset)
        {
            return 0;
        }

        public void WriteDoubleWord(long offset, uint value)
        {
            TriggerOut.Set(Convert.ToBoolean(value));
        }

        public GPIO TriggerOut { get; }

        public long Size => 0x4;
    }
}
