<commit_before>#include <wixel.h>
#include <stdio.h>
#include <usb.h>
#include <usb_com.h>
#include <uart1.h>
#include <uart0.h>

#define IS_HEX_DIGIT(byte)(((byte) >= 'a' && (byte) <= 'f') || ((byte) >= '0' && (byte) <= '9'))

/* serial_ascii_binary app:
 * This app enables your wixel to convert between hex ASCII characters
 * and binary byte data using the interfaces UART0 and UART1.
 *
 * The flow of bidirectional information can be described as:
 * binary byte data -> UART1 -> converted into ASCII hex digits -> UART0 -> ASCII hex digits
 * ASCII hex digit -> UART0 -> converted into binary byte data -> UART1 -> binary byte data
 *
 * When sending ASCII HEX data to UART0, to signal the start of a data stream, send
 * the delimiting character 'H' first, and then proceed to send your ASCII hex
 * characters.
 *
 * Example input on UART0:  'H','1','F','A','3'
 * Example output on UART1: 0x1F,0xA3
 *
 * Example input on UART1:  0xA2,0x35
 * Example output on UART0: 'H','A','2','H','3','5'
 *
 * For UART0, the following pins are used:
 *
 * P0_3: TX
 * P0_2: RX
 *
 * For UART1, the following pins are used:
 * P1_6: TX
 * P1_7: RX
 *
 */

/** Parameters *********************************************************************************/

// Set UART0 baud rate.
int32 CODE param_ascii_baud_rate = 9600;

// Set UART1 baud rate. 
int32 CODE param_binary_baud_rate = 9600;

/** Funcions **********************************************************************************/

uint8 hexDigitToNibble(uint8 digit)
{
  //Convert ASCII hex digit to lower case.
  digit |= 0x20;
  <commit_msg>serial_ascii_binary app: Moved the big comment to the top.<commit_after>/* serial_ascii_binary app:
 * This app enables your wixel to convert between hex ASCII characters
 * and binary byte data using the interfaces UART0 and UART1.
 *
 * The flow of bidirectional information can be described as:
 * binary byte data -> UART1 -> converted into ASCII hex digits -> UART0 -> ASCII hex digits
 * ASCII hex digit -> UART0 -> converted into binary byte data -> UART1 -> binary byte data
 *
 * When sending ASCII HEX data to UART0, to signal the start of a data stream, send
 * the delimiting character 'H' first, and then proceed to send your ASCII hex
 * characters.
 *
 * Example input on UART0:  'H','1','F','A','3'
 * Example output on UART1: 0x1F,0xA3
 *
 * Example input on UART1:  0xA2,0x35
 * Example output on UART0: 'H','A','2','H','3','5'
 *
 * For UART0, the following pins are used:
 *
 * P0_3: TX
 * P0_2: RX
 *
 * For UART1, the following pins are used:
 * P1_6: TX
 * P1_7: RX
 *
 */

#include <wixel.h>
#include <stdio.h>
#include <usb.h>
#include <usb_com.h>
#include <uart1.h>
#include <uart0.h>

#define IS_HEX_DIGIT(byte)(((byte) >= 'a' && (byte) <= 'f') || ((byte) >= '0' && (byte) <= '9'))


/** Parameters *********************************************************************************/

// Set UART0 baud rate.
int32 CODE param_ascii_baud_rate = 9600;

// Set UART1 baud rate. 
int32 CODE param_binary_baud_rate = 9600;

/** Funcions **********************************************************************************/

uint8 hexDigitToNibble(uint8 digit)
{
  //Convert ASCII hex digit to lower case.
  digit |= 0x20;
  
{'fraction_non_alphanumeric': 0.2205064854848672, 'fraction_numerical': 0.035824583075972825, 'mean_word_length': 4.165869218500798, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6807038', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1048, 'n_words': 371}