diff --git a/main.c b/main.c deleted file mode 100644 index 234b037..0000000 --- a/main.c +++ /dev/null @@ -1,218 +0,0 @@ -//***************************************************************************** -// -// Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ -// -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the -// distribution. -// -// Neither the name of Texas Instruments Incorporated nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -//***************************************************************************** - -//***************************************************************************** -// -// Application Name - Blinky -// Application Overview - The objective of this application is to showcase the -// GPIO control using Driverlib api calls. The LEDs -// connected to the GPIOs on the LP are used to indicate -// the GPIO output. The GPIOs are driven high-low -// periodically in order to turn on-off the LEDs. -// -//***************************************************************************** - -//**************************************************************************** -// -//! \addtogroup blinky -//! @{ -// -//**************************************************************************** - -// Standard includes -#include - -// Driverlib includes -#include "hw_types.h" -#include "hw_ints.h" -#include "hw_memmap.h" -#include "hw_common_reg.h" -#include "interrupt.h" -#include "hw_apps_rcm.h" -#include "prcm.h" -#include "rom.h" -#include "rom_map.h" -#include "prcm.h" -#include "gpio.h" -#include "utils.h" - -// Common interface includes -#include "gpio_if.h" - -#include "pinmux.h" - -#define APPLICATION_VERSION "1.4.0" - -//***************************************************************************** -// GLOBAL VARIABLES -- Start -//***************************************************************************** -#if defined(ccs) -extern void (* const g_pfnVectors[])(void); -#endif -#if defined(ewarm) -extern uVectorEntry __vector_table; -#endif -//***************************************************************************** -// GLOBAL VARIABLES -- End -//***************************************************************************** - - -//***************************************************************************** -// LOCAL FUNCTION PROTOTYPES -//***************************************************************************** -void LEDBlinkyRoutine(); -static void BoardInit(void); - -//***************************************************************************** -// LOCAL FUNCTION DEFINITIONS -//***************************************************************************** - -//***************************************************************************** -// -//! Configures the pins as GPIOs and peroidically toggles the lines -//! -//! \param None -//! -//! This function -//! 1. Configures 3 lines connected to LEDs as GPIO -//! 2. Sets up the GPIO pins as output -//! 3. Periodically toggles each LED one by one by toggling the GPIO line -//! -//! \return None -// -//***************************************************************************** -void LEDBlinkyRoutine() -{ - // - // Toggle the lines initially to turn off the LEDs. - // The values driven are as required by the LEDs on the LP. - // - GPIO_IF_LedOff(MCU_ALL_LED_IND); - while(1) - { - // - // Alternately toggle hi-low each of the GPIOs - // to switch the corresponding LED on/off. - // - MAP_UtilsDelay(8000000); - GPIO_IF_LedOn(MCU_RED_LED_GPIO); - MAP_UtilsDelay(8000000); - GPIO_IF_LedOff(MCU_RED_LED_GPIO); - MAP_UtilsDelay(8000000); - GPIO_IF_LedOn(MCU_ORANGE_LED_GPIO); - MAP_UtilsDelay(8000000); - GPIO_IF_LedOff(MCU_ORANGE_LED_GPIO); - MAP_UtilsDelay(8000000); - GPIO_IF_LedOn(MCU_GREEN_LED_GPIO); - MAP_UtilsDelay(8000000); - GPIO_IF_LedOff(MCU_GREEN_LED_GPIO); - } - -} -//***************************************************************************** -// -//! Board Initialization & Configuration -//! -//! \param None -//! -//! \return None -// -//***************************************************************************** -static void -BoardInit(void) -{ -/* In case of TI-RTOS vector table is initialize by OS itself */ -#ifndef USE_TIRTOS - // - // Set vector table base - // -#if defined(ccs) - MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]); -#endif -#if defined(ewarm) - MAP_IntVTableBaseSet((unsigned long)&__vector_table); -#endif -#endif - - // - // Enable Processor - // - MAP_IntMasterEnable(); - MAP_IntEnable(FAULT_SYSTICK); - - PRCMCC3200MCUInit(); -} -//**************************************************************************** -// -//! Main function -//! -//! \param none -//! -//! This function -//! 1. Invokes the LEDBlinkyTask -//! -//! \return None. -// -//**************************************************************************** -int -main() -{ - // - // Initialize Board configurations - // - BoardInit(); - - // - // Power on the corresponding GPIO port B for 9,10,11. - // Set up the GPIO lines to mode 0 (GPIO) - // - PinMuxConfig(); - GPIO_IF_LedConfigure(LED1|LED2|LED3); - - GPIO_IF_LedOff(MCU_ALL_LED_IND); - - // - // Start the LEDBlinkyRoutine - // - LEDBlinkyRoutine(); - return 0; -} - -//***************************************************************************** -// -// Close the Doxygen group. -//! @} -// -//***************************************************************************** diff --git a/makedefs b/makedefs index d4e8a8a..c49d5a3 100644 --- a/makedefs +++ b/makedefs @@ -57,7 +57,10 @@ CFLAGS+=${CFLAGSgcc} AFLAGS+=${patsubst %,-I%,${subst :, ,${IPATH}}} CFLAGS+=${patsubst %,-I%,${subst :, ,${IPATH}}} -${OBJDIR}/%.o: %.c +${OBJDIR}/%.o: src/%.c + ${CC} ${CFLAGS} -D${COMPILER} -o ${@} ${<} + +${OBJDIR}/%.o: common/%.c ${CC} ${CFLAGS} -D${COMPILER} -o ${@} ${<} ${OBJDIR}/%.o: driverlib/%.c diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..ca5ceef --- /dev/null +++ b/src/main.c @@ -0,0 +1,68 @@ + +// Standard includes +#include + +// Driverlib includes +#include "hw_types.h" +#include "hw_ints.h" +#include "hw_memmap.h" +#include "hw_common_reg.h" +#include "interrupt.h" +#include "hw_apps_rcm.h" +#include "prcm.h" +#include "rom.h" +#include "rom_map.h" +#include "prcm.h" +#include "gpio.h" +#include "utils.h" + +// Common interface includes +#include "gpio_if.h" + +#include "pinmux.h" + +#define APPLICATION_VERSION "1.4.0" + +void LEDBlinkyRoutine(); +static void BoardInit(void); + +void LEDBlinkyRoutine() +{ + GPIO_IF_LedOff(MCU_ALL_LED_IND); + while(1) { + MAP_UtilsDelay(8000000); + GPIO_IF_LedOn(MCU_RED_LED_GPIO); + MAP_UtilsDelay(8000000); + GPIO_IF_LedOff(MCU_RED_LED_GPIO); + MAP_UtilsDelay(8000000); + GPIO_IF_LedOn(MCU_ORANGE_LED_GPIO); + MAP_UtilsDelay(8000000); + GPIO_IF_LedOff(MCU_ORANGE_LED_GPIO); + MAP_UtilsDelay(8000000); + GPIO_IF_LedOn(MCU_GREEN_LED_GPIO); + MAP_UtilsDelay(8000000); + GPIO_IF_LedOff(MCU_GREEN_LED_GPIO); + } + +} +static void BoardInit(void) +{ + MAP_IntMasterEnable(); + MAP_IntEnable(FAULT_SYSTICK); + + PRCMCC3200MCUInit(); +} + +int main() +{ + BoardInit(); + + PinMuxConfig(); + GPIO_IF_LedConfigure(LED1 | LED2 | LED3); + + GPIO_IF_LedOff(MCU_ALL_LED_IND); + + LEDBlinkyRoutine(); + + return 0; +} diff --git a/pinmux.c b/src/pinmux.c similarity index 100% rename from pinmux.c rename to src/pinmux.c diff --git a/pinmux.h b/src/pinmux.h similarity index 100% rename from pinmux.h rename to src/pinmux.h