Skip to content

Commit 3658aab

Browse files
committed
Envie_M7: enable USB support
1 parent b94646a commit 3658aab

File tree

5 files changed

+50
-5
lines changed

5 files changed

+50
-5
lines changed

boards.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ envie_m7.compiler.mbed.cxxflags={build.variant.path}/cxxflags.txt
5151
envie_m7.compiler.mbed.includes={build.variant.path}/includes.txt
5252
envie_m7.compiler.mbed.extra_ldflags=-lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
5353
envie_m7.compiler.mbed="{build.variant.path}/libs/libmbed.a"
54-
envie_m7.vid.0=0x0483
55-
envie_m7.pid.0=0x374e
54+
envie_m7.vid.0=0x2341
55+
envie_m7.pid.0=0x025b
5656

5757
envie_m7.upload.tool=dfu-util
5858
envie_m7.upload.protocol=

variants/ENVIE_M7/defines.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
-DFEATURE_LWIP=1
4545
-D__FPU_PRESENT=1
4646
-D__MBED__=1
47-
-DMBED_BUILD_TIMESTAMP=1578499787.7442052
47+
-DMBED_BUILD_TIMESTAMP=1578656653.6684103
4848
-D__MBED_CMSIS_RTOS_CM
4949
-DSTM32H747xx
5050
-DTARGET_4343W
@@ -72,4 +72,4 @@
7272
-DTRANSACTION_QUEUE_SIZE_SPI=2
7373
-DUSE_FULL_LL_DRIVER
7474
-DUSE_HAL_DRIVER
75-
-DMBED_NO_GLOBAL_USING_DIRECTIVE=1
75+
-DMBED_NO_GLOBAL_USING_DIRECTIVE=1

variants/ENVIE_M7/libs/libmbed.a

4 Bytes
Binary file not shown.

variants/ENVIE_M7/pins_arduino.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,15 @@
22

33
#define SERIAL_HOWMANY 1
44
#define SERIAL1_TX SERIAL_TX
5-
#define SERIAL1_RX SERIAL_RX
5+
#define SERIAL1_RX SERIAL_RX
6+
7+
#define SERIAL_CDC 1
8+
#define HAS_UNIQUE_ISERIAL_DESCRIPTOR
9+
#define BOARD_VENDORID 0x2341
10+
#define BOARD_PRODUCTID 0x025b
11+
#define BOARD_NAME "Envie M7"
12+
13+
#define DFU_MAGIC_SERIAL_ONLY_RESET 0xb0
14+
15+
uint8_t getUniqueSerialNumber(uint8_t* name);
16+
void _ontouch1200bps_();

variants/ENVIE_M7/variant.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include "Arduino.h"
2+
3+
RTC_HandleTypeDef RTCHandle;
4+
5+
void initVariant() {
6+
RTCHandle.Instance = RTC;
7+
// Turn off LED red from bootloader
8+
digitalWrite(PK_6, HIGH);
9+
}
10+
11+
#ifdef SERIAL_CDC
12+
13+
static void utox8(uint32_t val, uint8_t* s) {
14+
for (int i = 0; i < 16; i=i+2) {
15+
int d = val & 0XF;
16+
val = (val >> 4);
17+
18+
s[15 - i -1] = d > 9 ? 'A' + d - 10 : '0' + d;
19+
s[15 - i] = '\0';
20+
}
21+
}
22+
23+
uint8_t getUniqueSerialNumber(uint8_t* name) {
24+
utox8(HAL_GetUIDw0(), &name[0]);
25+
utox8(HAL_GetUIDw1(), &name[16]);
26+
return 32;
27+
}
28+
29+
void _ontouch1200bps_() {
30+
HAL_RTCEx_BKUPWrite(&RTCHandle, RTC_BKP_DR0, 0xDF59);
31+
NVIC_SystemReset();
32+
}
33+
34+
#endif

0 commit comments

Comments
 (0)