Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
ledger_ble.h
Go to the documentation of this file.
1
2/*******************************************************************************
3 * Ledger Nano S - Secure firmware
4 * (c) 2022 Ledger
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 ********************************************************************************/
18
19#pragma once
20
21/* Includes ------------------------------------------------------------------*/
22#include <stdint.h>
23#include "os_id.h"
24#include "lcx_crc.h"
25
26/* Exported enumerations -----------------------------------------------------*/
27
28/* Exported types, structures, unions ----------------------------------------*/
29
30/* Exported defines --------------------------------------------------------*/
31
32/* Exported macros------------------------------------------------------------*/
33
34/* Exported variables --------------------------------------------------------*/
35
36/* Exported functions prototypes--------------------------------------------- */
37void LEDGER_BLE_init(void);
38void LEDGER_BLE_send(const uint8_t *packet, uint16_t packet_length);
39void LEDGER_BLE_receive(const uint8_t *spi_buffer);
40void LEDGER_BLE_set_recv_buffer(uint8_t *buffer, uint16_t buffer_length);
44
45#define LEDGER_BLE_get_mac_address(address) \
46 { \
47 unsigned char se_serial[8] = {0}; \
48 os_serial(se_serial, sizeof(se_serial)); \
49 unsigned int uid = cx_crc16(se_serial, 4); \
50 address[0] = uid; \
51 address[1] = uid >> 8; \
52 uid = cx_crc16(se_serial + 4, 4); \
53 address[2] = uid; \
54 address[3] = uid >> 8; \
55 address[4] = 0xF1; \
56 address[5] = 0xDE; \
57 }
CRC (Cyclic Redundancy Check).
void LEDGER_BLE_receive(const uint8_t *spi_buffer)
void LEDGER_BLE_reset_pairings(void)
void LEDGER_BLE_enable_advertising(uint8_t enable)
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_accept_pairing(uint8_t status)
void LEDGER_BLE_init(void)
unsigned short uint16_t
Definition usbd_conf.h:54
unsigned char uint8_t
Definition usbd_conf.h:53