<commit_before>#include "variant/usart_platform.hpp"

#include "hal.h"

// UART2 configuration (XBee)
static const SerialConfig UART2_CONFIG {
  38400,
  0,
  USART_CR2_STOP1_BITS | USART_CR2_LINEN,
  0
};

// UART4 configuration (Unused)
static const SerialConfig UART4_CONFIG {
  38400,
  0,
  USART_CR2_STOP1_BITS | USART_CR2_LINEN,
  0
};

// UART6 configuration (GPS)
static const SerialConfig UART6_CONFIG {
  38400,
  0,
  USART_CR2_STOP1_BITS | USART_CR2_LINEN,
  0
};

USARTPlatform::USARTPlatform() {
  // Force RX high on startup to prevent XBee from entering SPI mode
  palSetPadMode(GPIOA, 3, PAL_MODE_OUTPUT_PUSHPULL);   // RX
  palSetPad(GPIOA, 3);
  chThdSleepMilliseconds(500);

  // UART2
  sdStart(&SD2, &UART2_CONFIG);
  palSetPadMode(GPIOA, 2, PAL_MODE_ALTERNATE(7));   // TX<commit_msg>Increase rocket GPS baudrate to 115200.<commit_after>#include "variant/usart_platform.hpp"

#include "hal.h"

// UART2 configuration (XBee)
static const SerialConfig UART2_CONFIG {
  38400,
  0,
  USART_CR2_STOP1_BITS | USART_CR2_LINEN,
  0
};

// UART4 configuration (Unused)
static const SerialConfig UART4_CONFIG {
  38400,
  0,
  USART_CR2_STOP1_BITS | USART_CR2_LINEN,
  0
};

// UART6 configuration (GPS)
static const SerialConfig UART6_CONFIG {
  115200,
  0,
  USART_CR2_STOP1_BITS | USART_CR2_LINEN,
  0
};

USARTPlatform::USARTPlatform() {
  // Force RX high on startup to prevent XBee from entering SPI mode
  palSetPadMode(GPIOA, 3, PAL_MODE_OUTPUT_PUSHPULL);   // RX
  palSetPad(GPIOA, 3);
  chThdSleepMilliseconds(500);

  // UART2
  sdStart(&SD2, &UART2_CONFIG);
  palSetPadMode(GPIOA, 2, PAL_MODE_ALTERNATE(7));   // TX
{'fraction_non_alphanumeric': 0.10164333536214243, 'fraction_numerical': 0.060255629945222156, 'mean_word_length': 4.425742574257426, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '523420', 'n_tokens_mistral': 710, 'n_tokens_neox': 659, 'n_words': 138}