Embedded SDK
Embedded SDK
Classes | Macros | Enumerations | Functions
ledger_ble.c File Reference
#include "os.h"
#include "os_settings.h"
#include "os_io_seproxyhal.h"
#include "ble_hci_le.h"
#include "ble_hal_aci.h"
#include "ble_gap_aci.h"
#include "ble_l2cap_aci.h"
#include "ble_gatt_aci.h"
#include "ble_legacy.h"
#include "lcx_rng.h"
#include "ledger_protocol.h"
#include "ledger_ble.h"
Include dependency graph for ledger_ble.c:

Go to the source code of this file.

Classes

struct  ble_connection_t
 
struct  ledger_ble_data_t
 

Macros

#define MAX_MTU_SIZE   156
 
#define BLE_SLAVE_CONN_INTERVAL_MIN   12
 
#define BLE_SLAVE_CONN_INTERVAL_MAX   24
 
#define BLE_ADVERTISING_INTERVAL_MIN   48
 
#define BLE_ADVERTISING_INTERVAL_MAX   96
 
#define LOG_BLE(...)
 

Enumerations

enum  ble_state_t {
  BLE_STATE_INITIALIZING , BLE_STATE_INITIALIZED , BLE_STATE_CONFIGURE_ADVERTISING , BLE_STATE_CONNECTING ,
  BLE_STATE_CONNECTED , BLE_STATE_DISCONNECTING
}
 
enum  ble_init_step_t {
  BLE_INIT_STEP_IDLE , BLE_INIT_STEP_RESET , BLE_INIT_STEP_STATIC_ADDRESS , BLE_INIT_STEP_GATT_INIT ,
  BLE_INIT_STEP_GAP_INIT , BLE_INIT_STEP_SET_IO_CAPABILITIES , BLE_INIT_STEP_SET_AUTH_REQUIREMENTS , BLE_INIT_STEP_ADD_SERVICE ,
  BLE_INIT_STEP_ADD_NOTIFICATION_CHARACTERISTIC , BLE_INIT_STEP_ADD_WRITE_CHARACTERISTIC , BLE_INIT_STEP_ADD_WRITE_COMMAND_CHARACTERISTIC , BLE_INIT_STEP_SET_TX_POWER_LEVEL ,
  BLE_INIT_STEP_CONFIGURE_ADVERTISING , BLE_INIT_STEP_END
}
 
enum  ble_config_adv_step_t {
  BLE_CONFIG_ADV_STEP_IDLE , BLE_CONFIG_ADV_STEP_SET_ADV_DATAS , BLE_CONFIG_ADV_STEP_SET_SCAN_RSP_DATAS , BLE_CONFIG_ADV_STEP_SET_GAP_DEVICE_NAME ,
  BLE_CONFIG_ADV_STEP_START , BLE_CONFIG_ADV_STEP_END
}
 

Functions

void LEDGER_BLE_init (void)
 
void LEDGER_BLE_set_recv_buffer (uint8_t *buffer, uint16_t buffer_length)
 
void LEDGER_BLE_send (const uint8_t *packet, uint16_t packet_length)
 
void LEDGER_BLE_receive (const uint8_t *spi_buffer)
 
void LEDGER_BLE_enable_advertising (uint8_t enable)
 
void LEDGER_BLE_reset_pairings (void)
 
void LEDGER_BLE_accept_pairing (uint8_t status)
 
int hci_send_req (struct hci_request *p_cmd, uint8_t async)
 
void BLE_power (unsigned char powered, const char *discovered_name)
 

Macro Definition Documentation

◆ BLE_ADVERTISING_INTERVAL_MAX

#define BLE_ADVERTISING_INTERVAL_MAX   96

Definition at line 149 of file ledger_ble.c.

◆ BLE_ADVERTISING_INTERVAL_MIN

#define BLE_ADVERTISING_INTERVAL_MIN   48

Definition at line 148 of file ledger_ble.c.

◆ BLE_SLAVE_CONN_INTERVAL_MAX

#define BLE_SLAVE_CONN_INTERVAL_MAX   24

