VT Library  0.2
C:/Users/joni/Code/projects/nrf_vt/nrf_vt/nrf_vt_backend.h
1 
41 #ifndef NRF_VT_BACKEND_H__
42 #define NRF_VT_BACKEND_H__
43 
44 #include <stdint.h>
45 #include <stdbool.h>
46 
54 #define NRF_VT_PIN_DISCONNECTED (0)
57 /*
58  *@brief Module initialization structure
59  */
60 typedef struct
61 {
63  uint32_t baud_rate;
65  uint8_t rx_pin_p;
67  uint8_t rx_pin_n;
69  uint8_t tx_pin;
76 }
78 
79 
92 uint32_t nrf_vt_backend_init(nrf_vt_backend_init_t * p_config);
93 
94 
100 void nrf_vt_backend_uninit(void);
101 
102 
111 uint32_t nrf_vt_backend_rx_start(void);
112 
113 
121 void nrf_vt_backend_rx_stop(void);
122 
123 
129 bool nrf_vt_backend_rx_started(void);
130 
131 
146 uint32_t nrf_vt_backend_tx_buffer_write_frame(const uint8_t const * p_data, uint32_t bits);
147 
148 
161 uint32_t nrf_vt_backend_tx_frame_cast_init(uint8_t cast_no, uint32_t payload_bits);
162 
163 
178 uint32_t nrf_vt_backend_tx_buffer_write_cast_frame(uint8_t cast_no, const uint8_t const * p_data);
179 
180 
187 
188 
199 uint32_t nrf_vt_backend_tx_start(void);
200 
201 
207 bool nrf_vt_backend_tx_started(void);
208 
209 
213 void nrf_vt_backend_tx_stop(void);
214 
215 
218 #endif // NRF_VT_BACKEND_H__
bool nrf_vt_backend_rx_started(void)
Function for checking if the VT backend RX is running.
uint8_t saadc_interrupt_priority
Interrupt priority used for SAADC interrupts.
Definition: nrf_vt_backend.h:73
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.
uint32_t baud_rate
Requested bitrate. The backend will automatically calculate the required samples/bit.
Definition: nrf_vt_backend.h:63
void nrf_vt_backend_tx_stop(void)
Stop the VT backend TX.
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.
uint8_t tx_pin
TX pin.
Definition: nrf_vt_backend.h:69
uint32_t nrf_vt_backend_rx_start(void)
Function for starting the VT backend RX.
void nrf_vt_backend_rx_stop(void)
Function for stopping the VT backend RX.
uint32_t nrf_vt_backend_tx_start(void)
Function for starting transmission of the TX buffer.
void nrf_vt_backend_tx_buffer_clear(void)
Function for clearing the TX buffer.
void nrf_vt_backend_uninit(void)
Function for uninitializing the VT backend.
uint8_t pwm_interrupt_priority
Interrupt priority used for PWM interrupts.
Definition: nrf_vt_backend.h:71
uint32_t nrf_vt_backend_init(nrf_vt_backend_init_t *p_config)
Function for initializing the VT backend.
uint8_t rx_pin_n
Negative RX pin (may be set to NRF_VT_PIN_DISCONNECTED to use single-ended mode)
Definition: nrf_vt_backend.h:67
Definition: nrf_vt_backend.h:60
bool nrf_vt_backend_tx_started(void)
Function for checking if the VT backend TX is running.
uint8_t rx_pin_p
Positive RX pin.
Definition: nrf_vt_backend.h:65
uint32_t nrf_vt_backend_tx_frame_cast_init(uint8_t cast_no, uint32_t payload_bits)
Function for initializing a frame cast.
int16_t threshold_milli_volts
Threshold value in millivolts. Used to differentiate low and high bits.
Definition: nrf_vt_backend.h:75