diff --git a/efm8/.cproject b/efm8/.cproject
index efc88e1..3f471d7 100644
--- a/efm8/.cproject
+++ b/efm8/.cproject
@@ -29,7 +29,7 @@
-
+
@@ -50,7 +50,7 @@
-
+
@@ -77,7 +77,7 @@
-
+
@@ -162,7 +162,7 @@
-
+
@@ -170,7 +170,7 @@
-
+
@@ -184,5 +184,12 @@
-
+
+
+
+
+
+
+
+
diff --git a/efm8/efm8.hwconf b/efm8/efm8.hwconf
index 90bd159..e487eed 100644
--- a/efm8/efm8.hwconf
+++ b/efm8/efm8.hwconf
@@ -11,8 +11,20 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/efm8/inc/InitDevice.h b/efm8/inc/InitDevice.h
index 9c1b01a..d2879e1 100644
--- a/efm8/inc/InitDevice.h
+++ b/efm8/inc/InitDevice.h
@@ -18,6 +18,8 @@ extern void enter_DefaultMode_from_RESET(void);
// $[Config(Per-Module Mode)Transition Prototypes]
extern void WDT_0_enter_DefaultMode_from_RESET(void);
extern void PORTS_0_enter_DefaultMode_from_RESET(void);
+extern void PORTS_1_enter_DefaultMode_from_RESET(void);
+extern void PORTS_2_enter_DefaultMode_from_RESET(void);
extern void PBCFG_0_enter_DefaultMode_from_RESET(void);
extern void CIP51_0_enter_DefaultMode_from_RESET(void);
extern void CLOCK_0_enter_DefaultMode_from_RESET(void);
diff --git a/efm8/inc/descriptors.h b/efm8/inc/descriptors.h
index 4bad6cb..4206168 100644
--- a/efm8/inc/descriptors.h
+++ b/efm8/inc/descriptors.h
@@ -58,3 +58,7 @@ extern SI_SEGMENT_VARIABLE(initstruct, const USBD_Init_TypeDef, SI_SEG_CODE);
#endif // __SILICON_LABS_DESCRIPTORS_H
+// $[HID Report Descriptors]
+extern SI_SEGMENT_VARIABLE(ReportDescriptor0[34], const uint8_t, SI_SEG_CODE);
+// [HID Report Descriptors]$
+
diff --git a/efm8/src/InitDevice.c b/efm8/src/InitDevice.c
index 20a38e9..9e3b371 100644
--- a/efm8/src/InitDevice.c
+++ b/efm8/src/InitDevice.c
@@ -28,6 +28,8 @@ extern void enter_DefaultMode_from_RESET(void) {
uint8_t SFRPAGE_save = SFRPAGE;
WDT_0_enter_DefaultMode_from_RESET();
PORTS_0_enter_DefaultMode_from_RESET();
+ PORTS_1_enter_DefaultMode_from_RESET();
+ PORTS_2_enter_DefaultMode_from_RESET();
PBCFG_0_enter_DefaultMode_from_RESET();
CIP51_0_enter_DefaultMode_from_RESET();
CLOCK_0_enter_DefaultMode_from_RESET();
@@ -327,18 +329,18 @@ extern void PORTS_0_enter_DefaultMode_from_RESET(void) {
// $[P0MDOUT - Port 0 Output Mode]
/***********************************************************************
- - P0.0 output is push-pull
+ - P0.0 output is open-drain
- P0.1 output is open-drain
- P0.2 output is open-drain
- P0.3 output is open-drain
- - P0.4 output is open-drain
+ - P0.4 output is push-pull
- P0.5 output is open-drain
- P0.6 output is open-drain
- P0.7 output is open-drain
***********************************************************************/
- P0MDOUT = P0MDOUT_B0__PUSH_PULL | P0MDOUT_B1__OPEN_DRAIN
+ P0MDOUT = P0MDOUT_B0__OPEN_DRAIN | P0MDOUT_B1__OPEN_DRAIN
| P0MDOUT_B2__OPEN_DRAIN | P0MDOUT_B3__OPEN_DRAIN
- | P0MDOUT_B4__OPEN_DRAIN | P0MDOUT_B5__OPEN_DRAIN
+ | P0MDOUT_B4__PUSH_PULL | P0MDOUT_B5__OPEN_DRAIN
| P0MDOUT_B6__OPEN_DRAIN | P0MDOUT_B7__OPEN_DRAIN;
// [P0MDOUT - Port 0 Output Mode]$
@@ -346,6 +348,20 @@ extern void PORTS_0_enter_DefaultMode_from_RESET(void) {
// [P0MDIN - Port 0 Input Mode]$
// $[P0SKIP - Port 0 Skip]
+ /***********************************************************************
+ - P0.0 pin is skipped by the crossbar
+ - P0.1 pin is skipped by the crossbar
+ - P0.2 pin is skipped by the crossbar
+ - P0.3 pin is skipped by the crossbar
+ - P0.4 pin is not skipped by the crossbar
+ - P0.5 pin is not skipped by the crossbar
+ - P0.6 pin is not skipped by the crossbar
+ - P0.7 pin is not skipped by the crossbar
+ ***********************************************************************/
+ P0SKIP = P0SKIP_B0__SKIPPED | P0SKIP_B1__SKIPPED | P0SKIP_B2__SKIPPED
+ | P0SKIP_B3__SKIPPED | P0SKIP_B4__NOT_SKIPPED
+ | P0SKIP_B5__NOT_SKIPPED | P0SKIP_B6__NOT_SKIPPED
+ | P0SKIP_B7__NOT_SKIPPED;
// [P0SKIP - Port 0 Skip]$
// $[P0MASK - Port 0 Mask]
@@ -358,9 +374,67 @@ extern void PORTS_0_enter_DefaultMode_from_RESET(void) {
extern void PORTS_1_enter_DefaultMode_from_RESET(void) {
+ // $[P1 - Port 1 Pin Latch]
+ // [P1 - Port 1 Pin Latch]$
+
+ // $[P1MDOUT - Port 1 Output Mode]
+ /***********************************************************************
+ - P1.0 output is open-drain
+ - P1.1 output is open-drain
+ - P1.2 output is open-drain
+ - P1.3 output is open-drain
+ - P1.4 output is push-pull
+ - P1.5 output is push-pull
+ - P1.6 output is push-pull
+ - P1.7 output is open-drain
+ ***********************************************************************/
+ P1MDOUT = P1MDOUT_B0__OPEN_DRAIN | P1MDOUT_B1__OPEN_DRAIN
+ | P1MDOUT_B2__OPEN_DRAIN | P1MDOUT_B3__OPEN_DRAIN
+ | P1MDOUT_B4__PUSH_PULL | P1MDOUT_B5__PUSH_PULL
+ | P1MDOUT_B6__PUSH_PULL | P1MDOUT_B7__OPEN_DRAIN;
+ // [P1MDOUT - Port 1 Output Mode]$
+
+ // $[P1MDIN - Port 1 Input Mode]
+ // [P1MDIN - Port 1 Input Mode]$
+
+ // $[P1SKIP - Port 1 Skip]
+ // [P1SKIP - Port 1 Skip]$
+
+ // $[P1MASK - Port 1 Mask]
+ // [P1MASK - Port 1 Mask]$
+
+ // $[P1MAT - Port 1 Match]
+ // [P1MAT - Port 1 Match]$
+
}
extern void PORTS_2_enter_DefaultMode_from_RESET(void) {
+ // $[P2 - Port 2 Pin Latch]
+ // [P2 - Port 2 Pin Latch]$
+
+ // $[P2MDOUT - Port 2 Output Mode]
+ /***********************************************************************
+ - P2.0 output is push-pull
+ - P2.1 output is open-drain
+ - P2.2 output is open-drain
+ - P2.3 output is open-drain
+ ***********************************************************************/
+ P2MDOUT = P2MDOUT_B0__PUSH_PULL | P2MDOUT_B1__OPEN_DRAIN
+ | P2MDOUT_B2__OPEN_DRAIN | P2MDOUT_B3__OPEN_DRAIN;
+ // [P2MDOUT - Port 2 Output Mode]$
+
+ // $[P2MDIN - Port 2 Input Mode]
+ // [P2MDIN - Port 2 Input Mode]$
+
+ // $[P2SKIP - Port 2 Skip]
+ // [P2SKIP - Port 2 Skip]$
+
+ // $[P2MASK - Port 2 Mask]
+ // [P2MASK - Port 2 Mask]$
+
+ // $[P2MAT - Port 2 Match]
+ // [P2MAT - Port 2 Match]$
+
}
diff --git a/efm8/src/main.c b/efm8/src/main.c
index ba0029f..7435da7 100644
--- a/efm8/src/main.c
+++ b/efm8/src/main.c
@@ -7,11 +7,22 @@
int main(void) {
+ volatile int xdata i,j,k;
enter_DefaultMode_from_RESET();
cprints("hello,world\r\n");
while (1) {
+ k++;
+ for (i = 0; i < 1000; i++)
+ {
+ for (j = 0; j < 100; j++)
+ {
+
+ }
+ P1_B4 = i&1;
+ }
+ P1_B5 = k&1;
}
}
diff --git a/efm8/src/printing.c b/efm8/src/printing.c
index ca5b87c..9077ead 100644
--- a/efm8/src/printing.c
+++ b/efm8/src/printing.c
@@ -14,7 +14,7 @@
void putf(char c)
{
uint8_t i;
- SBUF0 = c;
+ SBUF1 = c;
// Blocking delay that works for 115200 baud on this device (<1ms)
for (i=0; i<200; i++){}
for (i=0; i<200; i++){}