Definition at line 146 of file ledger_ble.c.

◆ BLE_SLAVE_CONN_INTERVAL_MIN

#define BLE_SLAVE_CONN_INTERVAL_MIN   12

Definition at line 145 of file ledger_ble.c.

◆ LOG_BLE

#define LOG_BLE (   ...)

Definition at line 154 of file ledger_ble.c.

◆ MAX_MTU_SIZE

#define MAX_MTU_SIZE   156

Definition at line 143 of file ledger_ble.c.

Enumeration Type Documentation

◆ ble_config_adv_step_t

Enumerator
BLE_CONFIG_ADV_STEP_IDLE 
BLE_CONFIG_ADV_STEP_SET_ADV_DATAS 
BLE_CONFIG_ADV_STEP_SET_SCAN_RSP_DATAS 
BLE_CONFIG_ADV_STEP_SET_GAP_DEVICE_NAME 
BLE_CONFIG_ADV_STEP_START 
BLE_CONFIG_ADV_STEP_END 

Definition at line 63 of file ledger_ble.c.

◆ ble_init_step_t

Enumerator
BLE_INIT_STEP_IDLE 
BLE_INIT_STEP_RESET 
BLE_INIT_STEP_STATIC_ADDRESS 
BLE_INIT_STEP_GATT_INIT 
BLE_INIT_STEP_GAP_INIT 
BLE_INIT_STEP_SET_IO_CAPABILITIES 
BLE_INIT_STEP_SET_AUTH_REQUIREMENTS 
BLE_INIT_STEP_ADD_SERVICE 
BLE_INIT_STEP_ADD_NOTIFICATION_CHARACTERISTIC 
BLE_INIT_STEP_ADD_WRITE_CHARACTERISTIC 
BLE_INIT_STEP_ADD_WRITE_COMMAND_CHARACTERISTIC 
BLE_INIT_STEP_SET_TX_POWER_LEVEL 
BLE_INIT_STEP_CONFIGURE_ADVERTISING 
BLE_INIT_STEP_END 

Definition at line 46 of file ledger_ble.c.

◆ ble_state_t

Enumerator
BLE_STATE_INITIALIZING 
BLE_STATE_INITIALIZED 
BLE_STATE_CONFIGURE_ADVERTISING 
BLE_STATE_CONNECTING 
BLE_STATE_CONNECTED 
BLE_STATE_DISCONNECTING 

Definition at line 37 of file ledger_ble.c.

Function Documentation

◆ BLE_power()

void BLE_power ( unsigned char  powered,
const char *  discovered_name 
)

Definition at line 1204 of file ledger_ble.c.

◆ hci_send_req()

int hci_send_req ( struct hci_request *  p_cmd,
uint8_t  async 
)

Definition at line 1187 of file ledger_ble.c.

◆ LEDGER_BLE_accept_pairing()

void LEDGER_BLE_accept_pairing ( uint8_t  status)

Definition at line 1177 of file ledger_ble.c.

◆ LEDGER_BLE_enable_advertising()

void LEDGER_BLE_enable_advertising ( uint8_t  enable)

Definition at line 1144 of file ledger_ble.c.

◆ LEDGER_BLE_init()

void LEDGER_BLE_init ( void  )

Definition at line 1010 of file ledger_ble.c.

◆ LEDGER_BLE_receive()

void LEDGER_BLE_receive ( const uint8_t spi_buffer)

Definition at line 1076 of file ledger_ble.c.

◆ LEDGER_BLE_reset_pairings()

void LEDGER_BLE_reset_pairings ( void  )

Definition at line 1163 of file ledger_ble.c.

◆ LEDGER_BLE_send()

void LEDGER_BLE_send ( const uint8_t packet,
uint16_t  packet_length 
)

Definition at line 1048 of file ledger_ble.c.

◆ LEDGER_BLE_set_recv_buffer()

void LEDGER_BLE_set_recv_buffer ( uint8_t buffer,
uint16_t  buffer_length 
)

Definition at line 1041 of file ledger_ble.c.