uart: add pre uart hook
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
@@ -61,5 +61,6 @@ typedef struct {
|
||||
mraa_result_t (*spi_init_pre) (int bus);
|
||||
mraa_result_t (*spi_init_post) (mraa_spi_context spi);
|
||||
|
||||
mraa_result_t (*uart_init_pre) (int index);
|
||||
mraa_result_t (*uart_init_post) (mraa_uart_context uart);
|
||||
} mraa_adv_func_t;
|
||||
|
||||
@@ -33,6 +33,11 @@
|
||||
mraa_uart_context
|
||||
mraa_uart_init(int index)
|
||||
{
|
||||
if (advance_func->uart_init_pre != NULL) {
|
||||
if (advance_func->uart_init_pre(index) != MRAA_SUCCESS)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( mraa_setup_uart(index) != MRAA_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user