Adjust main:

* Re-order OSC, VIMS cache, I/O latch configuration instructions
* Don't automatically enable UART RX: Let the example decide this
This commit is contained in:
George Oikonomou 2015-05-01 17:04:44 +01:00
parent 07272b7cd6
commit 019143226b

View file

@ -46,6 +46,7 @@
#include "lpm.h" #include "lpm.h"
#include "gpio-interrupt.h" #include "gpio-interrupt.h"
#include "dev/watchdog.h" #include "dev/watchdog.h"
#include "dev/oscillators.h"
#include "ieee-addr.h" #include "ieee-addr.h"
#include "vims.h" #include "vims.h"
#include "cc26xx-model.h" #include "cc26xx-model.h"
@ -119,23 +120,6 @@ set_rf_params(void)
#endif #endif
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void
select_lf_xosc(void)
{
ti_lib_osc_interface_enable();
/* Make sure the SMPH clock within AUX is enabled */
ti_lib_aux_wuc_clock_enable(AUX_WUC_SMPH_CLOCK);
while(ti_lib_aux_wuc_clock_status(AUX_WUC_SMPH_CLOCK) != AUX_WUC_CLOCK_READY);
/* Switch LF clock source to the LF RCOSC if required */
if(ti_lib_osc_clock_source_get(OSC_SRC_CLK_LF) != OSC_XOSC_LF) {
ti_lib_osc_clock_source_set(OSC_SRC_CLK_LF, OSC_XOSC_LF);
}
ti_lib_osc_interface_disable();
}
/*---------------------------------------------------------------------------*/
/** /**
* \brief Main function for CC26xx-based platforms * \brief Main function for CC26xx-based platforms
* *
@ -144,41 +128,39 @@ select_lf_xosc(void)
int int
main(void) main(void)
{ {
/* Enable flash cache and prefetch. */
ti_lib_vims_mode_set(VIMS_BASE, VIMS_MODE_ENABLED);
ti_lib_vims_configure(VIMS_BASE, true, true);
ti_lib_int_master_disable();
/* Set the LF XOSC as the LF system clock source */ /* Set the LF XOSC as the LF system clock source */
select_lf_xosc(); oscillators_select_lf_xosc();
/*
* Make sure to open the latches - this will be important when returning
* from shutdown
*/
ti_lib_pwr_ctrl_io_freeze_disable();
/* Use DCDC instead of LDO to save current */
ti_lib_pwr_ctrl_source_set(PWRCTRL_PWRSRC_DCDC);
lpm_init(); lpm_init();
board_init(); board_init();
/* Enable flash cache and prefetch. */
ti_lib_vims_mode_set(VIMS_BASE, VIMS_MODE_ENABLED);
ti_lib_vims_configure(VIMS_BASE, true, true);
gpio_interrupt_init(); gpio_interrupt_init();
/* Clock must always be enabled for the semaphore module */
HWREG(AUX_WUC_BASE + AUX_WUC_O_MODCLKEN1) = AUX_WUC_MODCLKEN1_SMPH;
leds_init(); leds_init();
/*
* Disable I/O pad sleep mode and open I/O latches in the AON IOC interface
* This is only relevant when returning from shutdown (which is what froze
* latches in the first place. Before doing these things though, we should
* allow software to first regain control of pins
*/
ti_lib_pwr_ctrl_io_freeze_disable();
fade(LEDS_RED); fade(LEDS_RED);
ti_lib_int_master_enable();
cc26xx_rtc_init(); cc26xx_rtc_init();
clock_init(); clock_init();
rtimer_init(); rtimer_init();
board_init();
watchdog_init(); watchdog_init();
process_init(); process_init();
@ -187,7 +169,6 @@ main(void)
/* Character I/O Initialisation */ /* Character I/O Initialisation */
#if CC26XX_UART_CONF_ENABLE #if CC26XX_UART_CONF_ENABLE
cc26xx_uart_init(); cc26xx_uart_init();
cc26xx_uart_set_input(serial_line_input_byte);
#endif #endif
serial_line_init(); serial_line_init();