summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2015-01-13 19:32:53 +0100
committerJakob Odersky <jodersky@gmail.com>2015-01-13 19:32:53 +0100
commit2750713bc1b675582d15e320476e840d855b1389 (patch)
treeb2692ab787c69b526267168abd5747eb2fbb0814
parent98abac5fc449be03c165fe9945b186008fcc39bc (diff)
downloadnuttx-2750713bc1b675582d15e320476e840d855b1389.tar.gz
nuttx-2750713bc1b675582d15e320476e840d855b1389.tar.bz2
nuttx-2750713bc1b675582d15e320476e840d855b1389.zip
change clock and cleanup leds
-rw-r--r--nuttx/configs/teensy31/include/board.h3
-rwxr-xr-xnuttx/configs/teensy31/scripts/ld.script1
-rw-r--r--nuttx/configs/teensy31/src/up_leds.c35
3 files changed, 27 insertions, 12 deletions
diff --git a/nuttx/configs/teensy31/include/board.h b/nuttx/configs/teensy31/include/board.h
index cc44e5a16..cec8f8491 100644
--- a/nuttx/configs/teensy31/include/board.h
+++ b/nuttx/configs/teensy31/include/board.h
@@ -53,7 +53,8 @@
/* Clocking *************************************************************************/
/* The Kwikstik-K40 has a 4MHz crystal on board */
-#define BOARD_EXTCLOCK 1 /* External clock */
+//#define BOARD_EXTCLOCK 1 /* External clock */
+ #undef BOARD_EXTCLOCK
#define BOARD_EXTAL_FREQ 72000000 /* 50MHz Oscillator */
#define BOARD_XTAL32_FREQ 32768 /* 32KHz RTC Oscillator */
diff --git a/nuttx/configs/teensy31/scripts/ld.script b/nuttx/configs/teensy31/scripts/ld.script
index f3864f5f5..338a028dd 100755
--- a/nuttx/configs/teensy31/scripts/ld.script
+++ b/nuttx/configs/teensy31/scripts/ld.script
@@ -70,7 +70,6 @@ SECTIONS
} > cfmprotect
.text : {
- . = ALIGN(4);
_stext = ABSOLUTE(.);
*(.text .text.*)
*(.fixup)
diff --git a/nuttx/configs/teensy31/src/up_leds.c b/nuttx/configs/teensy31/src/up_leds.c
index 80a5aac50..eef244b9a 100644
--- a/nuttx/configs/teensy31/src/up_leds.c
+++ b/nuttx/configs/teensy31/src/up_leds.c
@@ -95,20 +95,35 @@
#define PORT_PCR_DSE ((uint32_t)0x00000040) // Drive Strength Enable
#define PORT_PCR_MUX(n) ((uint32_t)(((n) & 7) << 8)) // Pin Mux Control
+#define SIM_SCGC5 (*(volatile uint32_t *)0x40048038) // System Clock Gating Control Register 5
+#define PORTC_PCR5 (*(volatile uint32_t *)0x4004B014) // Pin Control Register n
+#define GPIOC_PDOR (*(volatile uint32_t *)0x400FF080) // Port Data Output Register
+#define GPIOC_PSOR (*(volatile uint32_t *)0x400FF084) // Port Set Output Register
+#define GPIOC_PCOR (*(volatile uint32_t *)0x400FF088) // Port Clear Output Register
+#define GPIOC_PTOR (*(volatile uint32_t *)0x400FF08C) // Port Toggle Output Register
+#define GPIOC_PDIR (*(volatile uint32_t *)0x400FF090) // Port Data Input Register
+#define GPIOC_PDDR (*(volatile uint32_t *)0x400FF094) // Port Data Direction Register
+
+#define PORT_PCR_SRE ((uint32_t)0x00000004) // Slew Rate Enable
+#define PORT_PCR_DSE ((uint32_t)0x00000040) // Drive Strength Enable
+#define PORT_PCR_MUX(n) ((uint32_t)(((n) & 7) << 8)) // Pin Mux Control
+
+
+
+
#ifdef CONFIG_ARCH_LEDS
void board_led_initialize(void)
{
- //kinetis_pinconfig(GPIO_LED0);
- //kinetis_gpiowrite(GPIO_LED0, true);
+
+
+ kinetis_pinconfig(GPIO_LED0);
//kinetis_pinconfig(PIN_PORTC | PIN5 | GPIO_OUTPUT | GPIO_HIGHDRIVE);
- PORTC_PCR5 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); // set to gpio
- GPIOC_PDDR |= (1 << 5); // set to output
- GPIOC_PSOR |= (1 << 5); // set high
- while(1) {
-
- }
+ //SIM_SCGC5 = 0x00043F82; // clocks active to all GPIO
+ //PORTC_PCR5 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); // set to gpio
+ //GPIOC_PDDR |= (1 << 5); // set to output
+ //GPIOC_PSOR |= (1 << 5); // set high
}
/****************************************************************************
@@ -117,7 +132,7 @@ void board_led_initialize(void)
void board_led_on(int led)
{
- //kinetis_gpiowrite(GPIO_LED0, true);
+ kinetis_gpiowrite(GPIO_LED0, true);
}
/****************************************************************************
@@ -126,7 +141,7 @@ void board_led_on(int led)
void board_led_off(int led)
{
- //kinetis_gpiowrite(GPIO_LED0, true);
+ kinetis_gpiowrite(GPIO_LED0, false);
}
#endif /* CONFIG_ARCH_LEDS */