Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
PICOUART - Picopower UART

Driver for the PICOUART (Picopower UART).

Provides functions for configuring and operating the PICOUART.

Data Structures

struct  picouart_config
 
struct  picouart_dev_inst
 

Enumerations

enum  picouart_actions_on_rx {
  PICOUART_ACTION_NONE = PICOUART_CFG_SOURCE(0),
  PICOUART_ACTION_WAKEUP_ON_STARTBIT = PICOUART_CFG_SOURCE(1),
  PICOUART_ACTION_WAKEUP_ON_FULLFRAME = PICOUART_CFG_SOURCE(2),
  PICOUART_ACTION_WAKEUP_ON_MATCH = PICOUART_CFG_SOURCE(3),
  PICOUART_ACTION_EVENT_ON_STARTBIT,
  PICOUART_ACTION_EVENT_ON_FULLFRAME,
  PICOUART_ACTION_EVENT_ON_MATCH
}
 

Functions

void picouart_disable (struct picouart_dev_inst *const dev_inst)
 Disable the PICOUART. More...
 
void picouart_enable (struct picouart_dev_inst *const dev_inst)
 Enable the PICOUART. More...
 
void picouart_get_config_defaults (struct picouart_config *config)
 Load a pre-defined configuration into the configuration structure. More...
 
status_code_t picouart_init (struct picouart_dev_inst *const dev_inst, Picouart *hw_dev, struct picouart_config *config)
 Initializes the PICOUART module, based on a config struct. More...
 
bool picouart_is_data_ready (struct picouart_dev_inst *const dev_inst)
 Check the data ready status of PICOUART. More...
 
bool picouart_is_enabled (struct picouart_dev_inst *const dev_inst)
 Check the enable status of PICOUART. More...
 
status_code_t picouart_read (struct picouart_dev_inst *const dev_inst, uint8_t *result)
 Get the current RHR value. More...
 
status_code_t picouart_set_config (struct picouart_dev_inst *const dev_inst, struct picouart_config *config)
 Configures the PICOUART module, based on a config struct. More...
 

Enumerator
PICOUART_ACTION_NONE 

No action upon reception.

Wake-up on start bit detection

PICOUART_ACTION_WAKEUP_ON_STARTBIT 

Wake-up on full frame reception.

PICOUART_ACTION_WAKEUP_ON_FULLFRAME 

Wake up on character match.

PICOUART_ACTION_WAKEUP_ON_MATCH 

Event enable on start bit detection.

PICOUART_ACTION_EVENT_ON_STARTBIT 

Event enable on full frame reception.

PICOUART_ACTION_EVENT_ON_FULLFRAME 

Event enable on character match.

PICOUART_ACTION_EVENT_ON_MATCH 

void picouart_disable ( struct picouart_dev_inst *const  dev_inst)

Disable the PICOUART.

Parameters
dev_instpointer to the device struct

References picouart_dev_inst::dev_ptr, SLEEPMGR_BACKUP, sleepmgr_unlock_mode(), and sysclk_disable_peripheral_clock().

void picouart_enable ( struct picouart_dev_inst *const  dev_inst)

Enable the PICOUART.

Parameters
dev_instpointer to the device struct

References picouart_dev_inst::dev_ptr, SLEEPMGR_BACKUP, sleepmgr_lock_mode(), and sysclk_enable_peripheral_clock().

Referenced by main().

void picouart_get_config_defaults ( struct picouart_config config)

Load a pre-defined configuration into the configuration structure.

The config struct is loaded with predefined values to allow quick startup.

Parameters
configpointer to the config struct

References picouart_config::action, picouart_config::match, and PICOUART_ACTION_WAKEUP_ON_FULLFRAME.

Referenced by main().

status_code_t picouart_init ( struct picouart_dev_inst *const  dev_inst,
Picouart *  hw_dev,
struct picouart_config config 
)

Initializes the PICOUART module, based on a config struct.

Parameters
dev_instpointer to the device struct
hw_devpointer to the register base address of the device
configpointer to the config struct

References picouart_dev_inst::dev_ptr, and picouart_set_config().

Referenced by main().

bool picouart_is_data_ready ( struct picouart_dev_inst *const  dev_inst)

Check the data ready status of PICOUART.

Parameters
dev_instpointer to the device struct
Returns
true if data is ready

References picouart_dev_inst::dev_ptr.

bool picouart_is_enabled ( struct picouart_dev_inst *const  dev_inst)

Check the enable status of PICOUART.

Parameters
dev_instpointer to the device struct
Returns
true if PICOUART is enabled

References picouart_dev_inst::dev_ptr.

status_code_t picouart_read ( struct picouart_dev_inst *const  dev_inst,
uint8_t *  result 
)

Get the current RHR value.

Parameters
dev_instpointer to the device struct
resultpointer to store result
Returns
The current RHR value.

References picouart_dev_inst::dev_ptr, and STATUS_OK.

status_code_t picouart_set_config ( struct picouart_dev_inst *const  dev_inst,
struct picouart_config config 
)

Configures the PICOUART module, based on a config struct.

Parameters
dev_instpointer to the device struct
configpointer to the config struct

References picouart_config::action, picouart_dev_inst::dev_ptr, picouart_config::match, STATUS_OK, sysclk_disable_peripheral_clock(), sysclk_enable_peripheral_clock(), and SYSCLK_PICOUART.

Referenced by main(), and picouart_init().