VSF Documented
Macros | Functions
vsf_usart.c File Reference
#include "utilities/vsf_utilities.h"
#include "./vsf_usart.h"

Macros

#define VSF_USART_CFG_PROTECT_LEVEL   interrupt
 
#define __vsf_usart_protect   vsf_protect(VSF_USART_CFG_PROTECT_LEVEL)
 
#define __vsf_usart_unprotect   vsf_unprotect(VSF_USART_CFG_PROTECT_LEVEL)
 
#define ____USART_LOCAL(__N, __DONT_CARE)
 
#define __USART_LOCAL(__N, __DONT_CARE)    ____USART_LOCAL(__N, __DONT_CARE)
 

Functions

vsf_err_t vsf_usart_init (vsf_usart_t *usart_ptr, vsf_usart_cfg_t *cfg_ptr)
 initialize a usart instance.
 
fsm_rt_t vsf_usart_enable (vsf_usart_t *usart_ptr)
 enable interrupt masks of usart instance.
 
fsm_rt_t vsf_usart_disable (vsf_usart_t *usart_ptr)
 disable interrupt masks of usart instance.
 
vsf_usart_status_t vsf_usart_status (vsf_usart_t *usart_ptr)
 get the status of usart instance.
 
bool vsf_usart_read_byte (vsf_usart_t *usart_ptr, uint8_t *byte_ptr)
 
bool vsf_usart_write_byte (vsf_usart_t *usart_ptr, uint_fast8_t byte)
 
fsm_rt_t vsf_usart_request_read (vsf_usart_t *usart_ptr, uint8_t *buffer_ptr, uint_fast32_t size)
 
fsm_rt_t vsf_usart_request_write (vsf_usart_t *usart_ptr, uint8_t *buffer_ptr, uint_fast32_t size)
 
void vsf_usart_irqhandler (vsf_usart_t *usart_ptr)
 
void vsf_usart_event_register (vsf_usart_t *usart_ptr, vsf_usart_event_type_t type, vsf_usart_event_t event)
 
usart_event_status_t vsf_usart_event_enable (vsf_usart_t *usart_ptr, usart_event_status_t event_mask)
 
usart_event_status_t vsf_usart_event_disable (vsf_usart_t *usart_ptr, usart_event_status_t event_mask)
 
void vsf_usart_event_resume (vsf_usart_t *usart_ptr, usart_event_status_t event_status)
 

Macro Definition Documentation

◆ VSF_USART_CFG_PROTECT_LEVEL

#define VSF_USART_CFG_PROTECT_LEVEL   interrupt

◆ __vsf_usart_protect

#define __vsf_usart_protect   vsf_protect(VSF_USART_CFG_PROTECT_LEVEL)

◆ __vsf_usart_unprotect

#define __vsf_usart_unprotect   vsf_unprotect(VSF_USART_CFG_PROTECT_LEVEL)

◆ ____USART_LOCAL

#define ____USART_LOCAL (   __N,
  __DONT_CARE 
)
Value:
vsf_usart_t vsf_usart##__N = { \
.reg_ptr = USART##__N, \
.USART_IRQn = USART##__N##_IRQn, \
}; \
VSF_CAL_ROOT void USART##__N##_IRQHandler(void) \
{ \
vsf_usart_irqhandler(&vsf_usart##__N); \
}
Definition vsf_template_usart.h:661
USART_TypeDef * reg_ptr
Definition vsf_usart.h:98

◆ __USART_LOCAL

#define __USART_LOCAL (   __N,
  __DONT_CARE 
)     ____USART_LOCAL(__N, __DONT_CARE)

Function Documentation

◆ vsf_usart_init()

vsf_err_t vsf_usart_init ( vsf_usart_t usart_ptr,
vsf_usart_cfg_t cfg_ptr 
)

initialize a usart instance.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
[in]cfg_ptra pointer to structure vsf_usart_cfg_t
Returns
vsf_err_t: VSF_ERR_NONE if usart was initialized, or a negative error code
Note
It is not necessary to call vsf_usart_fini() to deinitialization. vsf_usart_init() should be called before any other usart API except vsf_usart_capability().

calculate baudrate

◆ vsf_usart_enable()

fsm_rt_t vsf_usart_enable ( vsf_usart_t usart_ptr)

enable interrupt masks of usart instance.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
Returns
none.

don't forget to enable sync clock and peripheral_clk here

◆ vsf_usart_disable()

fsm_rt_t vsf_usart_disable ( vsf_usart_t usart_ptr)

disable interrupt masks of usart instance.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
Returns
none.

don't forget to disable sync clock and peripheral_clk here

◆ vsf_usart_status()

vsf_usart_status_t vsf_usart_status ( vsf_usart_t usart_ptr)

get the status of usart instance.

Parameters
[in]usart_ptra pointer to structure vsf_usart_t
Returns
vsf_usart_status_t: return all status of current usart

◆ vsf_usart_read_byte()

bool vsf_usart_read_byte ( vsf_usart_t usart_ptr,
uint8_t byte_ptr 
)

◆ vsf_usart_write_byte()

bool vsf_usart_write_byte ( vsf_usart_t usart_ptr,
uint_fast8_t  byte 
)

◆ vsf_usart_request_read()

fsm_rt_t vsf_usart_request_read ( vsf_usart_t usart_ptr,
uint8_t buffer_ptr,
uint_fast32_t  size 
)

◆ vsf_usart_request_write()

fsm_rt_t vsf_usart_request_write ( vsf_usart_t usart_ptr,
uint8_t buffer_ptr,
uint_fast32_t  size 
)

◆ vsf_usart_irqhandler()

void vsf_usart_irqhandler ( vsf_usart_t usart_ptr)

◆ vsf_usart_event_register()

void vsf_usart_event_register ( vsf_usart_t usart_ptr,
vsf_usart_event_type_t  type,
vsf_usart_event_t  event 
)

◆ vsf_usart_event_enable()

usart_event_status_t vsf_usart_event_enable ( vsf_usart_t usart_ptr,
usart_event_status_t  event_mask 
)

◆ vsf_usart_event_disable()

usart_event_status_t vsf_usart_event_disable ( vsf_usart_t usart_ptr,
usart_event_status_t  event_mask 
)

◆ vsf_usart_event_resume()

void vsf_usart_event_resume ( vsf_usart_t usart_ptr,
usart_event_status_t  event_status 
)