text stringlengths 0 234 |
|---|
return Boolean |
is |
begin |
return This.Controller.Is_Message_Pending; |
end Is_Message_Pending; |
overriding |
function Current_Time |
(This : CAN_Driver) |
return Ada.Real_Time.Time |
is |
pragma Unreferenced (This); |
begin |
return Ada.Real_Time.Clock; |
end Current_Time; |
package body CAN_ISR is |
function Tx_Interrupt_Id |
(Device : not null access CAN_Controller) |
return Ada.Interrupts.Interrupt_ID |
is |
begin |
if Device = STM32.Device.CAN_1'Access then |
return Ada.Interrupts.Names.CAN1_TX_Interrupt; |
elsif Device = STM32.Device.CAN_2'Access then |
return Ada.Interrupts.Names.CAN2_TX_Interrupt; |
else |
raise Constraint_Error; |
end if; |
end Tx_Interrupt_Id; |
function Rx0_Interrupt_Id |
(Device : not null access CAN_Controller) |
return Ada.Interrupts.Interrupt_ID |
is |
begin |
if Device = STM32.Device.CAN_1'Access then |
return Ada.Interrupts.Names.CAN1_RX0_Interrupt; |
elsif Device = STM32.Device.CAN_2'Access then |
return Ada.Interrupts.Names.CAN2_RX0_Interrupt; |
else |
raise Constraint_Error; |
end if; |
end Rx0_Interrupt_Id; |
function Rx1_Interrupt_Id |
(Device : not null access CAN_Controller) |
return Ada.Interrupts.Interrupt_ID |
is |
begin |
if Device = STM32.Device.CAN_1'Access then |
return Ada.Interrupts.Names.CAN1_RX1_Interrupt; |
elsif Device = STM32.Device.CAN_2'Access then |
return Ada.Interrupts.Names.CAN2_RX1_Interrupt; |
else |
raise Constraint_Error; |
end if; |
end Rx1_Interrupt_Id; |
function SCE_Interrupt_Id |
(Device : not null access CAN_Controller) |
return Ada.Interrupts.Interrupt_ID |
is |
begin |
if Device = STM32.Device.CAN_1'Access then |
return Ada.Interrupts.Names.CAN1_SCE_Interrupt; |
elsif Device = STM32.Device.CAN_2'Access then |
return Ada.Interrupts.Names.CAN2_SCE_Interrupt; |
else |
raise Constraint_Error; |
end if; |
end SCE_Interrupt_Id; |
function Nof_Messages (This : Message_Buffer) return Natural |
is |
begin |
if This.Idx_New >= This.Idx_Old then |
return This.Idx_New - This.Idx_Old; |
else |
return Index'Last - This.Idx_Old + 1 + This.Idx_New - Index'First; |
end if; |
end Nof_Messages; |
procedure Get_Next_Message |
(This : in out Message_Buffer; |
Message : out CAN_Message) |
is |
begin |
Message := This.Buffer (This.Idx_Old); |
This.Idx_Old := (This.Idx_Old + 1) mod (Index'Last + 1); |
end Get_Next_Message; |
procedure Put_Message |
(This : in out Message_Buffer; |
Message : in CAN_Message) |
is |
Idx_Next : constant Index := (This.Idx_New + 1) mod (Index'Last + 1); |
begin |
This.Buffer (This.Idx_New) := Message; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.