text
stringlengths 0
234
|
|---|
Result.SYSCLK := HSI_VALUE;
|
when 1 =>
|
-- HSE as source
|
Result.SYSCLK := HSE_VALUE;
|
when 2 =>
|
-- PLL as source
|
declare
|
HSE_Source : constant Boolean := RCC_Periph.PLLCFGR.PLLSRC;
|
Pllm : constant UInt32 :=
|
UInt32 (RCC_Periph.PLLCFGR.PLLM);
|
Plln : constant UInt32 :=
|
UInt32 (RCC_Periph.PLLCFGR.PLLN);
|
Pllp : constant UInt32 :=
|
(UInt32 (RCC_Periph.PLLCFGR.PLLP) + 1) * 2;
|
Pllvco : UInt32;
|
begin
|
if not HSE_Source then
|
Pllvco := HSI_VALUE;
|
else
|
Pllvco := HSE_VALUE;
|
end if;
|
Pllvco := Pllvco / Pllm;
|
Result.I2SCLK := Pllvco;
|
Pllvco := Pllvco * Plln;
|
Result.SYSCLK := Pllvco / Pllp;
|
Function Definition: procedure Disable
|
Function Body: (This : in out Digital_To_Analog_Converter;
|
Channel : DAC_Channel)
|
is
|
begin
|
case Channel is
|
when Channel_1 =>
|
This.CR.EN1 := False;
|
when Channel_2 =>
|
This.CR.EN2 := False;
|
end case;
|
end Disable;
|
-------------
|
-- Enabled --
|
-------------
|
function Enabled
|
(This : Digital_To_Analog_Converter;
|
Channel : DAC_Channel)
|
return Boolean is
|
begin
|
case Channel is
|
when Channel_1 =>
|
return This.CR.EN1;
|
when Channel_2 =>
|
return This.CR.EN2;
|
end case;
|
end Enabled;
|
----------------
|
-- Set_Output --
|
----------------
|
procedure Set_Output
|
(This : in out Digital_To_Analog_Converter;
|
Channel : DAC_Channel;
|
Value : UInt32;
|
Resolution : DAC_Resolution;
|
Alignment : Data_Alignment)
|
is
|
begin
|
case Channel is
|
when Channel_1 =>
|
case Resolution is
|
when DAC_Resolution_12_Bits =>
|
case Alignment is
|
when Left_Aligned =>
|
This.DHR12L1.DACC1DHR :=
|
UInt12 (Value and Max_12bit_Resolution);
|
when Right_Aligned =>
|
This.DHR12R1.DACC1DHR :=
|
UInt12 (Value and Max_12bit_Resolution);
|
end case;
|
when DAC_Resolution_8_Bits =>
|
This.DHR8R1.DACC1DHR := UInt8 (Value and Max_8bit_Resolution);
|
end case;
|
when Channel_2 =>
|
case Resolution is
|
when DAC_Resolution_12_Bits =>
|
case Alignment is
|
when Left_Aligned =>
|
This.DHR12L2.DACC2DHR :=
|
UInt12 (Value and Max_12bit_Resolution);
|
when Right_Aligned =>
|
This.DHR12R2.DACC2DHR :=
|
UInt12 (Value and Max_12bit_Resolution);
|
end case;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.