STM32L4OneWire
TODO : Add LPUART?
Const
NoError* = BusOneWire.NoError;
ErrorNoDevice* = BusOneWire.ErrorNoDevice;
ErrorTimeout* = BusOneWire.ErrorTimeout;
ErrorBus* = BusOneWire.ErrorBus;
SendReset* = BusOneWire.SendReset;
NoReset* = BusOneWire.NoReset;
ReadSlot* = BusOneWire.ReadSlot;
NoRead* = BusOneWire.NoRead;
CMD_RSCRATCHPAD* = BusOneWire.CMD_RSCRATCHPAD;
CMD_WSCRATCHPAD* = BusOneWire.CMD_WSCRATCHPAD;
CMD_CPYSCRATCHPAD* = BusOneWire.CMD_CPYSCRATCHPAD;
CMD_RECEEPROM* = BusOneWire.CMD_RECEEPROM;
CMD_RPWRSUPPLY* = BusOneWire.CMD_RPWRSUPPLY;
CMD_SEARCHROM* = BusOneWire.CMD_SEARCHROM;
CMD_READROM* = BusOneWire.CMD_READROM;
CMD_MATCHROM* = BusOneWire.CMD_MATCHROM;
CMD_SKIPROM* = BusOneWire.CMD_SKIPROM;
maxPorts* = 4;
USART1* = 1;
USART2* = 2;
USART3* = 3;
UART4* = 4;
Types
InitPar* = RECORD
n* : INTEGER;
TXRXPinPort*, TXRXPinN*: INTEGER;
UCLK*: INTEGER;
timeout*: INTEGER; (* transfere timeout in ms. 0 or lower disable timeout check *)
END;
Bus* = RECORD (BusOneWire.Bus)
n, UCLK, UEN: INTEGER;
CR1, CR2, CR3, BRR: ADDRESS;
ISR, ICR, RDR, TDR: ADDRESS;
END;
Procedures
Init
Initialize 1-Wire bus
PROCEDURE Init* (VAR bus : Bus; par-: InitPar);
Bus.Enable
Enable 1-wire bus
PROCEDURE (VAR bus- : Bus) Enable*;
Bus.Disable
Disable 1-wire bus
PROCEDURE (VAR bus- : Bus) Disable*;
Bus.Reset
Send reset slot and return true if devices is present on bus
PROCEDURE (VAR bus : Bus) Reset*(): BOOLEAN;
Bus.WriteBit
Write bit to 1-wire bus
PROCEDURE (VAR bus- : Bus) WriteBit*(bit : BOOLEAN);
Bus.ReadBit
Read bit from 1-wire bus
PROCEDURE (VAR bus- : Bus) ReadBit*(): BOOLEAN;
Bus.SendReceive
Send and optinal receive data on 1-wire bus * sendReset : Send reset signal at the start. SendReset or NoReset. * cmd : Address to array of bytes commands. Use ReadSlot to specify reading. * clen : Length of command array. * data : Address to optional array of read buffer. * dlen : Length of read buffer. * rStart : Index for reading to start (from 0). NoRead to disable reading.
Return TRUE if no error occured.
PROCEDURE (VAR bus : Bus) SendReceive*(sendReset : INTEGER; cmd : ADDRESS; clen : LENGTH; data : ADDRESS; dlen, rStart: LENGTH): BOOLEAN;