Microchip® Advanced Software Framework

interface.c File Reference

BM module Interface definitions.

Copyright (c) 2018 Microchip Technology Inc. and its subsidiaries.

#include "platform_files.h"
#include "bm_mode.h"
#include "bm_application_mode.h"
#include "bm_program_mode.h"
#include "bm_utils.h"
#include "fifo.h"
#include "event_mem.h"
#include "memory.h"
#include "ble_api.h"
#include "dfu_api.h"
#include "interface.h"

Functions

bool ble_response_check (uint8_t byte)
 
event_tget_received_cmd_frame (void)
 
void init_fifo (void)
 
ble_status_t interface_cmd_send_no_wait (uint8_t *cmd, uint32_t cmd_len)
 
ble_status_t interface_cmd_send_wait (uint8_t *cmd, uint32_t cmd_len, uint8_t event_id)
 
ble_status_t interface_cmd_send_wait_time (uint8_t *cmd, uint32_t cmd_len, uint8_t event_id, uint16_t timeout)
 
static void * interface_create_timer (timer_cb_t timer_cb)
 
event_status_t interface_event_get (void)
 
bool interface_event_process (void)
 
static void interface_event_timer_cb (void)
 
ble_status_t interface_event_wait (uint8_t event_id)
 
ble_status_t interface_event_wait_time (uint8_t event_id, uint16_t timeout)
 
ble_status_t interface_init (platform_init_t *platform_init)
 
uint8_t interface_process_fifo_data (void)
 
static void interface_start_timer (void *timer_handle, uint32_t ms)
 
static void interface_stop_timer (void *timer_handle)
 
static void interface_timer_callback (void *arg1)
 
static void interface_uart_timer_cb (void)
 
bool is_waiting_for_response (void)
 
bool is_waiting_for_this_response (uint8_t event_id)
 
void store_uart_data (uint16_t rx_data)
 

Variables

event_t appEvent
 
uart_read_async_cb_t ble_uart_receive_async
 
uart_write_sync_cb_t ble_uart_send_sync
 
static bool hw_timer_status = 0
 
static void * interface_event_timer_handle = NULL
 
static bool interface_event_timer_timeout = false
 
static void * interface_uart_timer_handle = NULL
 
static bool interface_uart_timer_timeout = false
 
static bool is_fifo_full = false
 
ble_platform_api_list_tplatform
 
static void * platform_timer_handle = NULL
 
static uint8_t resp_event_id = INVALID_EVENT_ID
 
static fifo_t rx_fifo
 
static uint8_t rx_fifo_buffer [1024]
 
static sw_timer_t sw_timers [INTERFACE_SW_TIMERS] = {0}
 

bool ble_response_check ( uint8_t  byte)
void init_fifo ( void  )

References fifo_init(), and rx_fifo_buffer.

Referenced by interface_init().

ble_status_t interface_cmd_send_no_wait ( uint8_t *  cmd,
uint32_t  cmd_len 
)
ble_status_t interface_cmd_send_wait ( uint8_t *  cmd,
uint32_t  cmd_len,
uint8_t  event_id 
)

References BLE_SUCCESS, BLE_UART_TIMEOUT, INTERFACE_CMD_COMPLETE_TIMEOUT, interface_event_process(), interface_start_timer(), interface_stop_timer(), interface_uart_timer_handle, interface_uart_timer_timeout, resp_event_id, and ble_platform_api_list_t::uart_tx_cb.

Referenced by ble_adv_data_set(), ble_adv_param_set(), ble_adv_start(), ble_adv_stop(), ble_cancel_connection(), ble_characteristic_attribute_read_request(), ble_characteristic_attribute_read_response(), ble_characteristic_read(), ble_characteristic_read_by_uuid(), ble_characteristic_reliable_write_request_cancel(), ble_characteristic_reliable_write_request_execute(), ble_characteristic_reliable_write_request_prepare(), ble_characteristic_reliable_write_response_execute(), ble_characteristic_reliable_write_response_prepare(), ble_characteristic_value_read(), ble_characteristic_value_send(), ble_characteristic_value_update(), ble_characteristic_write_with_response(), ble_characteristic_write_without_respose(), ble_error_response_send(), ble_gatt_service_create(), ble_gatt_service_read(), ble_init(), ble_pair_device_delete(), ble_pair_device_erase_all(), ble_pair_mode_get(), ble_pair_mode_set(), ble_pair_passkey_clear(), ble_pair_passkey_confirm(), ble_pair_passkey_enter(), ble_pair_passkey_erase_digits(), ble_pair_passkey_reply(), ble_pair_request(), ble_primary_service_characteristics_discover(), ble_primary_service_characteristics_read(), ble_primary_service_read_all(), ble_read_response_send(), ble_rssi_read(), ble_scan_param_set(), ble_scan_resp_data_set(), ble_scan_start(), ble_set_connection_params(), ble_set_device_name(), ble_shutdown(), ble_transparent_uart_data_send(), ble_transparent_uart_enable(), ble_update_connection_parameters(), ble_write_response_send(), dfu_deinit(), dfu_init(), dfu_program_memory_erase(), dfu_program_memory_read(), dfu_program_memory_write(), and dfu_program_memory_write_continue().

ble_status_t interface_cmd_send_wait_time ( uint8_t *  cmd,
uint32_t  cmd_len,
uint8_t  event_id,
uint16_t  timeout 
)
static void* interface_create_timer ( timer_cb_t  timer_cb)
static
static void interface_event_timer_cb ( void  )
static

References interface_event_timer_timeout.

Referenced by interface_init().

static void interface_start_timer ( void *  timer_handle,
uint32_t  ms 
)
static
static void interface_uart_timer_cb ( void  )
static

References interface_uart_timer_timeout.

Referenced by interface_init().

bool is_waiting_for_response ( void  )

References INVALID_EVENT_ID, and resp_event_id.

Referenced by interface_event_process().

bool is_waiting_for_this_response ( uint8_t  event_id)

References INVALID_EVENT_ID, and resp_event_id.

Referenced by interface_event_process().

event_t appEvent
uart_read_async_cb_t ble_uart_receive_async
uart_write_sync_cb_t ble_uart_send_sync
bool hw_timer_status = 0
static
void* interface_event_timer_handle = NULL
static

Referenced by interface_init().

bool interface_event_timer_timeout = false
static
bool is_fifo_full = false
static
void* platform_timer_handle = NULL
static
fifo_t rx_fifo
static
uint8_t rx_fifo_buffer[1024]
static

Referenced by init_fifo().

sw_timer_t sw_timers[INTERFACE_SW_TIMERS] = {0}
static