### Complete Si5351 Beacon Example Source: https://context7.com/etherkit/jtencode/llms.txt This example demonstrates how to use the JTEncode library with an Si5351 frequency synthesizer to create a multi-mode beacon transmitter. It includes setup for JT65 mode, button-triggered transmission, and comments for alternative modes like JT9 and FT8. ```cpp #include #include #include // Mode timing parameters (in centihertz and milliseconds) #define JT65_TONE_SPACING 269 // ~2.69 Hz #define JT65_DELAY 371 // ms per symbol #define WSPR_TONE_SPACING 146 // ~1.46 Hz #define WSPR_DELAY 683 // ms per symbol #define FT8_TONE_SPACING 625 // ~6.25 Hz #define FT8_DELAY 159 // ms per symbol // Frequencies (Hz) #define JT65_FREQ 14078300UL #define WSPR_FREQ 14097200UL #define FT8_FREQ 14075000UL // Hardware pins #define BUTTON_PIN 12 #define LED_PIN 13 Si5351 si5351; JTEncode jtencode; uint8_t tx_buffer[255]; uint8_t symbol_count; uint16_t tone_delay; uint16_t tone_spacing; unsigned long freq; // Station information char message[] = "CQ NT7S CN85"; char call[] = "NT7S"; char loc[] = "CN85"; uint8_t dbm = 10; void transmit() { // Enable output and indicator LED si5351.output_enable(SI5351_CLK0, 1); digitalWrite(LED_PIN, HIGH); // Transmit each symbol for(uint8_t i = 0; i < symbol_count; i++) { // Set frequency: base + (symbol * tone_spacing) si5351.set_freq((freq * 100) + (tx_buffer[i] * tone_spacing), SI5351_CLK0); delay(tone_delay); } // Disable output si5351.output_enable(SI5351_CLK0, 0); digitalWrite(LED_PIN, LOW); } void setup() { // Initialize Si5351 (25 MHz reference crystal) si5351.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0); si5351.drive_strength(SI5351_CLK0, SI5351_DRIVE_8MA); si5351.output_enable(SI5351_CLK0, 0); pinMode(LED_PIN, OUTPUT); pinMode(BUTTON_PIN, INPUT_PULLUP); // Configure for JT65 mode freq = JT65_FREQ; symbol_count = JT65_SYMBOL_COUNT; tone_spacing = JT65_TONE_SPACING; tone_delay = JT65_DELAY; // Encode message (do this once, it's RAM intensive) jtencode.jt65_encode(message, tx_buffer); // Alternative modes: // jtencode.jt9_encode(message, tx_buffer); // jtencode.ft8_encode(message, tx_buffer); // jtencode.wspr_encode(call, loc, dbm, tx_buffer); } void loop() { // Trigger transmission on button press if(digitalRead(BUTTON_PIN) == LOW) { delay(50); // Debounce if(digitalRead(BUTTON_PIN) == LOW) { transmit(); delay(50); } } } ``` -------------------------------- ### JT65 Encoding Example Source: https://context7.com/etherkit/jtencode/llms.txt Encodes a 13-character message into 126 channel symbols for JT65 mode. Ensure the message contains valid characters and the buffer is of sufficient size. ```cpp #include JTEncode jtencode; // Buffer for JT65 symbols (126 symbols required) uint8_t tx_buffer[JT65_SYMBOL_COUNT]; // Message must be 13 characters or less (Type 6 message format) // Valid characters: A-Z, 0-9, space, +, -, ., /, ? char message[] = "CQ NT7S CN85"; void setup() { Serial.begin(9600); // Encode the message into channel symbols jtencode.jt65_encode(message, tx_buffer); // Print the generated symbols Serial.println("JT65 Channel Symbols:"); for(int i = 0; i < JT65_SYMBOL_COUNT; i++) { Serial.print(tx_buffer[i]); Serial.print(" "); } // Transmit using Si5351 or similar synthesizer // Tone spacing: ~2.69 Hz (269 centihertz) // Symbol duration: 371 ms // Total transmission time: ~47 seconds } ``` -------------------------------- ### JT9 Encoding Example Source: https://context7.com/etherkit/jtencode/llms.txt Encodes a 13-character message into 85 channel symbols for JT9 mode. This mode offers better sensitivity than JT65 with a narrower bandwidth. ```cpp #include JTEncode jtencode; // Buffer for JT9 symbols (85 symbols required) uint8_t tx_buffer[JT9_SYMBOL_COUNT]; char message[] = "CQ NT7S CN85"; void setup() { Serial.begin(9600); // Encode message for JT9 jtencode.jt9_encode(message, tx_buffer); // Print symbols for verification Serial.println("JT9 Channel Symbols:"); for(int i = 0; i < JT9_SYMBOL_COUNT; i++) { Serial.print(tx_buffer[i]); Serial.print(" "); } // Transmission parameters for JT9-1: // Tone spacing: ~1.74 Hz (174 centihertz) // Symbol duration: 576 ms // Total transmission time: ~49 seconds } ``` -------------------------------- ### FT8 Encoding Example Source: https://context7.com/etherkit/jtencode/llms.txt Encodes messages for the FT8 protocol, supporting free-text (up to 13 characters) or telemetry (up to 18 hex digits). FT8 uses 15-second transmission cycles for rapid QSOs. ```cpp #include JTEncode jtencode; // Buffer for FT8 symbols (79 symbols required) uint8_t tx_buffer[FT8_SYMBOL_COUNT]; // Type 0.0: Free text message (13 chars max) char message[] = "CQ NT7S CN85"; // Type 0.5: Telemetry message (18 hex digits max) // char telemetry[] = "123456789ABCDEF012"; void setup() { Serial.begin(9600); // Encode FT8 message (v2.0.0 protocol, 79 symbols) jtencode.ft8_encode(message, tx_buffer); Serial.println("FT8 Channel Symbols:"); for(int i = 0; i < FT8_SYMBOL_COUNT; i++) { Serial.print(tx_buffer[i]); Serial.print(" "); } // Transmission parameters: // Tone spacing: ~6.25 Hz (625 centihertz) // Symbol duration: 159 ms // Total transmission time: ~12.6 seconds // Bandwidth: ~50 Hz } ``` -------------------------------- ### JT4 Encoding Example Source: https://context7.com/etherkit/jtencode/llms.txt Encodes a 13-character message into 207 channel symbols for JT4 mode, suitable for VHF/UHF weak-signal work with wider tone spacing to accommodate Doppler shifts. ```cpp #include JTEncode jtencode; // Buffer for JT4 symbols (207 symbols required) uint8_t tx_buffer[JT4_SYMBOL_COUNT]; char message[] = "CQ NT7S CN85"; void setup() { Serial.begin(9600); // Encode message for JT4 jtencode.jt4_encode(message, tx_buffer); Serial.println("JT4 Channel Symbols:"); for(int i = 0; i < JT4_SYMBOL_COUNT; i++) { Serial.print(tx_buffer[i]); Serial.print(" "); } // Transmission parameters for JT4A: // Tone spacing: ~4.37 Hz (437 centihertz) // Symbol duration: 229 ms // Total transmission time: ~47 seconds } ``` -------------------------------- ### Initialize JTEncode Object Source: https://github.com/etherkit/jtencode/blob/master/README.md Instantiate the JTEncode class to begin encoding messages. ```cpp JTEncode jtencode; ``` -------------------------------- ### Configure Mode Parameters Source: https://github.com/etherkit/jtencode/blob/master/README.md Set frequency, tone spacing, symbol count, and tone delay based on the selected digital mode. Ensure library defines are used for symbol counts. ```cpp // Set the proper frequency, tone spacing, symbol count, and // tone delay depending on mode switch(cur_mode) { case MODE_JT9: freq = JT9_DEFAULT_FREQ; symbol_count = JT9_SYMBOL_COUNT; // From the library defines tone_spacing = JT9_TONE_SPACING; tone_delay = JT9_DELAY; break; case MODE_JT65: freq = JT65_DEFAULT_FREQ; symbol_count = JT65_SYMBOL_COUNT; // From the library defines tone_spacing = JT65_TONE_SPACING; tone_delay = JT65_DELAY; break; case MODE_JT4: freq = JT4_DEFAULT_FREQ; symbol_count = JT4_SYMBOL_COUNT; // From the library defines tone_spacing = JT4_TONE_SPACING; tone_delay = JT4_DELAY; break; case MODE_WSPR: freq = WSPR_DEFAULT_FREQ; symbol_count = WSPR_SYMBOL_COUNT; // From the library defines tone_spacing = WSPR_TONE_SPACING; tone_delay = WSPR_DELAY; break; case MODE_FT8: freq = FT8_DEFAULT_FREQ; symbol_count = FT8_SYMBOL_COUNT; // From the library defines tone_spacing = FT8_TONE_SPACING; tone_delay = FT8_DELAY; break; case MODE_FSQ_2: freq = FSQ_DEFAULT_FREQ; tone_spacing = FSQ_TONE_SPACING; tone_delay = FSQ_2_DELAY; break; case MODE_FSQ_3: freq = FSQ_DEFAULT_FREQ; tone_spacing = FSQ_TONE_SPACING; tone_delay = FSQ_3_DELAY; break; case MODE_FSQ_4_5: freq = FSQ_DEFAULT_FREQ; tone_spacing = FSQ_TONE_SPACING; tone_delay = FSQ_4_5_DELAY; break; case MODE_FSQ_6: freq = FSQ_DEFAULT_FREQ; tone_spacing = FSQ_TONE_SPACING; tone_delay = FSQ_6_DELAY; break; } ``` -------------------------------- ### Convert Coordinates to Maidenhead Grid in C++ Source: https://context7.com/etherkit/jtencode/llms.txt Converts decimal latitude and longitude into a 6-character Maidenhead grid locator. Useful for dynamic WSPR beacon configuration. ```cpp #include JTEncode jtencode; // GPS coordinates (example: Seattle, WA area) float latitude = 47.6062; float longitude = -122.3321; // Buffer for 6-character grid + null terminator char grid[7]; void setup() { Serial.begin(9600); // Convert lat/lon to Maidenhead grid jtencode.latlon_to_grid(latitude, longitude, grid); Serial.print("Coordinates: "); Serial.print(latitude, 4); Serial.print(", "); Serial.println(longitude, 4); Serial.print("Maidenhead Grid: "); Serial.println(grid); // Output: CN87tp // Use with WSPR encoding char call[] = "NT7S"; uint8_t dbm = 10; uint8_t wspr_buffer[WSPR_SYMBOL_COUNT]; // Type 3 message with 6-digit grid from GPS char call_bracketed[15]; sprintf(call_bracketed, "<%s>", call); jtencode.wspr_encode(call_bracketed, grid, dbm, wspr_buffer); Serial.println("WSPR Type 3 message encoded with GPS-derived grid"); } void loop() { // In real application, update from GPS periodically } ``` -------------------------------- ### latlon_to_grid() Source: https://github.com/etherkit/jtencode/blob/master/README.md Converts latitude and longitude in decimal degrees to a 6-digit Maidenhead grid square string. ```APIDOC ## latlon_to_grid() ### Description Takes a station latitude and longitude provided in decimal degrees format and returns a string with the 6-digit Maidenhead grid designator. ### Parameters - **lat** (float) - Required - Latitude in decimal degrees format. - **lon** (float) - Required - Longitude in decimal degrees format. - **ret_grid** (char*) - Required - Derived Maidenhead grid square. A pointer to a character array of at least 7 bytes must be provided here for the function return value. ``` -------------------------------- ### JTEncode Library Usage Source: https://github.com/etherkit/jtencode/blob/master/README.md This section details the usage of the JTEncode library for encoding messages in different digital modes. It includes initialization, mode setting, and the encoding process. ```APIDOC ## JTEncode Library Usage This library provides methods to encode messages for various digital radio modes. ### Initialization An instance of the `JTEncode` object is created as follows: ```cpp JTEncode jtencode; ``` ### Mode Configuration Before transmitting, the mode parameters such as frequency, tone spacing, symbol count, and tone delay are set based on the selected mode. ```cpp // Example for JT9 mode int cur_mode = MODE_JT9; float freq = JT9_DEFAULT_FREQ; int symbol_count = JT9_SYMBOL_COUNT; int tone_spacing = JT9_TONE_SPACING; int tone_delay = JT9_DELAY; ``` ### Message Encoding Messages are encoded using specific methods for each mode. The encoded symbols are stored in a buffer. ```cpp // Example for JT65 mode const char *message = "MYCALLSIGN"; uint8_t tx_buffer[JT65_SYMBOL_COUNT]; jtencode.jt65_encode(message, tx_buffer); ``` ### Transmission Sequence Once encoded, the channel symbols are transmitted sequentially with appropriate timing. ```cpp // Assuming si5351 and tone_delay are configured for(int i = 0; i < symbol_count; i++) { si5351.set_freq((freq * 100) + (tx_buffer[i] * tone_spacing), SI5351_CLK0); delay(tone_delay); } ``` ``` -------------------------------- ### Encode WSPR Beacons in C++ Source: https://context7.com/etherkit/jtencode/llms.txt Encodes WSPR messages including callsign, grid locator, and power level. Requires a buffer of 162 symbols. ```cpp #include JTEncode jtencode; // Buffer for WSPR symbols (162 symbols required) uint8_t tx_buffer[WSPR_SYMBOL_COUNT]; // Type 1 message: callsign, 4-digit grid, power char call[] = "NT7S"; char loc[] = "CN85"; uint8_t dbm = 10; // Power in dBm (valid: 0,3,7,10,13,17,20,23,27,30,33,37,40,43,47,50,53,57,60) // Type 2 message with prefix/suffix: // char call[] = "NT7S/P"; // or "DL/NT7S" // Type 3 message with 6-digit grid: // char call[] = ""; // char loc[] = "CN85NM"; void setup() { Serial.begin(9600); // Encode WSPR beacon jtencode.wspr_encode(call, loc, dbm, tx_buffer); Serial.println("WSPR Channel Symbols:"); for(int i = 0; i < WSPR_SYMBOL_COUNT; i++) { Serial.print(tx_buffer[i]); Serial.print(" "); } // Transmission parameters: // Tone spacing: ~1.46 Hz (146 centihertz) // Symbol duration: 683 ms // Total transmission time: ~110 seconds (1 min 50 sec) // Bandwidth: ~6 Hz } ``` -------------------------------- ### Transmit Channel Symbols Sequentially Source: https://github.com/etherkit/jtencode/blob/master/README.md Iterate through the generated channel symbols and transmit each one sequentially with the correct tone delay. This uses the si5351 library to set the frequency. ```cpp // Now transmit the channel symbols for(i = 0; i < symbol_count; i++) { si5351.set_freq((freq * 100) + (tx_buffer[i] * tone_spacing), SI5351_CLK0); delay(tone_delay); } ``` -------------------------------- ### jt65_encode() Method Source: https://github.com/etherkit/jtencode/blob/master/README.md Details the `jt65_encode` method for encoding messages in JT65 mode. ```APIDOC ## POST /api/encode/jt65 ### Description Encodes a plaintext message into a sequence of channel symbols for JT65 transmission. ### Method `jt65_encode` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **message** (const char *) - Required - Plaintext message for JT65, up to 13 allowable characters. - **symbols** (uint8_t *) - Required - Array to store the returned channel symbols. Must be of at least size `JT65_SYMBOL_COUNT`. ### Request Example ```json { "message": "MYCALLSIGN", "symbols": "[output buffer]" } ``` ### Response #### Success Response (200) - **symbols** (uint8_t *) - The array populated with channel symbols for transmission. #### Response Example ```json { "symbols": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] } ``` ``` -------------------------------- ### Convert Latitude/Longitude to Maidenhead Grid Source: https://github.com/etherkit/jtencode/blob/master/README.md Converts station latitude and longitude in decimal degrees to a 6-digit Maidenhead grid designator. Provide a character array of at least 7 bytes for the return value. ```c /* * latlon_to_grid(float lat, float lon, char* ret_grid) * * Takes a station latitude and longitude provided in decimal degrees format and * returns a string with the 6-digit Maidenhead grid designator. * * lat - Latitude in decimal degrees format. * lon - Longitude in decimal degrees format. * ret_grid - Derived Maidenhead grid square. A pointer to a character array of * at least 7 bytes must be provided here for the function return value. * */ ``` -------------------------------- ### wspr_encode() Source: https://github.com/etherkit/jtencode/blob/master/README.md Encodes callsign, grid locator, and power level into a WSPR symbol table for Type 1, 2, or 3 messages. ```APIDOC ## wspr_encode() ### Description Takes a callsign, grid locator, and power level and returns a WSPR symbol table for a Type 1, 2, or 3 message. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **call** (const char *) - Callsign (12 characters maximum). - **loc** (const char *) - Maidenhead grid locator (6 characters maximum). - **dbm** (const uint8_t) - Output power in dBm. - **symbols** (uint8_t *) - Array of channel symbols to transmit returned by the method. Ensure that you pass a uint8_t array of at least size WSPR_SYMBOL_COUNT to the method. ### Request Example ```c // Example usage (conceptual, actual implementation depends on context) char callsign[] = "MYCALL"; char locator[] = "FN42"; uint8_t power = 10; // 10 dBm uint8_t symbols[WSPR_SYMBOL_COUNT]; wspr_encode(callsign, locator, power, symbols); ``` ### Response #### Success Response (200) - **symbols** (uint8_t *) - Array of channel symbols representing the encoded WSPR message. #### Response Example ```json { "symbols": "[uint8_t array representing channel symbols]" } ``` ``` -------------------------------- ### Encode Message for Transmission Source: https://github.com/etherkit/jtencode/blob/master/README.md Select the appropriate encoding method based on the current mode and populate the transmit symbol buffer. This should be called within its own subroutine before transmission. ```cpp // Set the proper frequency and timer CTC depending on mode switch(cur_mode) { case MODE_JT9: jtencode.jt9_encode(message, tx_buffer); break; case MODE_JT65: jtencode.jt65_encode(message, tx_buffer); break; case MODE_JT4: jtencode.jt4_encode(message, tx_buffer); break; case MODE_WSPR: jtencode.wspr_encode(call, loc, dbm, tx_buffer); break; case MODE_FT8: jtencode.ft_encode(message, tx_buffer); break; case MODE_FSQ_2: case MODE_FSQ_3: case MODE_FSQ_4_5: case MODE_FSQ_6: jtencode.fsq_dir_encode(call, "n0call", " ", "hello world", tx_buffer); break; } ``` -------------------------------- ### Encode WSPR Messages Source: https://github.com/etherkit/jtencode/blob/master/README.md Generates a WSPR symbol table from callsign, grid locator, and power level. The output array must be at least WSPR_SYMBOL_COUNT in size. ```c /* * wspr_encode(const char * call, const char * loc, const uint8_t dbm, uint8_t * symbols) * * Takes a callsign, grid locator, and power level and returns a WSPR symbol * table for a Type 1, 2, or 3 message. * * call - Callsign (12 characters maximum). * loc - Maidenhead grid locator (6 characters maximum). * dbm - Output power in dBm. * symbols - Array of channel symbols to transmit returned by the method. * Ensure that you pass a uint8_t array of at least size WSPR_SYMBOL_COUNT to the method. * */ ``` -------------------------------- ### fsq_dir_encode() Source: https://github.com/etherkit/jtencode/blob/master/README.md Encodes a directed message into an FSQ channel symbol table. ```APIDOC ## fsq_dir_encode() ### Description Takes an arbitrary message and returns a FSQ channel symbol table for directed messages. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **from_call** (const char *) - Callsign from which message is directed (maximum size: 20). - **to_call** (const char *) - Callsign to which message is directed (maximum size: 20). - **cmd** (const char) - Directed command. - **message** (const char *) - Null-terminated message string, no greater than 100 chars in length. - **symbols** (uint8_t *) - Array of channel symbols to transmit returned by the method. Ensure that you pass a uint8_t array of at least the size of the message plus 5 characters to the method. Terminated in 0xFF. ### Request Example ```c // Example usage (conceptual, actual implementation depends on context) char from_callsign[] = "MYCALL"; char to_callsign[] = "TARGETCALL"; char command = 'R'; // Example command char message[] = "DIRECTED MESSAGE CONTENT"; // Allocate enough space for message + 5 chars + null terminator + 0xFF terminator size_t required_size = strlen(message) + 5 + 1 + 1; uint8_t *symbols = malloc(required_size); if (symbols) { fsq_dir_encode(from_callsign, to_callsign, command, message, symbols); // ... use symbols ... free(symbols); } ``` ### Response #### Success Response (200) - **symbols** (uint8_t *) - Array of channel symbols representing the encoded FSQ directed message. #### Response Example ```json { "symbols": "[uint8_t array representing channel symbols]" } ``` ``` -------------------------------- ### fsq_encode() Source: https://github.com/etherkit/jtencode/blob/master/README.md Encodes an arbitrary message into an FSQ channel symbol table. ```APIDOC ## fsq_encode() ### Description Takes an arbitrary message and returns a FSQ channel symbol table. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **from_call** (const char *) - Callsign of issuing station (maximum size: 20). - **message** (const char *) - Null-terminated message string, no greater than 130 chars in length. - **symbols** (uint8_t *) - Array of channel symbols to transmit returned by the method. Ensure that you pass a uint8_t array of at least the size of the message plus 5 characters to the method. Terminated in 0xFF. ### Request Example ```c // Example usage (conceptual, actual implementation depends on context) char callsign[] = "MYCALLSIGN"; char message[] = "HELLO FSQ WORLD"; // Allocate enough space for message + 5 chars + null terminator + 0xFF terminator size_t required_size = strlen(message) + 5 + 1 + 1; uint8_t *symbols = malloc(required_size); if (symbols) { fsq_encode(callsign, message, symbols); // ... use symbols ... free(symbols); } ``` ### Response #### Success Response (200) - **symbols** (uint8_t *) - Array of channel symbols representing the encoded FSQ message. #### Response Example ```json { "symbols": "[uint8_t array representing channel symbols]" } ``` ``` -------------------------------- ### ft8_encode() Source: https://github.com/etherkit/jtencode/blob/master/README.md Encodes a free text or telemetry message into a channel symbol table for the FT8 protocol. ```APIDOC ## ft8_encode() ### Description Takes an arbitrary message of up to 13 allowable characters or a telemetry message of up to 18 hexadecimal digits (in string format) and returns a channel symbol table. Encoded for the FT8 protocol used in WSJT-X v2.0 and beyond (79 channel symbols). ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **message** (const char *) - Type 0.0 free text message or Type 0.5 telemetry message. - **symbols** (uint8_t *) - Array of channel symbols to transmit returned by the method. Ensure that you pass a uint8_t array of at least size FT8_SYMBOL_COUNT to the method. ### Request Example ```c // Example usage for free text (conceptual) char free_text_message[] = "CQ CQ DE MYCALL"; uint8_t symbols_ft8[FT8_SYMBOL_COUNT]; ft8_encode(free_text_message, symbols_ft8); // Example usage for telemetry (conceptual) char telemetry_message[] = "0123456789ABCDEF"; // 18 hex digits uint8_t symbols_telemetry[FT8_SYMBOL_COUNT]; ft8_encode(telemetry_message, symbols_telemetry); ``` ### Response #### Success Response (200) - **symbols** (uint8_t *) - Array of channel symbols representing the encoded FT8 message. #### Response Example ```json { "symbols": "[uint8_t array representing channel symbols]" } ``` ``` -------------------------------- ### Encode JT9 and JT4 Messages Source: https://github.com/etherkit/jtencode/blob/master/README.md Encodes a plaintext message into a channel symbol table. Ensure the provided uint8_t array is at least JT9_SYMBOL_COUNT in size. ```c /* * jt9_encode(const char * message, uint8_t * symbols) * * Takes an arbitrary message of up to 13 allowable characters and returns * a channel symbol table. * * message - Plaintext Type 6 message. * symbols - Array of channel symbols to transmit returned by the method. * Ensure that you pass a uint8_t array of at least size JT9_SYMBOL_COUNT to the method. * */ ``` ```c /* * jt4_encode(const char * message, uint8_t * symbols) * * Takes an arbitrary message of up to 13 allowable characters and returns * a channel symbol table. * * message - Plaintext Type 6 message. * symbols - Array of channel symbols to transmit returned by the method. * Ensure that you pass a uint8_t array of at least size JT9_SYMBOL_COUNT to the method. * */ ``` -------------------------------- ### Encode FSQ Messages Source: https://github.com/etherkit/jtencode/blob/master/README.md Encodes FSQ messages, including directed variants. The output array must be at least the message length plus 5, and is terminated with 0xFF. ```c /* * fsq_encode(const char * from_call, const char * message, uint8_t * symbols) * * Takes an arbitrary message and returns a FSQ channel symbol table. * * from_call - Callsign of issuing station (maximum size: 20) * message - Null-terminated message string, no greater than 130 chars in length * symbols - Array of channel symbols to transmit returned by the method. * Ensure that you pass a uint8_t array of at least the size of the message * plus 5 characters to the method. Terminated in 0xFF. * */ ``` ```c /* * fsq_dir_encode(const char * from_call, const char * to_call, const char cmd, const char * message, uint8_t * symbols) * * Takes an arbitrary message and returns a FSQ channel symbol table. * * from_call - Callsign from which message is directed (maximum size: 20) * to_call - Callsign to which message is directed (maximum size: 20) * cmd - Directed command * message - Null-terminated message string, no greater than 100 chars in length * symbols - Array of channel symbols to transmit returned by the method. * Ensure that you pass a uint8_t array of at least the size of the message * plus 5 characters to the method. Terminated in 0xFF. * */ ``` -------------------------------- ### JT65 Encode Function Source: https://github.com/etherkit/jtencode/blob/master/README.md Encodes a Type 6 message into a channel symbol table for transmission. Ensure the symbols array is of at least size JT65_SYMBOL_COUNT. ```cpp /* * jt65_encode(const char * message, uint8_t * symbols) * * Takes an arbitrary message of up to 13 allowable characters and returns * a channel symbol table. * * message - Plaintext Type 6 message. * symbols - Array of channel symbols to transmit returned by the method. * Ensure that you pass a uint8_t array of at least size JT65_SYMBOL_COUNT to the method. * */ ``` -------------------------------- ### jt9_encode() Source: https://github.com/etherkit/jtencode/blob/master/README.md Encodes a Type 6 message into a channel symbol table for JT9 protocol. ```APIDOC ## jt9_encode() ### Description Takes an arbitrary message of up to 13 allowable characters and returns a channel symbol table. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **message** (const char *) - Plaintext Type 6 message. - **symbols** (uint8_t *) - Array of channel symbols to transmit returned by the method. Ensure that you pass a uint8_t array of at least size JT9_SYMBOL_COUNT to the method. ### Request Example ```c // Example usage (conceptual, actual implementation depends on context) char message[] = "HELLO WORLD"; uint8_t symbols[JT9_SYMBOL_COUNT]; jt9_encode(message, symbols); ``` ### Response #### Success Response (200) - **symbols** (uint8_t *) - Array of channel symbols representing the encoded message. #### Response Example ```json { "symbols": "[uint8_t array representing channel symbols]" } ``` ``` -------------------------------- ### Encode FSQ Non-Directed Messages in C++ Source: https://context7.com/etherkit/jtencode/llms.txt Encodes general broadcast FSQ messages using a varicode character set. The output buffer is terminated with 0xFF. ```cpp #include JTEncode jtencode; // Buffer for FSQ symbols (message length + 5 chars minimum) // Symbols are terminated with 0xFF uint8_t tx_buffer[200]; char from_call[] = "NT7S"; char message[] = "Hello from Arduino beacon"; void setup() { Serial.begin(9600); // Encode FSQ non-directed message jtencode.fsq_encode(from_call, message, tx_buffer); // Find end of message (0xFF terminator) uint8_t symbol_count = 0; while(tx_buffer[symbol_count] != 0xFF) { symbol_count++; } Serial.print("FSQ Symbols ("); Serial.print(symbol_count); Serial.println(" total):"); for(int i = 0; i < symbol_count; i++) { Serial.print(tx_buffer[i]); Serial.print(" "); } // Transmission parameters (varies by baud rate): // Tone spacing: ~8.79 Hz (879 centihertz) // FSQ-2: 500ms delay (2 baud) // FSQ-3: 333ms delay (3 baud) // FSQ-4.5: 222ms delay (4.5 baud) // FSQ-6: 167ms delay (6 baud) } ``` -------------------------------- ### jt4_encode() Source: https://github.com/etherkit/jtencode/blob/master/README.md Encodes a Type 6 message into a channel symbol table for JT4 protocol. ```APIDOC ## jt4_encode() ### Description Takes an arbitrary message of up to 13 allowable characters and returns a channel symbol table. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **message** (const char *) - Plaintext Type 6 message. - **symbols** (uint8_t *) - Array of channel symbols to transmit returned by the method. Ensure that you pass a uint8_t array of at least size JT9_SYMBOL_COUNT to the method. ### Request Example ```c // Example usage (conceptual, actual implementation depends on context) char message[] = "TEST MESSAGE"; uint8_t symbols[JT9_SYMBOL_COUNT]; // Note: JT4 uses JT9_SYMBOL_COUNT as per description jt4_encode(message, symbols); ``` ### Response #### Success Response (200) - **symbols** (uint8_t *) - Array of channel symbols representing the encoded message. #### Response Example ```json { "symbols": "[uint8_t array representing channel symbols]" } ``` ``` -------------------------------- ### Encode FT8 Messages Source: https://github.com/etherkit/jtencode/blob/master/README.md Encodes free text or telemetry messages for the FT8 protocol. The output array must be at least FT8_SYMBOL_COUNT in size. ```c /* * ft8_encode(const char * message, uint8_t * symbols) * * Takes an arbitrary message of up to 13 allowable characters or a telemetry message * of up to 18 hexadecimal digit (in string format) and returns a channel symbol table. * Encoded for the FT8 protocol used in WSJT-X v2.0 and beyond (79 channel symbols). * * message - Type 0.0 free text message or Type 0.5 telemetry message. * symbols - Array of channel symbols to transmit returned by the method. * Ensure that you pass a uint8_t array of at least size FT8_SYMBOL_COUNT to the method. * */ ``` -------------------------------- ### Encode FSQ Directed Messages in C++ Source: https://context7.com/etherkit/jtencode/llms.txt Encodes FSQ messages intended for a specific recipient, including CRC and EOT signaling. Messages are limited to 100 characters. ```cpp #include JTEncode jtencode; // Buffer for FSQ symbols uint8_t tx_buffer[200]; char from_call[] = "NT7S"; char to_call[] = "W1AW"; char cmd = ' '; // Space = standard message, other commands available char message[] = "Hello World"; void setup() { Serial.begin(9600); // Encode FSQ directed message jtencode.fsq_dir_encode(from_call, to_call, cmd, message, tx_buffer); // Count symbols (terminated with 0xFF) uint8_t symbol_count = 0; while(tx_buffer[symbol_count] != 0xFF) { symbol_count++; } Serial.print("FSQ Directed Message Symbols ("); Serial.print(symbol_count); Serial.println(" total):"); for(int i = 0; i < symbol_count; i++) { Serial.print(tx_buffer[i]); Serial.print(" "); } // Directed message format: " \n: \b " // Maximum message length: 100 characters } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.