@@ -570,24 +570,16 @@ package body Si4432 is
570570 (This : Si4432_Driver;
571571 Value : UInt9)
572572 is
573- Data : constant Unsigned_16 := Unsigned_16 (Value);
573+ Data : HAL.SPI.SPI_Data_8b (1 .. 2 );
574+ Reg : Modulation_Mode_Control_2_Register with Import,
575+ Address => Data (1 )'Address;
576+
574577 begin
575- Write_Register
576- (This,
577- Frequency_Deviation_Name,
578- Register (Data and 16#FF# ));
579-
580- if (Data and 2#1_0000_0000# ) /= 0 then
581- declare
582- R : Register := Read_Register
583- (This, Modulation_Mode_Control_2_Name);
584- Reg : Modulation_Mode_Control_2_Register with Import,
585- Address => R'Address;
586- begin
587- Reg.fd := 1 ;
588- Write_Register (This, Modulation_Mode_Control_2_Name, R);
589- end ;
590- end if ;
578+ Data (1 ) := UInt8 (Read_Register (This, Modulation_Mode_Control_2_Name));
579+ Reg.fd :=
580+ (if (Unsigned_16 (Value) and 2#1_0000_0000# ) > 0 then 1 else 0 );
581+ Data (2 ) := UInt8 (Unsigned_16 (Value) and 16#FF# );
582+ Write_Register (This, Modulation_Mode_Control_2_Name, Data);
591583 end Set_Frequency_Deviation ;
592584
593585 -- ---------------------------
@@ -1435,7 +1427,8 @@ package body Si4432 is
14351427
14361428 begin
14371429 Data (1 ) := UInt8 (Read_Register (This, Header_Control_2_Name));
1438- Reg.prealen := Bit (Unsigned_16 (Value) and 2#1_0000_0000# );
1430+ Reg.prealen :=
1431+ (if (Unsigned_16 (Value) and 2#1_0000_0000# ) > 0 then 1 else 0 );
14391432 Data (2 ) := UInt8 (Local and 16#FF# );
14401433
14411434 Write_Register (This, Header_Control_2_Name, Data);
@@ -2774,10 +2767,21 @@ package body Si4432 is
27742767 Data : SPI_Data_8b) is
27752768 begin
27762769 Set_Packet_Length (This, Data'Length);
2777- Write_Register (This, FIFO_Access_Name , Data);
2770+ Write_FIFO (This, Data);
27782771 Set_State (This, TX);
27792772 end Send ;
27802773
2774+ -- --------------
2775+ -- Write_FIFO --
2776+ -- --------------
2777+
2778+ procedure Write_FIFO
2779+ (This : Si4432_Driver;
2780+ Data : SPI_Data_8b) is
2781+ begin
2782+ Write_Register (This, FIFO_Access_Name, Data);
2783+ end Write_FIFO ;
2784+
27812785 -- ----------------
27822786 -- Get_Received --
27832787 -- ----------------
@@ -2790,14 +2794,24 @@ package body Si4432 is
27902794 (Get_Received_Packet_Length (This));
27912795 Length : constant Natural := Natural'Min (Received, Data'Length);
27922796 begin
2793- Read_Register
2794- (This, FIFO_Access_Name, Data (Data'First .. Data'First + Length - 1 ));
2797+ Read_FIFO (This, Data (Data'First .. Data'First + Length - 1 ));
27952798
27962799 if Received <= Data'Length then
27972800 Clear_RX_FIFO (This);
27982801 end if ;
27992802 end Get_Received ;
28002803
2804+ -- -------------
2805+ -- Read_FIFO --
2806+ -- -------------
2807+
2808+ procedure Read_FIFO
2809+ (This : Si4432_Driver;
2810+ Data : out SPI_Data_8b) is
2811+ begin
2812+ Read_Register (This, FIFO_Access_Name, Data);
2813+ end Read_FIFO ;
2814+
28012815 -- -----------------
28022816 -- Clear_RX_FIFO --
28032817 -- -----------------
0 commit comments