Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
card10
firmware
Commits
2766e2f1
Commit
2766e2f1
authored
5 years ago
by
danukeru
Committed by
schneider
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
During startup of the BLE, the advert name is pulled off the random bytes of the mac in mac.txt.
parent
7df76031
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
epicardium/ble/ble.c
+2
-5
2 additions, 5 deletions
epicardium/ble/ble.c
epicardium/ble/ble_main.c
+21
-3
21 additions, 3 deletions
epicardium/ble/ble_main.c
flash-all.gdb
+3
-0
3 additions, 0 deletions
flash-all.gdb
with
26 additions
and
8 deletions
epicardium/ble/ble.c
+
2
−
5
View file @
2766e2f1
...
...
@@ -90,16 +90,13 @@ static void WsfInit(void)
/* TODO: We need a source of MACs */
static
void
setAddress
(
void
)
{
uint8_t
bdAddr
[
6
]
=
{
0x
02
,
0x
02
,
0x
44
,
0x
8B
,
0x0
5
,
0x00
};
uint8_t
bdAddr
[
6
]
=
{
0x
CA
,
0x
4D
,
0x
10
,
0x
00
,
0x0
0
,
0x00
};
char
buf
[
32
];
int
result
=
fs_read_text_file
(
"mac.txt"
,
buf
,
sizeof
(
buf
));
if
(
result
==
-
1
)
{
APP_TRACE_INFO0
(
"mac.txt not found, generating random MAC"
);
bdAddr
[
0
]
=
0xCA
;
bdAddr
[
1
]
=
0x4D
;
bdAddr
[
2
]
=
0x10
;
epic_trng_read
(
bdAddr
+
3
,
3
);
sprintf
(
buf
,
"%02x:%02x:%02x:%02x:%02x:%02x
\n
"
,
...
...
@@ -123,7 +120,7 @@ static void setAddress(void)
bdAddr
[
4
]
=
b
;
bdAddr
[
5
]
=
a
;
}
LOG_INFO
(
"ble"
,
"Setting MAC address to %02X:%02X:%02X:%02X:%02X:%02X"
,
...
...
This diff is collapsed.
Click to expand it.
epicardium/ble/ble_main.c
+
21
−
3
View file @
2766e2f1
...
...
@@ -13,9 +13,11 @@
*/
/* clang-format off */
/* clang-formet turned off for easier diffing against orginal file */
#include
<stdio.h>
#include
<string.h>
#include
"wsf_types.h"
#include
"util/bstream.h"
#include
"fs_util.h"
#include
"wsf_msg.h"
#include
"wsf_trace.h"
#include
"hci_api.h"
...
...
@@ -155,12 +157,12 @@ static const uint8_t bleAdvDataDisc[] =
};
/*! scan data, discoverable mode */
static
const
uint8_t
bleScanDataDisc
[]
=
uint8_t
bleScanDataDisc
[]
=
{
/*! device name */
7
,
/*! length */
14
,
/*! length */
DM_ADV_TYPE_LOCAL_NAME
,
/*! AD type */
'c'
,
'a'
,
'r'
,
'd'
,
'1'
,
'0'
'c'
,
'a'
,
'r'
,
'd'
,
'1'
,
'0'
,
'-'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
};
/**************************************************************************************************
...
...
@@ -323,6 +325,22 @@ static void bleClose(bleMsg_t *pMsg)
/*************************************************************************************************/
static
void
bleSetup
(
bleMsg_t
*
pMsg
)
{
char
buf
[
32
];
char
a
,
b
,
c
,
d
,
e
,
f
;
if
(
fs_read_text_file
(
"mac.txt"
,
buf
,
sizeof
(
buf
)))
{
if
(
sscanf
(
buf
,
"**:**:**:%c%c:%c%c:%c%c"
,
&
a
,
&
b
,
&
c
,
&
d
,
&
e
,
&
f
)
==
6
)
{
bleScanDataDisc
[
9
]
=
a
;
bleScanDataDisc
[
10
]
=
b
;
bleScanDataDisc
[
11
]
=
c
;
bleScanDataDisc
[
12
]
=
d
;
bleScanDataDisc
[
13
]
=
e
;
bleScanDataDisc
[
14
]
=
f
;
}
}
/* set advertising and scan response data for discoverable mode */
AppAdvSetData
(
APP_ADV_DATA_DISCOVERABLE
,
sizeof
(
bleAdvDataDisc
),
(
uint8_t
*
)
bleAdvDataDisc
);
AppAdvSetData
(
APP_SCAN_DATA_DISCOVERABLE
,
sizeof
(
bleScanDataDisc
),
(
uint8_t
*
)
bleScanDataDisc
);
...
...
This diff is collapsed.
Click to expand it.
flash-all.gdb
+
3
−
0
View file @
2766e2f1
...
...
@@ -2,6 +2,9 @@ source init.gdb
set confirm off
mon max32xxx mass_erase 0
mon max32xxx mass_erase 1
echo #### BOOTLOADER ####\n
load build/bootloader/bootloader.elf
echo #### EPICARDIUM ####\n
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment