summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--demos/bsp/boards/board_ngx4330.c6
-rw-r--r--demos/host/main.c34
2 files changed, 35 insertions, 5 deletions
diff --git a/demos/bsp/boards/board_ngx4330.c b/demos/bsp/boards/board_ngx4330.c
index d9ffc5cbf..08ab03683 100644
--- a/demos/bsp/boards/board_ngx4330.c
+++ b/demos/bsp/boards/board_ngx4330.c
@@ -58,18 +58,14 @@ const static struct {
void board_init(void)
{
CGU_Init();
- SysTick_Config( CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE)/1000 ); /* 1 ms Timer */
+ SysTick_Config( CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE)/TICKS_PER_SECOND ); /* 1 ms Timer */
/* Turn on 5V USB VBUS TODO Should be Host-only */
scu_pinmux(0x2, 6, MD_PUP | MD_EZI, FUNC4); // P2_6 USB1_PWR_EN, USB1 VBus function
scu_pinmux(0x2, 5, MD_PLN | MD_EZI | MD_ZI, FUNC2); // P2_5 USB1_VBUS, MUST CONFIGURE THIS SIGNAL FOR USB1 NORMAL OPERATION
/* Turn on 5V USB VBUS TODO Should be Host-only */
-#if 1 //(BOARD == BOARD_XPLORER)
scu_pinmux(0x1, 7, MD_PUP | MD_EZI, FUNC4); // P1_7 USB0_PWR_EN, USB0 VBus function Xplorer
-#else
- scu_pinmux(0x2, 3, MD_PUP | MD_EZI, FUNC7); // P2_3 USB0_PWR_EN, USB0 VBus function Farnell
-#endif
// Leds Init
uint8_t i;
diff --git a/demos/host/main.c b/demos/host/main.c
new file mode 100644
index 000000000..384e4cfc3
--- /dev/null
+++ b/demos/host/main.c
@@ -0,0 +1,34 @@
+#include "boards/board.h"
+#include "tusb.h"
+
+#if defined(__CODE_RED)
+ #include <cr_section_macros.h>
+ #include <NXP/crp.h>
+ // Variable to store CRP value in. Will be placed automatically
+ // by the linker when "Enable Code Read Protect" selected.
+ // See crp.h header for more information
+ __CRP const unsigned int CRP_WORD = CRP_NO_CRP ;
+#endif
+
+volatile uint32_t system_tick = 0;
+void SysTick_Handler (void)
+{
+ system_tick++;
+}
+
+int main(void)
+{
+ uint32_t current_tick = system_tick;
+
+ board_init();
+ tusb_init(0);
+
+ while (1)
+ {
+ if (current_tick + 1000 < system_tick)
+ {
+ current_tick += 1000;
+ board_leds(0x03, (current_tick/1000)%2); /* Toggle LED once per second */
+ }
+ }
+}