I need to read arrays stored in program memory and output the contents on SPI.
The compiler issues warnings, listed in the code, but the code simulates correctly on the software simulator.
Code: Select all
var
Cmd_Array_Pnt: ^const byte; // ptr is pointer to program memory space
const
//
// Si446X_Boot_Commands
//
// 30MHz crystal osc
//
Si446X_Wake_Up_Cmd : array[7] of byte = (0x02,0x01,0x00,0x01,0xC9,0xC3,0x80);
//
// Si446X_Cmd_Write_SPI;
//
Si446X_Cmd_Write_SPI(Cmd_Array : byte; Num_Bytes : byte);
var Cmd_Array_Num_Bytes : byte;
var Cmd_Array_Byte_Counter : byte;
var SPI_Data : byte;
begin
Cmd_Array_Pnt := Cmd_Array; <<-- Warning: Implicit typecast of integral value to pointer
Cmd_Array_Num_Bytes := Num_Bytes;
Cmd_Array_Byte_Counter := 1;
while Cmd_Array_Byte_Counter <= Cmd_Array_Num_Bytes do
begin
SPI_Data := Cmd_Array_Pnt^;
SPI1_Write(SPI_Data);
INC(Cmd_Array_Pnt);
INC(Cmd_Array_Byte_Counter);
end;
end;
Main
Si446X_Cmd_Write_SPI(@Si446X_Wake_Up_Cmd, 7); <<-- Warning: Suspicious pointer conversion and
<<-- Warning: Implicit typecast performed from "pointer" to "integral type"