Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lwc
/
compare
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b30e5083
authored
Jul 15, 2019
by
Sebastian Renner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
F7 template working
parent
e1aa1c3c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
43 deletions
+11
-43
templates/f7/Src/main.c
+10
-42
templates/f7/middleware.py
+1
-1
No files found.
templates/f7/Src/main.c
View file @
b30e5083
...
...
@@ -24,7 +24,7 @@
#include "crypto_aead.h"
#include "api.h"
#define DEBUG
//#define DEBUG
#define MAX_LEN 1400
#ifdef DEBUG
...
...
@@ -79,7 +79,6 @@ PCD_HandleTypeDef hpcd_USB_OTG_FS;
/* Private function prototypes -----------------------------------------------*/
void
SystemClock_Config
(
void
);
static
void
MX_GPIO_Init
(
void
);
static
void
MX_USB_OTG_FS_PCD_Init
(
void
);
static
void
MX_USART2_Init
(
void
);
static
void
read_variable_serial
(
unsigned
char
action
);
static
void
write_variable_serial
(
unsigned
char
target
[],
uint32_t
len
);
...
...
@@ -178,8 +177,10 @@ int main(void)
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init
();
LL_APB1_GRP1_EnableClock
(
LL_APB1_GRP1_PERIPH_PWR
);
LL_APB2_GRP1_EnableClock
(
LL_APB2_GRP1_PERIPH_SYSCFG
);
NVIC_SetPriorityGrouping
(
NVIC_PRIORITYGROUP_4
);
/* USER CODE BEGIN Init */
/* USER CODE END Init */
...
...
@@ -190,21 +191,23 @@ int main(void)
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
SEGGER_RTT_Init
();
/* Initialize all configured peripherals */
MX_GPIO_Init
();
MX_USB_OTG_FS_PCD_Init
();
MX_USART2_Init
();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
unsigned
char
rcv
;
int
res
;
while
(
1
)
{
#ifdef DEBUG
dbg_printf
(
"Starting to read form serial.."
);
#endif
read_serial
(
&
rcv
,
1
);
#ifdef DEBUG
dbg_printf
(
"Received action: %c
\n
"
,
rcv
);
...
...
@@ -237,9 +240,9 @@ int main(void)
dbg_printf
(
"p: "
);
for
(
int
i
=
0
;
i
<
nplen
;
i
++
)
dbg_printf
(
"%02x"
,
npub
[
i
]);
dbg_printf
(
"
\n
"
);
dbg_printf
(
"k: "
);
for
(
int
i
=
0
;
i
<
klen
;
i
++
)
dbg_printf
(
"%02x"
,
k
[
i
]);
dbg_printf
(
"
\n
"
);
#endif
//
LL_GPIO_TogglePin(GPIOB, LL_GPIO_PIN_14);
LL_GPIO_TogglePin
(
GPIOB
,
LL_GPIO_PIN_14
);
res
=
crypto_aead_encrypt
(
c
,
&
clen
,
m
,
mlen
,
ad
,
adlen
,
nsec
,
npub
,
k
);
//
LL_GPIO_TogglePin(GPIOB, LL_GPIO_PIN_14);
LL_GPIO_TogglePin
(
GPIOB
,
LL_GPIO_PIN_14
);
break
;
default:
...
...
@@ -358,41 +361,6 @@ static void MX_USART2_Init(void)
}
/**
* @brief USB_OTG_FS Initialization Function
* @param None
* @retval None
*/
static
void
MX_USB_OTG_FS_PCD_Init
(
void
)
{
/* USER CODE BEGIN USB_OTG_FS_Init 0 */
/* USER CODE END USB_OTG_FS_Init 0 */
/* USER CODE BEGIN USB_OTG_FS_Init 1 */
/* USER CODE END USB_OTG_FS_Init 1 */
hpcd_USB_OTG_FS
.
Instance
=
USB_OTG_FS
;
hpcd_USB_OTG_FS
.
Init
.
dev_endpoints
=
6
;
hpcd_USB_OTG_FS
.
Init
.
speed
=
PCD_SPEED_FULL
;
hpcd_USB_OTG_FS
.
Init
.
dma_enable
=
DISABLE
;
hpcd_USB_OTG_FS
.
Init
.
phy_itface
=
PCD_PHY_EMBEDDED
;
hpcd_USB_OTG_FS
.
Init
.
Sof_enable
=
ENABLE
;
hpcd_USB_OTG_FS
.
Init
.
low_power_enable
=
DISABLE
;
hpcd_USB_OTG_FS
.
Init
.
lpm_enable
=
DISABLE
;
hpcd_USB_OTG_FS
.
Init
.
vbus_sensing_enable
=
ENABLE
;
hpcd_USB_OTG_FS
.
Init
.
use_dedicated_ep1
=
DISABLE
;
if
(
HAL_PCD_Init
(
&
hpcd_USB_OTG_FS
)
!=
HAL_OK
)
{
Error_Handler
();
}
/* USER CODE BEGIN USB_OTG_FS_Init 2 */
/* USER CODE END USB_OTG_FS_Init 2 */
}
/**
* @brief GPIO Initialization Function
* @param None
* @retval None
...
...
templates/f7/middleware.py
View file @
b30e5083
...
...
@@ -7,7 +7,7 @@ import struct
import
serial
import
subprocess
DBG
=
'
1
'
DBG
=
''
ser
=
serial
.
Serial
(
'/dev/ttyUSB0'
,
115200
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment