Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BLE] enable use of local APDU buffer #403

Merged
merged 3 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile.defines
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ DEFINES += HAVE_BAGL_FONT_INTER_REGULAR_24PX
DEFINES += HAVE_BAGL_FONT_INTER_SEMIBOLD_24PX
DEFINES += HAVE_BAGL_FONT_INTER_MEDIUM_32PX
DEFINES += HAVE_BAGL_FONT_HMALPHAMONO_MEDIUM_32PX
DEFINES += HAVE_INAPP_BLE_PAIRING
DEFINES += HAVE_NBGL
DEFINES += HAVE_PIEZO_SOUND
DEFINES += HAVE_SE_TOUCH
Expand Down Expand Up @@ -212,6 +213,7 @@ DEFINES += HAVE_MCU_SERIAL_STORAGE
DEFINES += HAVE_FONTS
# already defined within apps
# DEFINES += HAVE_BLE
DEFINES += HAVE_INAPP_BLE_PAIRING
yhql marked this conversation as resolved.
Show resolved Hide resolved
DEFINES += HAVE_BATTERY
endif

Expand Down
9 changes: 6 additions & 3 deletions include/ledger_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ enum {

/* Exported types, structures, unions ----------------------------------------*/
typedef struct ledger_protocol_s {
uint8_t *tx_apdu_buffer;
const uint8_t *tx_apdu_buffer;

uint16_t tx_apdu_length;
uint16_t tx_apdu_sequence_number;
uint16_t tx_apdu_offset;
Expand All @@ -45,6 +46,8 @@ typedef struct ledger_protocol_s {
uint16_t rx_apdu_length;
uint16_t rx_apdu_offset;

uint8_t *rx_dst_buffer;

uint16_t mtu;
uint8_t mtu_negotiated;
} ledger_protocol_t;
Expand All @@ -57,5 +60,5 @@ typedef struct ledger_protocol_s {

/* Exported functions prototypes--------------------------------------------- */
void LEDGER_PROTOCOL_init(ledger_protocol_t *data);
void LEDGER_PROTOCOL_rx(uint8_t *buffer, uint16_t length);
void LEDGER_PROTOCOL_tx(uint8_t *buffer, uint16_t length);
void LEDGER_PROTOCOL_rx(const uint8_t *buffer, uint16_t length);
void LEDGER_PROTOCOL_tx(const uint8_t *buffer, uint16_t length);
5 changes: 3 additions & 2 deletions lib_blewbxx_impl/include/ledger_ble.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@

/* Exported functions prototypes--------------------------------------------- */
void LEDGER_BLE_init(void);
void LEDGER_BLE_send(uint8_t *packet, uint16_t packet_length);
void LEDGER_BLE_receive(void);
void LEDGER_BLE_send(const uint8_t *packet, uint16_t packet_length);
void LEDGER_BLE_receive(const uint8_t *spi_buffer);
void LEDGER_BLE_set_recv_buffer(uint8_t *buffer, uint16_t buffer_length);
void LEDGER_BLE_enable_advertising(uint8_t enable);
void LEDGER_BLE_reset_pairings(void);
void LEDGER_BLE_accept_pairing(uint8_t status);
Expand Down
Loading
Loading