Skip to content

Commit

Permalink
docs(BLE): Add Documentation for Resources used by PAL Layer for MAX3…
Browse files Browse the repository at this point in the history
…2655, MAX32665, and MAX32690 (#1058)

Co-authored-by: EricB-ADI <[email protected]>
Co-authored-by: EricB-ADI <[email protected]>
  • Loading branch information
3 people authored Jun 26, 2024
1 parent e1cae5b commit 47e0bf4
Show file tree
Hide file tree
Showing 33 changed files with 267 additions and 104 deletions.
29 changes: 19 additions & 10 deletions .github/workflows/BLE_Examples_Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -604,15 +604,15 @@ jobs:
run: |
#set advertising names
sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_dats/dats_main.c
sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_datc/datc_main.c
sed -i "s/'S'/'!'/g" Examples/MAX32665/Bluetooth/BLE_dats/dats_main.c
sed -i "s/'S'/'!'/g" Examples/MAX32690/Bluetooth/BLE_datc/datc_main.c
# sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_dats/dats_main.c
# sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_datc/datc_main.c
# sed -i "s/'S'/'!'/g" Examples/MAX32665/Bluetooth/BLE_dats/dats_main.c
# sed -i "s/'S'/'!'/g" Examples/MAX32690/Bluetooth/BLE_datc/datc_main.c
sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_otas/dats_main.c
sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_otac/datc_main.c
sed -i "s/'S'/'!'/g" Examples/MAX32665/Bluetooth/BLE_otas/dats_main.c
sed -i "s/'S'/'!'/g" Examples/MAX32690/Bluetooth/BLE_otac/datc_main.c
# sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_otas/dats_main.c
# sed -i "s/'S'/'?'/g" Examples/MAX32655/Bluetooth/BLE_otac/datc_main.c
# sed -i "s/'S'/'!'/g" Examples/MAX32665/Bluetooth/BLE_otas/dats_main.c
# sed -i "s/'S'/'!'/g" Examples/MAX32690/Bluetooth/BLE_otac/datc_main.c
- name: Erase Boards DATS
if: ${{env.MAX32655_DATS_CONNECTED_TEST == 'true' || env.MAX32665_DATS_CONNECTED_TEST == 'true' || env.MAX32690_DATS_CONNECTED_TEST == 'true'}}
Expand Down Expand Up @@ -643,7 +643,11 @@ jobs:
BLE_datc
suppress_output: true

build_flags: |
ADV_NAME=DAT?
ADV_NAME=DAT?
build: true
distclean: true

Expand Down Expand Up @@ -675,7 +679,12 @@ jobs:
max32655_board1
max32655_board2
max32665_board1
build_flags: |
ADV_NAME=OTA?
ADV_NAME=OTA?
ADV_NAME=OTA!
ADV_NAME=OTA!
project: |
BLE_otas
BLE_otac
Expand Down
8 changes: 4 additions & 4 deletions Examples/MAX32655/Bluetooth/BLE_datc/datc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static const appSecCfg_t datcSecCfg = {
DM_KEY_DIST_IRK, /*! Initiator key distribution flags */
DM_KEY_DIST_LTK | DM_KEY_DIST_IRK, /*! Responder key distribution flags */
FALSE, /*! TRUE if Out-of-band pairing data is present */
TRUE /*! TRUE to initiate security upon connection */
INIT_SECURITY /*! TRUE to initiate security upon connection */
};

/* OOB UART parameters */
Expand Down Expand Up @@ -569,9 +569,9 @@ static void datcScanReport(dmEvt_t *pMsg)
if (!connect && ((pData = DmFindAdType(DM_ADV_TYPE_LOCAL_NAME, pMsg->scanReport.len,
pMsg->scanReport.pData)) != NULL)) {
/* check length and device name */
if (pData[DM_AD_LEN_IDX] >= 4 && (pData[DM_AD_DATA_IDX] == 'D') &&
(pData[DM_AD_DATA_IDX + 1] == 'A') && (pData[DM_AD_DATA_IDX + 2] == 'T') &&
(pData[DM_AD_DATA_IDX + 3] == 'S')) {
char advName[] = ADV_NAME;
if (pData[DM_AD_LEN_IDX] == sizeof(advName) &&
!strncmp(advName, (char *)&(pData[DM_AD_DATA_IDX]), sizeof(advName))) {
connect = TRUE;
}
}
Expand Down
8 changes: 8 additions & 0 deletions Examples/MAX32655/Bluetooth/BLE_datc/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@ INIT_CENTRAL = 1
# Set to 1 to enable serial port trace messages
# Set to 2 to enable verbose messages
TRACE = 1

# set ADVTISEMENT name you want to connect
ADV_NAME?=DATS
PROJ_CFLAGS += -DADV_NAME=\"$(ADV_NAME)\"

### CONFIGURE security
# /*! TRUE to initiate security upon connection*/
PROJ_CFLAGS += -DINIT_SECURITY=TRUE
19 changes: 7 additions & 12 deletions Examples/MAX32655/Bluetooth/BLE_dats/dats_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static const appSecCfg_t datsSecCfg = {
DM_KEY_DIST_IRK, /*! Initiator key distribution flags */
DM_KEY_DIST_LTK | DM_KEY_DIST_IRK, /*! Responder key distribution flags */
FALSE, /*! TRUE if Out-of-band pairing data is present */
TRUE /*! TRUE to initiate security upon connection */
INIT_SECURITY /*! TRUE to initiate security upon connection */
};

/* OOB UART parameters */
Expand Down Expand Up @@ -214,15 +214,8 @@ static const uint8_t datsAdvDataDisc[] = {
};

/*! scan data, discoverable mode */
static const uint8_t datsScanDataDisc[] = {
/*! device name */
5, /*! length */
DM_ADV_TYPE_LOCAL_NAME, /*! AD type */
'D',
'A',
'T',
'S'
};
static const uint8_t deviceName[] = ADV_NAME;
static uint8_t datsScanDataDisc[sizeof(deviceName) + 2];

/**************************************************************************************************
Client Characteristic Configuration Descriptors
Expand Down Expand Up @@ -538,7 +531,9 @@ static void datsSetup(dmEvt_t *pMsg)
{
/* Initialize control information */
datsCb.restoringResList = FALSE;

memcpy(&datsScanDataDisc[2], deviceName, sizeof(deviceName));
datsScanDataDisc[0] = sizeof(deviceName);
datsScanDataDisc[1] = DM_ADV_TYPE_LOCAL_NAME;
/* set advertising and scan response data for discoverable mode */
AppAdvSetData(APP_ADV_DATA_DISCOVERABLE, sizeof(datsAdvDataDisc), (uint8_t *)datsAdvDataDisc);
AppAdvSetData(APP_SCAN_DATA_DISCOVERABLE, sizeof(datsScanDataDisc),
Expand Down Expand Up @@ -760,7 +755,7 @@ void DatsHandlerInit(wsfHandlerId_t handlerId)
AppGetBdAddr(addr);
APP_TRACE_INFO6("MAC Addr: %02x:%02x:%02x:%02x:%02x:%02x", addr[5], addr[4], addr[3], addr[2],
addr[1], addr[0]);
APP_TRACE_INFO1("Adv local name: %s", &datsScanDataDisc[2]);
APP_TRACE_INFO1("Adv local name: %s", deviceName);

/* store handler ID */
datsCb.handlerId = handlerId;
Expand Down
9 changes: 9 additions & 0 deletions Examples/MAX32655/Bluetooth/BLE_dats/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,12 @@ TRACE = 1
# Add services directory to build
IPATH += services
VPATH += services

# SET advertising name
ADV_NAME?=DATS
PROJ_CFLAGS += -DADV_NAME=\"$(ADV_NAME)\"


### CONFIGURE security
# /*! TRUE to initiate security upon connection*/
PROJ_CFLAGS += -DINIT_SECURITY=FALSE
8 changes: 4 additions & 4 deletions Examples/MAX32655/Bluetooth/BLE_otac/datc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static const appSecCfg_t datcSecCfg = {
DM_KEY_DIST_IRK, /*! Initiator key distribution flags */
DM_KEY_DIST_LTK | DM_KEY_DIST_IRK, /*! Responder key distribution flags */
FALSE, /*! TRUE if Out-of-band pairing data is present */
TRUE /*! TRUE to initiate security upon connection */
INIT_SECURITY /*! TRUE to initiate security upon connection */
};

/*! TRUE if Out-of-band pairing data is to be sent */
Expand Down Expand Up @@ -494,9 +494,9 @@ static void datcScanReport(dmEvt_t *pMsg)
if (!connect && ((pData = DmFindAdType(DM_ADV_TYPE_LOCAL_NAME, pMsg->scanReport.len,
pMsg->scanReport.pData)) != NULL)) {
/* check length and device name */
if (pData[DM_AD_LEN_IDX] >= 4 && (pData[DM_AD_DATA_IDX] == 'O') &&
(pData[DM_AD_DATA_IDX + 1] == 'T') && (pData[DM_AD_DATA_IDX + 2] == 'A') &&
(pData[DM_AD_DATA_IDX + 3] == 'S')) {
char advName[] = ADV_NAME;
if (pData[DM_AD_LEN_IDX] == sizeof(advName) &&
!strncmp(advName, (char *)&(pData[DM_AD_DATA_IDX]), sizeof(advName))) {
connect = TRUE;
}
}
Expand Down
10 changes: 10 additions & 0 deletions Examples/MAX32655/Bluetooth/BLE_otac/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,13 @@ fw_obj: $(FW_UPDATE_OBJ)

${FW_UPDATE_OBJ}: fw_update.S ${FW_UPDATE_BIN}
${CC} ${AFLAGS} -o ${@} -c fw_update.S

# set ADVTISEMENT name you want to connect
ADV_NAME?=DATS
PROJ_CFLAGS += -DADV_NAME=\"$(ADV_NAME)\"



### CONFIGURE security
# /*! TRUE to initiate security upon connection*/
PROJ_CFLAGS += -DINIT_SECURITY=TRUE
18 changes: 7 additions & 11 deletions Examples/MAX32655/Bluetooth/BLE_otas/dats_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static const appSecCfg_t datsSecCfg = {
DM_KEY_DIST_IRK, /*! Initiator key distribution flags */
DM_KEY_DIST_LTK | DM_KEY_DIST_IRK, /*! Responder key distribution flags */
FALSE, /*! TRUE if Out-of-band pairing data is present */
TRUE /*! TRUE to initiate security upon connection */
INIT_SECURITY /*! TRUE to initiate security upon connection */
};

/*! TRUE if Out-of-band pairing data is to be sent */
Expand Down Expand Up @@ -200,15 +200,8 @@ static const uint8_t datsAdvDataDisc[] = {
};

/*! scan data, discoverable mode */
static const uint8_t datsScanDataDisc[] = {
/*! device name */
5, /*! length */
DM_ADV_TYPE_LOCAL_NAME, /*! AD type */
'O',
'T',
'A',
'S'
};
static const uint8_t deviceName[] = ADV_NAME;
static uint8_t datsScanDataDisc[sizeof(deviceName) + 2];

/**************************************************************************************************
Client Characteristic Configuration Descriptors
Expand Down Expand Up @@ -462,6 +455,9 @@ static void datsSetup(dmEvt_t *pMsg)
{
/* Initialize control information */
datsCb.restoringResList = FALSE;
memcpy(&datsScanDataDisc[2], deviceName, sizeof(deviceName));
datsScanDataDisc[0] = sizeof(deviceName);
datsScanDataDisc[1] = DM_ADV_TYPE_LOCAL_NAME;

/* set advertising and scan response data for discoverable mode */
AppAdvSetData(APP_ADV_DATA_DISCOVERABLE, sizeof(datsAdvDataDisc), (uint8_t *)datsAdvDataDisc);
Expand Down Expand Up @@ -683,7 +679,7 @@ void DatsHandlerInit(wsfHandlerId_t handlerId)
AppGetBdAddr(addr);
APP_TRACE_INFO6("MAC Addr: %02x:%02x:%02x:%02x:%02x:%02x", addr[5], addr[4], addr[3], addr[2],
addr[1], addr[0]);
APP_TRACE_INFO1("Adv local name: %s", &datsScanDataDisc[2]);
APP_TRACE_INFO1("Adv local name: %s", deviceName);

/* store handler ID */
datsCb.handlerId = handlerId;
Expand Down
9 changes: 9 additions & 0 deletions Examples/MAX32655/Bluetooth/BLE_otas/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,12 @@ bl_obj: $(BOOTLOADER_OBJ)
${BOOTLOADER_OBJ}: bl_build.S ${BOOTLOADER_BIN}
${CC} ${AFLAGS} -o ${@} -c bl_build.S
endif

# SET advertising name
ADV_NAME?=DATS
PROJ_CFLAGS += -DADV_NAME=\"$(ADV_NAME)\"


### CONFIGURE security
# /*! TRUE to initiate security upon connection*/
PROJ_CFLAGS += -DINIT_SECURITY=TRUE
8 changes: 4 additions & 4 deletions Examples/MAX32665/Bluetooth/BLE_datc/datc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static const appSecCfg_t datcSecCfg = {
DM_KEY_DIST_IRK, /*! Initiator key distribution flags */
DM_KEY_DIST_LTK | DM_KEY_DIST_IRK, /*! Responder key distribution flags */
FALSE, /*! TRUE if Out-of-band pairing data is present */
TRUE /*! TRUE to initiate security upon connection */
INIT_SECURITY /*! TRUE to initiate security upon connection */
};

/* OOB UART parameters */
Expand Down Expand Up @@ -569,9 +569,9 @@ static void datcScanReport(dmEvt_t *pMsg)
if (!connect && ((pData = DmFindAdType(DM_ADV_TYPE_LOCAL_NAME, pMsg->scanReport.len,
pMsg->scanReport.pData)) != NULL)) {
/* check length and device name */
if (pData[DM_AD_LEN_IDX] >= 4 && (pData[DM_AD_DATA_IDX] == 'D') &&
(pData[DM_AD_DATA_IDX + 1] == 'A') && (pData[DM_AD_DATA_IDX + 2] == 'T') &&
(pData[DM_AD_DATA_IDX + 3] == 'S')) {
char advName[] = ADV_NAME;
if (pData[DM_AD_LEN_IDX] == sizeof(advName) &&
!strncmp(advName, (char *)&(pData[DM_AD_DATA_IDX]), sizeof(advName))) {
connect = TRUE;
}
}
Expand Down
8 changes: 8 additions & 0 deletions Examples/MAX32665/Bluetooth/BLE_datc/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ INIT_CENTRAL = 1
# Set to 1 to enable serial port trace messages
# Set to 2 to enable verbose messages
TRACE = 1

# set ADVTISEMENT name you want to connect
ADV_NAME?=DATS
PROJ_CFLAGS += -DADV_NAME=\"$(ADV_NAME)\"

### CONFIGURE security
# /*! TRUE to initiate security upon connection*/
PROJ_CFLAGS += -DINIT_SECURITY=TRUE
19 changes: 7 additions & 12 deletions Examples/MAX32665/Bluetooth/BLE_dats/dats_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static const appSecCfg_t datsSecCfg = {
DM_KEY_DIST_IRK, /*! Initiator key distribution flags */
DM_KEY_DIST_LTK | DM_KEY_DIST_IRK, /*! Responder key distribution flags */
FALSE, /*! TRUE if Out-of-band pairing data is present */
FALSE /*! TRUE to initiate security upon connection */
INIT_SECURITY /*! TRUE to initiate security upon connection */
};

/* OOB UART parameters */
Expand Down Expand Up @@ -214,15 +214,8 @@ static const uint8_t datsAdvDataDisc[] = {
};

/*! scan data, discoverable mode */
static const uint8_t datsScanDataDisc[] = {
/*! device name */
5, /*! length */
DM_ADV_TYPE_LOCAL_NAME, /*! AD type */
'D',
'A',
'T',
'S'
};
static const uint8_t deviceName[] = ADV_NAME;
static uint8_t datsScanDataDisc[sizeof(deviceName) + 2];

/**************************************************************************************************
Client Characteristic Configuration Descriptors
Expand Down Expand Up @@ -537,7 +530,9 @@ static void datsSetup(dmEvt_t *pMsg)
{
/* Initialize control information */
datsCb.restoringResList = FALSE;

memcpy(&datsScanDataDisc[2], deviceName, sizeof(deviceName));
datsScanDataDisc[0] = sizeof(deviceName);
datsScanDataDisc[1] = DM_ADV_TYPE_LOCAL_NAME;
/* set advertising and scan response data for discoverable mode */
AppAdvSetData(APP_ADV_DATA_DISCOVERABLE, sizeof(datsAdvDataDisc), (uint8_t *)datsAdvDataDisc);
AppAdvSetData(APP_SCAN_DATA_DISCOVERABLE, sizeof(datsScanDataDisc),
Expand Down Expand Up @@ -759,7 +754,7 @@ void DatsHandlerInit(wsfHandlerId_t handlerId)
AppGetBdAddr(addr);
APP_TRACE_INFO6("MAC Addr: %02x:%02x:%02x:%02x:%02x:%02x", addr[5], addr[4], addr[3], addr[2],
addr[1], addr[0]);
APP_TRACE_INFO1("Adv local name: %s", &datsScanDataDisc[2]);
APP_TRACE_INFO1("Adv local name: %s", deviceName);

/* store handler ID */
datsCb.handlerId = handlerId;
Expand Down
9 changes: 9 additions & 0 deletions Examples/MAX32665/Bluetooth/BLE_dats/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,12 @@ TRACE = 1
# Add services directory to build
IPATH += services
VPATH += services


# SET advertising name
ADV_NAME?=DATS
PROJ_CFLAGS += -DADV_NAME=\"$(ADV_NAME)\"

### CONFIGURE security
# /*! TRUE to initiate security upon connection*/
PROJ_CFLAGS += -DINIT_SECURITY=FALSE
8 changes: 4 additions & 4 deletions Examples/MAX32665/Bluetooth/BLE_otac/datc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static const appSecCfg_t datcSecCfg = {
DM_KEY_DIST_IRK, /*! Initiator key distribution flags */
DM_KEY_DIST_LTK | DM_KEY_DIST_IRK, /*! Responder key distribution flags */
FALSE, /*! TRUE if Out-of-band pairing data is present */
TRUE /*! TRUE to initiate security upon connection */
INIT_SECURITY /*! TRUE to initiate security upon connection */
};

/*! TRUE if Out-of-band pairing data is to be sent */
Expand Down Expand Up @@ -494,9 +494,9 @@ static void datcScanReport(dmEvt_t *pMsg)
if (!connect && ((pData = DmFindAdType(DM_ADV_TYPE_LOCAL_NAME, pMsg->scanReport.len,
pMsg->scanReport.pData)) != NULL)) {
/* check length and device name */
if (pData[DM_AD_LEN_IDX] >= 4 && (pData[DM_AD_DATA_IDX] == 'O') &&
(pData[DM_AD_DATA_IDX + 1] == 'T') && (pData[DM_AD_DATA_IDX + 2] == 'A') &&
(pData[DM_AD_DATA_IDX + 3] == 'S')) {
char advName[] = ADV_NAME;
if (pData[DM_AD_LEN_IDX] == sizeof(advName) &&
!strncmp(advName, (char *)&(pData[DM_AD_DATA_IDX]), sizeof(advName))) {
connect = TRUE;
}
}
Expand Down
10 changes: 10 additions & 0 deletions Examples/MAX32665/Bluetooth/BLE_otac/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,13 @@ fw_obj: $(FW_UPDATE_OBJ)
${FW_UPDATE_OBJ}: fw_update.S ${FW_UPDATE_BIN}
${CC} ${AFLAGS} -o ${@} -c fw_update.S


# set ADVTISEMENT name you want to connect
ADV_NAME?=DATS
PROJ_CFLAGS += -DADV_NAME=\"$(ADV_NAME)\"



### CONFIGURE security
# /*! TRUE to initiate security upon connection*/
PROJ_CFLAGS += -DINIT_SECURITY=TRUE
Loading

0 comments on commit 47e0bf4

Please sign in to comment.