Microchip® Advanced Software Framework

thirdparty/wireless/ble_sdk/services/serial_bridge/uart/sam/serial_bridge.c File Reference
#include "asf.h"
#include "serial_bridge.h"
#include "conf_serialbridge.h"
#include "serial_fifo.h"
#include "ble_utils.h"
#include "conf_serialdrv.h"
#include "serial_drv.h"

Macros

#define ioport_set_pin_peripheral_mode(pin, mode)
 Set peripheral mode for one single IOPORT pin. More...
 

Functions

void ble_pdc_send_data (uint8_t *buf, uint16_t len)
 
void platform_dtm_interface_receive (uint8_t rx_data)
 
void SB_UART_Handler (void)
 
uint8_t serial_bridge_init (void)
 This module performs serial input/output functionalities via UART. More...
 
void serial_bridge_task (void)
 Bridges the UARTS. More...
 

Variables

static uint8_t ble_eusart_rx_buf [BLE_MAX_TX_PAYLOAD_SIZE]
 
static ser_fifo_desc_t ble_eusart_rx_fifo
 
static uint8_t ble_eusart_tx_buf [BLE_MAX_TX_PAYLOAD_SIZE]
 
volatile bool ble_eusart_tx_cmpl = true
 
static ser_fifo_desc_t ble_eusart_tx_fifo
 
uint8_t ble_usart_rx_buf [BLE_MAX_RX_PAYLOAD_SIZE]
 
ser_fifo_desc_t ble_usart_rx_fifo
 
static uint8_t ble_usart_tx_buf [BLE_MAX_TX_PAYLOAD_SIZE]
 
volatile bool ble_usart_tx_cmpl
 
ser_fifo_desc_t ble_usart_tx_fifo
 

#define ioport_set_pin_peripheral_mode (   pin,
  mode 
)
Value:
do {\
} while (0)
static void ioport_set_pin_mode(ioport_pin_t pin, ioport_mode_t mode)
Set pin mode for one single IOPORT pin.
Definition: ioport.h:217
static void ioport_disable_pin(ioport_pin_t pin)
Disable IOPORT pin, based on a pin created with IOPORT_CREATE_PIN().
Definition: ioport.h:179

Set peripheral mode for one single IOPORT pin.

It will configure port mode and disable pin mode (but enable peripheral).

Parameters
pinIOPORT pin to configure
modeMode masks to configure for the specified pin (IOPORT Modes)

void ble_pdc_send_data ( uint8_t *  buf,
uint16_t  len 
)
void platform_dtm_interface_receive ( uint8_t  rx_data)

References platform_start_rx(), and ser_fifo_push_uint8().

Referenced by ble_init().

uint8_t serial_bridge_init ( void  )

This module performs serial input/output functionalities via UART.

Initializes the Serial IO Module

Returns
STATUS_OK for successful initialization and FAILURE incase the IO is not initialized

References sam_usart_opt_t::baudrate, ble_eusart_rx_buf, ble_eusart_tx_buf, ble_usart_rx_buf, ble_usart_tx_buf, CONF_UART_BAUDRATE, pio_pull_up(), PIO_PULLUP, ser_fifo_init(), STATUS_OK, sysclk_enable_peripheral_clock(), sysclk_get_peripheral_hz(), uart_enable_interrupt(), uart_init(), sam_uart_opt::ul_mck, usart_enable_interrupt(), usart_enable_rx(), usart_enable_tx(), and usart_init_rs232().

Referenced by main().

void serial_bridge_task ( void  )

Bridges the UARTS.

Parameters
Takesthe data from one USART Rx to other USART Tx and vice versa
Returns
None

References ble_eusart_tx_cmpl, ble_pdc_send_data(), ble_usart_tx_cmpl, SER_FIFO_OK, ser_fifo_pull_uint8(), ser_fifo_push_uint8(), uart_enable_interrupt(), uart_write(), usart_enable_interrupt(), and usart_putchar().

Referenced by main().

uint8_t ble_eusart_rx_buf[BLE_MAX_TX_PAYLOAD_SIZE]
static

Referenced by serial_bridge_init().

ser_fifo_desc_t ble_eusart_rx_fifo
static
uint8_t ble_eusart_tx_buf[BLE_MAX_TX_PAYLOAD_SIZE]
static

Referenced by serial_bridge_init().

volatile bool ble_eusart_tx_cmpl = true
ser_fifo_desc_t ble_eusart_tx_fifo
static
uint8_t ble_usart_rx_buf[BLE_MAX_RX_PAYLOAD_SIZE]

Referenced by serial_bridge_init().

ser_fifo_desc_t ble_usart_rx_fifo
uint8_t ble_usart_tx_buf[BLE_MAX_TX_PAYLOAD_SIZE]
static

Referenced by serial_bridge_init().

ser_fifo_desc_t ble_usart_tx_fifo