\ ********************************************************************* \ Setting up the REYAX RYLR890 LoRa transmitter \ Filename: LoRaSettingUp.txt \ Date: 16 jan 2022 \ Updated: 16 jan 2022 \ File Version: 1.0 \ MCU: ESP32-WROOM-32 \ Forth: ESP32forth all versions 7.x++ \ with Serial2 extension \ Copyright: Marc PETREMANN \ Author: Marc PETREMANN \ GNU General Public License \ ********************************************************************* DEFINED? --LRset [if] forget --LRset [then] create --LRset \ *** defining LoRa Setup words ***************************** \ convert a number to a decimal string : .n ( n ---) base @ >r decimal <# #s #> type r> base ! ; : crlf ( -- ) \ same action as cr, but adapted for LoRa $0d emit $0a emit ; \ Set the ADDRESS of LoRa transmitter: \ s"" value in interval [0..65535][?] (default 0) : ATaddress ( addr len -- ) ." AT+ADDRESS=" type crlf ; \ Test LoRa disponibility : AT_ ( -- ) ." AT" crlf ; \ Set the BAND of LoRa transmitter: \ s"" value is RF frequency, unit Hz : ATband ( addr len -- ) ." AT+BAND=" type crlf ; \ Set the AES32 password: \ s"" value is an 32 character long AES password \ from 00000000000000000000000000000001 to FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF : ATcpin ( addr len -- ) ." AT+CPIN=" type crlf ; \ Set the CRFOP RF output power: \ s"" value is RF output power between 0..15 : ATcrfop ( addr len -- ) ." AT+CRFOP=" type crlf ; \ Reset the LoRa transmitter with FACTORY parameters : ATfactory ( -- ) ." AT+FACTORY" crlf ; \ Set the baud rate transmission with ESP32: \ s"" value is: \ 300 \ 1200 \ 4800 \ 9600 \ 19200 \ 28800 \ 38400 \ 57600 \ 115200 (default) : ATipr ( addr len -- ) ." AT+IPR=" type crlf ; \ Set work MODE: \ s"" value is [0,1] \ 0 (defalt) Transmit and Receive mode \ 1 Sleep mode : ATmode ( addr len -- ) ." AT+MODE" type crlf ; \ Set NETWORKID: \ s"" value is [0..16] (0 bay default) : ATnetworkid ( addr len -- ) ." AT+NETWORKID" type crlf ; \ Set PARAMETER: \ s", \, , " value [7..12] (default 12) \value [0..9] (default 7) \value [1..4] (default 1) \value [4..7] (default 4) : ATparameter ( addr len -- ) ." AT+PARAMETER" type crlf ; \ RESET the LoRa transmitter : ATreset ( -- ) ." AT+RESET" crlf ; \ SEND Send data to the appointment address : ATsend { addr len address -- } ." AT+SEND=" address .n [char] , emit len .n [char] , emit addr len type crlf ; \ *** defining defered words ******************************** serial \ Select Serial vocabulary : serial2-type ( a n -- ) Serial2.write drop ; : typeToLoRa ( -- ) ['] serial2-type is type ; : typeToTerm ( -- ) ['] default-type is type ;
Legal: site web personnel sans commerce / personal site without seling