//***************************************************************************** // //! Sets the pin mode and configures the pin for use by ADC //! //! \param ulPin is one of the valid pin. //! \param ulPinMode is one of the valid pin mode. //! //! The ADC pins must be properly configured for the peripheral to //! function correctly. This function provides a typical configuration for //! those pin. //! //! //! \note This function cannot be used to turn any pin into a ADC pin; it //! only sets the pin mode and configures it for proper ADC operation. //! //! \return None. // //***************************************************************************** void PinTypeADC(unsigned long ulPin,unsigned long ulPinMode) { // // Configure the Pin // PinConfigSet(ulPin,PIN_STRENGTH_2MA,PIN_TYPE_ANALOG); }
//***************************************************************************** // //! Sets the pin mode and configures the pin for use by GPIO peripheral //! //! \param ulPin is one of the valid pin. //! \param ulPinMode is one of the valid pin mode. //! \param bOpenDrain is one to decide either OpenDrain or STD //! //! The GPIO pins must be properly configured for the peripheral to //! function correctly. This function provides a typical configuration for //! those pin. //! //! //! \return None. // //***************************************************************************** void PinTypeGPIO(unsigned long ulPin,unsigned long ulPinMode,tBoolean bOpenDrain) { // // Set the pin for standard push-pull operation. // if(bOpenDrain) { PinConfigSet(ulPin, PIN_STRENGTH_2MA, PIN_TYPE_OD); } else { PinConfigSet(ulPin, PIN_STRENGTH_2MA, PIN_TYPE_STD); } // // Set the pin to specified mode // PinModeSet(ulPin, ulPinMode); }
//***************************************************************************** // //! Sets the pin mode and configures the pin for use by I2C peripheral //! //! \param ulPin is one of the valid pin. //! \param ulPinMode is one of the valid pin mode. //! //! The I2C pins must be properly configured for the peripheral to //! function correctly. This function provides a typical configuration for //! the pin. //! //! //! \note This function cannot be used to turn any pin into a I2C pin; it //! only sets the pin mode and configures it for proper I2C operation. //! //! //! \return None. // //***************************************************************************** void PinTypeI2C(unsigned long ulPin,unsigned long ulPinMode) { // // Set the pin to specified mode // PinModeSet(ulPin,ulPinMode); // // Set the pin for open-drain operation with a weak pull-up. // PinConfigSet(ulPin,PIN_STRENGTH_2MA,PIN_TYPE_OD_PU); }
//***************************************************************************** // //! Sets the pin mode and configures the pin for use by UART peripheral //! //! \param ulPin is one of the valid pin. //! \param ulPinMode is one of the valid pin mode. //! //! The UART pins must be properly configured for the peripheral to //! function correctly. This function provides a typical configuration for //! those pin(s); other configurations may work as well depending upon the //! board setup (for example, using the on-chip pull-ups). //! //! //! \note This function cannot be used to turn any pin into a UART pin; it //! only sets the pin mode and configures it for proper UART operation. //! //! //! \return None. // //***************************************************************************** void PinTypeUART(unsigned long ulPin,unsigned long ulPinMode) { // // Set the pin to specified mode // PinModeSet(ulPin,ulPinMode); // // Set the pin for standard operation // PinConfigSet(ulPin,PIN_STRENGTH_2MA,PIN_TYPE_STD); }
//***************************************************************************** // //! Sets the pin mode and configures the pin for use by SD Host peripheral //! //! \param ulPin is one of the valid pin. //! \param ulPinMode is one of the valid pin mode. //! //! The MMC pins must be properly configured for the peripheral to //! function correctly. This function provides a typical configuration for //! those pin. //! //! //! \note This function cannot be used to turn any pin into a SD Host pin; it //! only sets the pin mode and configures it for proper SD Host operation. //! //! \return None. // //***************************************************************************** void PinTypeSDHost(unsigned long ulPin,unsigned long ulPinMode) { // // Set pin mode // PinModeSet(ulPin,ulPinMode); // // Configure the Pin // PinConfigSet(ulPin,PIN_STRENGTH_2MA,PIN_TYPE_STD); }
void launchpad_init(void){ long lRetVal = -1; PinConfigSet(PIN_58, PIN_STRENGTH_2MA | PIN_STRENGTH_4MA, PIN_TYPE_STD_PD); GPIO_IF_LedConfigure(LED1|LED2|LED3); GPIO_IF_LedOff(MCU_ALL_LED_IND); MAP_UtilsDelay(8000000); GPIO_IF_LedOn(MCU_GREEN_LED_GPIO); Report ("Initialize I2C..."); // // I2C Init // lRetVal = I2C_IF_Open(I2C_MASTER_MODE_FST); if(lRetVal < 0) { Report ("Fail!\r\n"); while(1); } Report ("Success\r\n"); }
//**************************************************************************** // MAIN FUNCTION //**************************************************************************** void main() { /* Display banner */ Report("\r\n\r\nTexas Instruments CC3200 Application - Powered by 2lemetry's ThingFabric Cloud\r\n\r\n"); BoardInit(); // // Configure the pinmux settings for the peripherals exercised // PinMuxConfig(); PinConfigSet(PIN_58,PIN_STRENGTH_2MA|PIN_STRENGTH_4MA,PIN_TYPE_STD_PD); // // UART Init // InitTerm(); // // LED Init // GPIO_IF_LedConfigure(LED1); //Turn Off the LEDs GPIO_IF_LedOff(MCU_RED_LED_GPIO); // // I2C Init // I2C_IF_Open(I2C_MASTER_MODE_FST); //Init Temprature Sensor TMP006DrvOpen(); //Init Accelerometer Sensor BMA222Open(); // // Simplelinkspawntask // VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); // Create semaphore to indicate CC3200 connected to an access point if (osi_SyncObjCreate(&semaphore_Connected) != 0) { Report("Semaphore not created\r\n"); } // // Create OOB Task // Report("Starting OOBTask\r\n"); osi_TaskCreate(OOBTask, (signed char*)"OOBTask", OSI_STACK_SIZE, NULL, OOB_TASK_PRIORITY, NULL ); // // Create mqtt Task // Report("Starting mqttTask\r\n"); osi_TaskCreate(mqttTask, (signed char*)"mqttTask", OSI_STACK_SIZE, NULL, OOB_TASK_PRIORITY, NULL ); // // Start OS Scheduler // osi_start(); while (1) { } }
//**************************************************************************** // MAIN FUNCTION //**************************************************************************** void main() { long lRetVal = -1; // // Board Initilization // BoardInit(); // // Configure the pinmux settings for the peripherals exercised // PinMuxConfig(); PinConfigSet(PIN_58,PIN_STRENGTH_2MA|PIN_STRENGTH_4MA,PIN_TYPE_STD_PD); // Initialize Global Variables InitializeAppVariables(); // // UART Init // InitTerm(); DisplayBanner(APP_NAME); // // LED Init // GPIO_IF_LedConfigure(LED1); //Turn Off the LEDs GPIO_IF_LedOff(MCU_RED_LED_GPIO); // // I2C Init // lRetVal = I2C_IF_Open(I2C_MASTER_MODE_FST); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } //Init Temprature Sensor lRetVal = TMP006DrvOpen(); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } //Init Accelerometer Sensor lRetVal = BMA222Open(); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Simplelinkspawntask // lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Create OOB Task // lRetVal = osi_TaskCreate(OOBTask, (signed char*)"OOBTask", \ OSI_STACK_SIZE, NULL, \ OOB_TASK_PRIORITY, NULL ); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start OS Scheduler // osi_start(); while (1) { } }