VT Library  0.2
Modules | Data Structures | Macros | Functions
VT backend

VT backend. More...

Modules

 VT Backend Configuration
 

Data Structures

struct  nrf_vt_backend_init_t
 

Macros

#define NRF_VT_PIN_DISCONNECTED   (0)
 

Functions

uint32_t nrf_vt_backend_init (nrf_vt_backend_init_t *p_config)
 Function for initializing the VT backend. More...
 
void nrf_vt_backend_uninit (void)
 Function for uninitializing the VT backend. More...
 
uint32_t nrf_vt_backend_rx_start (void)
 Function for starting the VT backend RX. More...
 
void nrf_vt_backend_rx_stop (void)
 Function for stopping the VT backend RX. More...
 
bool nrf_vt_backend_rx_started (void)
 Function for checking if the VT backend RX is running. More...
 
uint32_t nrf_vt_backend_tx_buffer_write_frame (const uint8_t const *p_data, uint32_t bits)
 Function for writing a data frame to the TX buffer. More...
 
uint32_t nrf_vt_backend_tx_frame_cast_init (uint8_t cast_no, uint32_t payload_bits)
 Function for initializing a frame cast. More...
 
uint32_t nrf_vt_backend_tx_buffer_write_cast_frame (uint8_t cast_no, const uint8_t const *p_data)
 Function for writing a data frame to the TX buffer using a frame cast. More...
 
void nrf_vt_backend_tx_buffer_clear (void)
 Function for clearing the TX buffer. More...
 
uint32_t nrf_vt_backend_tx_start (void)
 Function for starting transmission of the TX buffer. More...
 
bool nrf_vt_backend_tx_started (void)
 Function for checking if the VT backend TX is running. More...
 
void nrf_vt_backend_tx_stop (void)
 Stop the VT backend TX.
 

Detailed Description

VT backend.

Copyright (c) 2015 - 2018, Nordic Semiconductor ASA

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA integrated circuit in a product or a software update for such product, must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
  4. This software, with or without modification, must only be used with a Nordic Semiconductor ASA integrated circuit.
  5. Any software provided in binary form under this license must not be reverse engineered, decompiled, modified and/or disassembled.

THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ NRF_VT_PIN_DISCONNECTED

#define NRF_VT_PIN_DISCONNECTED   (0)

Value used to indicate that an RX/TX pin should not be used

Function Documentation

◆ nrf_vt_backend_init()

uint32_t nrf_vt_backend_init ( nrf_vt_backend_init_t p_config)

Function for initializing the VT backend.

This function configures and enables the SAADC and PWM using the provided configuration.

Parameters
[in]p_configPointer to the module initialization structure.
Return values
NRF_SUCCESSIf the initialization was successful.
NRF_ERROR_INVALID_PARAMIf the module is passed invalid parameters in the configuration structure.
NRF_ERROR_INVALID_STATEIf the PWM or SAADC drivers detect a reinitialization.
NRF_ERROR_BUSYIf the PPI or SAADC channels are already in use.

◆ nrf_vt_backend_rx_start()

uint32_t nrf_vt_backend_rx_start ( void  )

Function for starting the VT backend RX.

This function starts (background) sampling on the SAADC.

Return values
NRF_ERROR_SUCCESSIf the sampling was successfully started.
NRF_ERROR_BUSYIf the sampling is already running.

◆ nrf_vt_backend_rx_started()

bool nrf_vt_backend_rx_started ( void  )

Function for checking if the VT backend RX is running.

Return values
trueif the SAADC is sampling, false otherwise

◆ nrf_vt_backend_rx_stop()

void nrf_vt_backend_rx_stop ( void  )

Function for stopping the VT backend RX.

This function stops the background sampling on the SAADC. The SAADC will return whatever samples were made before stopping, so there may be some data left to process.

◆ nrf_vt_backend_tx_buffer_clear()

void nrf_vt_backend_tx_buffer_clear ( void  )

Function for clearing the TX buffer.

This function will empty the PWM sequence buffer.

◆ nrf_vt_backend_tx_buffer_write_cast_frame()

uint32_t nrf_vt_backend_tx_buffer_write_cast_frame ( uint8_t  cast_no,
const uint8_t const *  p_data 
)

Function for writing a data frame to the TX buffer using a frame cast.

This function will use the supplied frame cast to write a series of values representing the data frame to the PWM sequence buffer. It will run faster than using nrf_vt_backend_tx_buffer_write_frame. To flush the sequence buffer onto the serial line, use nrf_vt_backend_tx_start.

Parameters
[in]cast_noThe index of the cast to use for frame construction.
[in]p_dataPointer to the payload data.
Return values
NRF_SUCCESSIf the frame was successfully written to the PWM sequence buffer.
NRF_ERROR_NO_MEMIf there was not enough space in the PWM sequence buffer to write the frame.
NRF_ERROR_BUSYIf the PWM is currently transmitting the PWM sequence buffer.

◆ nrf_vt_backend_tx_buffer_write_frame()

uint32_t nrf_vt_backend_tx_buffer_write_frame ( const uint8_t const *  p_data,
uint32_t  bits 
)

Function for writing a data frame to the TX buffer.

This function will write a series of values representing the data frame to the PWM sequence buffer. It will run a bit slower than using nrf_vt_backend_tx_buffer_write_cast_frame due to more copy operations. To flush the sequence buffer onto the serial line, use nrf_vt_backend_tx_start.

Parameters
[in]p_dataPointer to the payload data.
[in]bitsAmount of bits in the payload data.
Return values
NRF_SUCCESSIf the frame was successfully written to the PWM sequence buffer.
NRF_ERROR_NO_MEMIf there was not enough space in the PWM sequence buffer to write the frame.
NRF_ERROR_BUSYIf the PWM is currently transmitting the PWM sequence buffer.

◆ nrf_vt_backend_tx_frame_cast_init()

uint32_t nrf_vt_backend_tx_frame_cast_init ( uint8_t  cast_no,
uint32_t  payload_bits 
)

Function for initializing a frame cast.

This function sets up a 'frame cast' for more efficient PWM sequence construction. The cast will be pre-filled with start and stop bits so that only the payload bits need to be copied on construction.

Parameters
[in]cast_noThe index of the cast to initialize.
[in]payload_bitsThe amount payload length in bits for the frame type this cast is used for.
Return values
NRF_SUCCESSIf the initialization was successful.
NRF_ERROR_INVALID_PARAMIf an invalid cast index or payload length was supplied.

◆ nrf_vt_backend_tx_start()

uint32_t nrf_vt_backend_tx_start ( void  )

Function for starting transmission of the TX buffer.

This function will start flushing the PWM sequence buffer onto the serial line using PWM. The function returns immediately and the PWM activity will run in the background until all the data has been flushed.

Return values
NRF_SUCCCESSIf the PWM sequence was started successfully.
NRF_ERROR_BUSYIf the PWM is already transmitting.

◆ nrf_vt_backend_tx_started()

bool nrf_vt_backend_tx_started ( void  )

Function for checking if the VT backend TX is running.

Return values
trueif the PWM is playing a sequence, false otherwise

◆ nrf_vt_backend_uninit()

void nrf_vt_backend_uninit ( void  )

Function for uninitializing the VT backend.

This function resets the configuration in the SAADC and PWM and the module itself.