text stringlengths 0 234 |
|---|
elsif Port.Periph.all'Address = I2C2_Base then |
return I2C_Id_2; |
elsif Port.Periph.all'Address = I2C3_Base then |
return I2C_Id_3; |
else |
raise Unknown_Device; |
end if; |
end As_Port_Id; |
------------------ |
-- Enable_Clock -- |
------------------ |
procedure Enable_Clock (This : aliased I2C_Port'Class) is |
begin |
Enable_Clock (As_Port_Id (This)); |
end Enable_Clock; |
------------------ |
-- Enable_Clock -- |
------------------ |
procedure Enable_Clock (This : I2C_Port_Id) is |
begin |
case This is |
when I2C_Id_1 => |
RCC_Periph.APB1ENR.I2C1EN := True; |
when I2C_Id_2 => |
RCC_Periph.APB1ENR.I2C2EN := True; |
when I2C_Id_3 => |
RCC_Periph.APB1ENR.I2C3EN := True; |
end case; |
end Enable_Clock; |
----------- |
-- Reset -- |
----------- |
procedure Reset (This : I2C_Port'Class) is |
begin |
Reset (As_Port_Id (This)); |
end Reset; |
----------- |
-- Reset -- |
----------- |
procedure Reset (This : I2C_Port_Id) is |
begin |
case This is |
when I2C_Id_1 => |
RCC_Periph.APB1RSTR.I2C1RST := True; |
RCC_Periph.APB1RSTR.I2C1RST := False; |
when I2C_Id_2 => |
RCC_Periph.APB1RSTR.I2C2RST := True; |
RCC_Periph.APB1RSTR.I2C2RST := False; |
when I2C_Id_3 => |
RCC_Periph.APB1RSTR.I2C3RST := True; |
RCC_Periph.APB1RSTR.I2C3RST := False; |
end case; |
end Reset; |
------------------ |
-- Enable_Clock -- |
------------------ |
procedure Enable_Clock (This : SPI_Port'Class) is |
begin |
if This.Periph.all'Address = SPI1_Base then |
RCC_Periph.APB2ENR.SPI1EN := True; |
elsif This.Periph.all'Address = SPI2_Base then |
RCC_Periph.APB1ENR.SPI2EN := True; |
elsif This.Periph.all'Address = SPI3_Base then |
RCC_Periph.APB1ENR.SPI3EN := True; |
else |
raise Unknown_Device; |
end if; |
end Enable_Clock; |
----------- |
-- Reset -- |
----------- |
procedure Reset (This : in out SPI_Port'Class) is |
begin |
if This.Periph.all'Address = SPI1_Base then |
RCC_Periph.APB2RSTR.SPI1RST := True; |
RCC_Periph.APB2RSTR.SPI1RST := False; |
elsif This.Periph.all'Address = SPI2_Base then |
RCC_Periph.APB1RSTR.SPI2RST := True; |
RCC_Periph.APB1RSTR.SPI2RST := False; |
elsif This.Periph.all'Address = SPI3_Base then |
RCC_Periph.APB1RSTR.SPI3RST := True; |
RCC_Periph.APB1RSTR.SPI3RST := False; |
else |
raise Unknown_Device; |
end if; |
end Reset; |
------------------ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.