text
stringlengths 0
234
|
|---|
-----------
|
-- Print --
|
-----------
|
procedure Print (Value : UInt32) is
|
Value_Image : constant String := Value'Img;
|
begin
|
LCD_Std_Out.Put (170, 52, Value_Image (2 .. Value_Image'Last) & " ");
|
end Print;
|
------------------
|
-- Await_Button --
|
------------------
|
procedure Await_Button is
|
begin
|
Await_Pressed : loop
|
exit Await_Pressed when Set (User_Button_Point);
|
end loop Await_Pressed;
|
Await_Released : loop
|
exit Await_Released when not Set (User_Button_Point);
|
end loop Await_Released;
|
end Await_Button;
|
------------------------
|
-- Configure_DAC_GPIO --
|
------------------------
|
procedure Configure_DAC_GPIO (Output_Channel : DAC_Channel) is
|
Output : constant GPIO_Point := (if Output_Channel = Channel_1
|
then DAC_Channel_1_IO
|
else DAC_Channel_2_IO);
|
begin
|
Enable_Clock (Output);
|
Configure_IO (Output, (Mode => Mode_Analog, Resistors => Floating));
|
end Configure_DAC_GPIO;
|
begin
|
Initialize_LEDs;
|
All_LEDs_Off;
|
LCD_Std_Out.Clear_Screen;
|
Configure_User_Button_GPIO;
|
Configure_DAC_GPIO (Output_Channel);
|
Enable_Clock (DAC_1);
|
Reset (DAC_1);
|
Select_Trigger (DAC_1, Output_Channel, Software_Trigger);
|
Enable_Trigger (DAC_1, Output_Channel);
|
Enable (DAC_1, Output_Channel);
|
declare
|
Value : UInt32 := 0;
|
Percent : UInt32;
|
Resolution : constant DAC_Resolution := DAC_Resolution_12_Bits;
|
-- Arbitrary, change as desired. Counts will automatically adjust.
|
Max_Counts : constant UInt32 := (if Resolution = DAC_Resolution_12_Bits
|
then Max_12bit_Resolution
|
else Max_8bit_Resolution);
|
begin
|
Put (0, 0, "VRef+ is 2.95V"); -- measured
|
Put (0, 25, "Button advances");
|
Put (0, 52, "Current %:");
|
loop
|
for K in UInt32 range 0 .. 10 loop
|
Percent := K * 10;
|
Print (Percent);
|
Value := (Percent * Max_Counts) / 100;
|
Set_Output
|
(DAC_1,
|
Output_Channel,
|
Value,
|
Resolution,
|
Right_Aligned);
|
Trigger_Conversion_By_Software (DAC_1, Output_Channel);
|
Await_Button;
|
end loop;
|
end loop;
|
Function Definition: procedure Demo_CRC is
|
Function Body: Checksum_CPU : UInt32 := 0;
|
-- the checksum obtained by calling a routine that uses the CPU to transfer
|
-- the memory block to the CRC processor
|
Checksum_DMA : UInt32 := 0;
|
-- the checksum obtained by calling a routine that uses DMA to transfer the
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.