Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add STM32C0/G0/L0 ADC driver #94

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
3 changes: 3 additions & 0 deletions src/Emulator/Peripherals/Peripherals.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,10 @@
<Compile Include="Peripherals\Miscellaneous\LiteX_MMCM.cs" />
<Compile Include="Peripherals\Analog\EOSS3_ADC.cs" />
<Compile Include="Peripherals\Analog\STM32_ADC_Common.cs" />
<Compile Include="Peripherals\Analog\STM32C0_ADC.cs" />
<Compile Include="Peripherals\Analog\STM32F0_ADC.cs" />
<Compile Include="Peripherals\Analog\STM32G0_ADC.cs" />
<Compile Include="Peripherals\Analog\STM32L0_ADC.cs" />
<Compile Include="Peripherals\Analog\STM32WBA_ADC.cs" />
<Compile Include="Peripherals\Analog\Xilinx_XADC.cs" />
<Compile Include="Peripherals\Analog\STM32_ADC.cs" />
Expand Down
35 changes: 35 additions & 0 deletions src/Emulator/Peripherals/Peripherals/Analog/STM32C0_ADC.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// Copyright (c) 2010-2023 Antmicro
// Copyright (c) 2023 OS Systems
//
// This file is licensed under the MIT License.
// Full license text is available in 'licenses/MIT.txt'.
//

using Antmicro.Renode.Core;
using Antmicro.Renode.Peripherals.DMA;

namespace Antmicro.Renode.Peripherals.Analog
{
public class STM32C0_ADC : STM32_ADC_Common
{
public STM32C0_ADC(IMachine machine, double referenceVoltage, uint externalEventFrequency, int dmaChannel = 0, IDMA dmaPeripheral = null)
: base(
machine,
referenceVoltage,
externalEventFrequency,
dmaChannel,
dmaPeripheral,
// Base class configuration
watchdogCount: 3,
hasCalibration: true,
hasHighCalAddress: false,
channelCount: 23,
hasPrescaler: false,
hasVbatPin: false,
hasChannelSequence: true,
hasPowerRegister: false
)
{}
}
}
1 change: 1 addition & 0 deletions src/Emulator/Peripherals/Peripherals/Analog/STM32F0_ADC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public STM32F0_ADC(IMachine machine, double referenceVoltage, uint externalEvent
// Base class configuration
watchdogCount: 1,
hasCalibration: false,
hasHighCalAddress: false,
channelCount: 19,
hasPrescaler: false,
hasVbatPin: true,
Expand Down
35 changes: 35 additions & 0 deletions src/Emulator/Peripherals/Peripherals/Analog/STM32G0_ADC.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// Copyright (c) 2010-2023 Antmicro
// Copyright (c) 2023 OS Systems
//
// This file is licensed under the MIT License.
// Full license text is available in 'licenses/MIT.txt'.
//

using Antmicro.Renode.Core;
using Antmicro.Renode.Peripherals.DMA;

namespace Antmicro.Renode.Peripherals.Analog
{
public class STM32G0_ADC : STM32_ADC_Common
{
public STM32G0_ADC(IMachine machine, double referenceVoltage, uint externalEventFrequency, int dmaChannel = 0, IDMA dmaPeripheral = null)
: base(
machine,
referenceVoltage,
externalEventFrequency,
dmaChannel,
dmaPeripheral,
// Base class configuration
watchdogCount: 3,
hasCalibration: true,
hasHighCalAddress: false,
channelCount: 19,
hasPrescaler: true,
hasVbatPin: true,
hasChannelSequence: true,
hasPowerRegister: false
)
{}
}
}
35 changes: 35 additions & 0 deletions src/Emulator/Peripherals/Peripherals/Analog/STM32L0_ADC.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// Copyright (c) 2010-2023 Antmicro
// Copyright (c) 2023 OS Systems
//
// This file is licensed under the MIT License.
// Full license text is available in 'licenses/MIT.txt'.
//

using Antmicro.Renode.Core;
using Antmicro.Renode.Peripherals.DMA;

namespace Antmicro.Renode.Peripherals.Analog
{
public class STM32L0_ADC : STM32_ADC_Common
{
public STM32L0_ADC(IMachine machine, double referenceVoltage, uint externalEventFrequency, int dmaChannel = 0, IDMA dmaPeripheral = null)
: base(
machine,
referenceVoltage,
externalEventFrequency,
dmaChannel,
dmaPeripheral,
// Base class configuration
watchdogCount: 1,
hasCalibration: true,
hasHighCalAddress: false,
channelCount: 18,
hasPrescaler: true,
hasVbatPin: false,
hasChannelSequence: false,
hasPowerRegister: true
)
{}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public STM32WBA_ADC(IMachine machine, double referenceVoltage, uint externalEven
// Base class configuration
watchdogCount: 3,
hasCalibration: true,
hasHighCalAddress: true,
channelCount: 14,
hasPrescaler: true,
hasVbatPin: false,
Expand Down
Loading