//**************************************************************************** // //! Sets up the identified timers as PWM to drive the peripherals //! //! \param none //! //! This function sets up the folowing //! 1. TIMERA2 (TIMER B) as RED of RGB light //! 2. TIMERA3 (TIMER B) as YELLOW of RGB light //! 3. TIMERA3 (TIMER A) as GREEN of RGB light //! //! \return None. // //**************************************************************************** void InitPWMModules() { // // Initialization of timers to generate PWM output // MAP_PRCMPeripheralClkEnable(PRCM_TIMERA2, PRCM_RUN_MODE_CLK); //MAP_PRCMPeripheralClkEnable(PRCM_TIMERA3, PRCM_RUN_MODE_CLK); // // TIMERA2 (TIMER B) as RED of RGB light. GPIO 9 --> PWM_5 // SetupTimerPWMMode(TIMERA2_BASE, TIMER_B, (TIMER_CFG_SPLIT_PAIR | TIMER_CFG_B_PWM), 1); // // TIMERA3 (TIMER B) as YELLOW of RGB light. GPIO 10 --> PWM_6 // //SetupTimerPWMMode(TIMERA3_BASE, TIMER_A, //(TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PWM | TIMER_CFG_B_PWM), 1); // // TIMERA3 (TIMER A) as GREEN of RGB light. GPIO 11 --> PWM_7 // //SetupTimerPWMMode(TIMERA3_BASE, TIMER_B, //(TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PWM | TIMER_CFG_B_PWM), 1); MAP_TimerEnable(TIMERA2_BASE,TIMER_B); //MAP_TimerEnable(TIMERA3_BASE,TIMER_A); //MAP_TimerEnable(TIMERA3_BASE,TIMER_B); } //**************************************************************************** // //! \brief Handles HTTP Server Task //! //! \param[in] pvParameters is the data passed to the Task //! //! \return None // //**************************************************************************** static void HTTPServerTask(void *pvParameters) { lRetVal = -1; InitializeAppVariables(); // // Following function configure the device to default state by cleaning // the persistent settings stored in NVMEM (viz. connection profiles & // policies, power policy etc) // // Applications may choose to skip this step if the developer is sure // that the device is in its default state at start of applicaton // // Note that all profiles and persistent settings that were done on the // device will be lost // lRetVal = ConfigureSimpleLinkToDefaultState(); if(lRetVal < 0) { if (DEVICE_NOT_IN_STATION_MODE == lRetVal) //UART_PRINT("Failed to configure the device in its default state\n\r"); LOOP_FOREVER(); } //UART_PRINT("Device is configured in default state \n\r"); memset(g_ucSSID,'\0',AP_SSID_LEN_MAX); //Read Device Mode Configuration ReadDeviceConfiguration(); //Connect to Network lRetVal = ConnectToNetwork(); if(lRetVal != SUCCESS) { ADC_Stage = 0; AdcWrPtr = 0; ADCuartDiff = 0; AdcRdPtr = 0; //tcp_socket tasks lRetVal = ConfigureSimpleLinkToDefaultState(); if(lRetVal < 0) { if (DEVICE_NOT_IN_STATION_MODE == lRetVal) //UART_PRINT("Failed to configure the device in its default state \n\r"); LOOP_FOREVER(); } //UART_PRINT("Device is configured in default state \n\r"); lRetVal = sl_Start(0, 0, 0); if (lRetVal < 0) { //UART_PRINT("Failed to start the device \n\r"); LOOP_FOREVER(); } //UART_PRINT("Device started as STATION \n\r"); //UART_PRINT("Connecting to AP: %s ...\r\n",Profile_Config.SSID); // Connecting to WLAN AP - Set with static parameters defined at common.h // After this call we will be connected and have IP address lRetVal = WlanConnect(); if(lRetVal < 0) { //UART_PRINT("Connection to AP failed \n\r"); LOOP_FOREVER(); } //UART_PRINT("Connected to AP: %s \n\r",Profile_Config.SSID); /*UART_PRINT("Device IP: %d.%d.%d.%d\n\r\n\r", SL_IPV4_BYTE(Machine_IP_Config.ipV4,3), SL_IPV4_BYTE(Machine_IP_Config.ipV4,2), SL_IPV4_BYTE(Machine_IP_Config.ipV4,1), SL_IPV4_BYTE(Machine_IP_Config.ipV4,0));*/ /*UART_PRINT("Default settings: SSID Name: %s, PORT = %d, Packet Count = %d, " "Destination IP: %d.%d.%d.%d\n\r", Profile_Config.SSID, g_uiPortNum, g_ulPacketCount, SL_IPV4_BYTE(Server_IP_Config.ServerIP,3), SL_IPV4_BYTE(Server_IP_Config.ServerIP,2), SL_IPV4_BYTE(Server_IP_Config.ServerIP,1), SL_IPV4_BYTE(Server_IP_Config.ServerIP,0));*/ //here we will configure and initialize Timer0 interrupt to toggle PIN_62 //Configure_Timer0_Interrupt(); //Configure_ADC_CH_0_BAT_MON(); // // Initialize the PWMs used for driving PIN_64 // InitPWMModules(); // // Initialize the I2C module @ 100Kbps // I2C_IF_Open(I2C_MASTER_MODE_STD); /* I2C_MASTER_MODE_FST for 400Kbps */ // // Configure the STC3100 Battery Monitoring module // Configure_STC3100_BatMon(); // // Configure the PCF8563 RTC module // Configure_PCF8563_RTC(); RTC_Set_Current_TimeDate(); // // Initialize the GSPI module // Init_SPI_ETH(); // // Initialize the falling edge triggered ASIC dtat ready interrupt for driving PIN_61 // Button_IF_Init(GPIOs3IntHandler); /*here we will configure and initialize TimerA1 interrupt for 100Hz. Various timer based tasks can be carried out here i.e. Battery monitoring every 10 seconds, RTC reading etc*/ Configure_TimerA1_Interrupt(); // open socket here BsdTcpClient(g_uiPortNum); while(1) {}