text stringlengths 0 234 |
|---|
if Bg_Buffer /= Null_Buffer then |
-- PFC and blending |
DMA2D_Periph.CR.MODE := DMA2D_MODE'Enum_Rep (M2M_BLEND); |
elsif Src_Buffer.Color_Mode = Dst_Buffer.Color_Mode then |
-- Direct memory transfer |
DMA2D_Periph.CR.MODE := DMA2D_MODE'Enum_Rep (M2M); |
else |
DMA2D_Periph.CR.MODE := DMA2D_MODE'Enum_Rep (M2M_PFC); |
end if; |
-- SOURCE CONFIGURATION |
DMA2D_Periph.FGPFCCR := |
(CM => DMA2D_Color_Mode'Enum_Rep (Src_Buffer.Color_Mode), |
AM => DMA2D_AM'Enum_Rep (NO_MODIF), |
ALPHA => 255, |
others => <>); |
if Src_Buffer.Color_Mode = L8 or else Src_Buffer.Color_Mode = L4 then |
if Src_Buffer.CLUT_Addr = System.Null_Address then |
raise Program_Error with "Source CLUT address required"; |
end if; |
DMA2D_Periph.FGCMAR := To_Word (Src_Buffer.CLUT_Addr); |
DMA2D_Periph.FGCMAR := To_Word (Src_Buffer.CLUT_Addr); |
DMA2D_Periph.FGPFCCR.CS := (case Src_Buffer.Color_Mode is |
when L8 => 2**8 - 1, |
when L4 => 2**4 - 1, |
when others => 0); |
-- Set CLUT mode to RGB888 |
DMA2D_Periph.FGPFCCR.CCM := Src_Buffer.CLUT_Color_Mode = RGB888; |
-- Start loading the CLUT |
DMA2D_Periph.FGPFCCR.START := True; |
while DMA2D_Periph.FGPFCCR.START loop |
-- Wait for CLUT loading... |
null; |
end loop; |
end if; |
DMA2D_Periph.FGOR := (LO => UInt14 (Src_Buffer.Width - Width), |
others => <>); |
DMA2D_Periph.FGMAR := To_Word (Src_Buffer.Addr) + Src_Off; |
if Bg_Buffer /= Null_Buffer then |
declare |
Bg_Off : constant UInt32 := Offset (Bg_Buffer, X_Bg, Y_Bg); |
begin |
DMA2D_Periph.BGPFCCR.CM := |
DMA2D_Color_Mode'Enum_Rep (Bg_Buffer.Color_Mode); |
DMA2D_Periph.BGMAR := To_Word (Bg_Buffer.Addr) + Bg_Off; |
DMA2D_Periph.BGPFCCR.CS := 0; |
DMA2D_Periph.BGPFCCR.START := False; |
DMA2D_Periph.BGOR := |
(LO => UInt14 (Bg_Buffer.Width - Width), others => <>); |
if Bg_Buffer.Color_Mode = L8 or else Bg_Buffer.Color_Mode = L4 then |
if Bg_Buffer.CLUT_Addr = System.Null_Address then |
raise Program_Error with "Background CLUT address required"; |
end if; |
DMA2D_Periph.BGCMAR := To_Word (Bg_Buffer.CLUT_Addr); |
DMA2D_Periph.BGPFCCR.CS := (case Bg_Buffer.Color_Mode is |
when L8 => 2**8 - 1, |
when L4 => 2**4 - 1, |
when others => 0); |
-- Set CLUT mode to RGB888 |
DMA2D_Periph.BGPFCCR.CCM := Bg_Buffer.CLUT_Color_Mode = RGB888; |
-- Start loading the CLUT |
DMA2D_Periph.BGPFCCR.START := True; |
while DMA2D_Periph.BGPFCCR.START loop |
-- Wait for CLUT loading... |
null; |
end loop; |
end if; |
Function Definition: procedure Demo_Timer_PWM is -- low-level demo of the PWM capabilities |
Function Body: Period : constant := 1000; |
Output_Channel : constant Timer_Channel := Channel_2; |
-- The LED driven by this example is determined by the channel selected. |
-- That is so because each channel of Timer_4 is connected to a specific |
-- LED in the alternate function configuration on this board. We will |
-- initialize all of the LEDs to be in the AF mode for Timer_4. The |
-- particular channel selected is completely arbitrary, as long as the |
-- selected GPIO port/pin for the LED matches the selected channel. |
-- |
-- Channel_1 is connected to the green LED. |
-- Channel_2 is connected to the orange LED. |
-- Channel_3 is connected to the red LED. |
-- Channel_4 is connected to the blue LED. |
-------------------- |
-- Configure_LEDs -- |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.