Пример #1
0
/*********************************************************************
*
*       GUI_Exec
*/
int GUI_Exec(void) {
    int r = 0;
    void DisplayUpdate();
    while (GUI_Exec1()) {
        r = 1;                  /* We have done something */
    }
    if(r)
        DisplayUpdate();
    return r;
}
Пример #2
0
extern void HandleTimeGattReadCharValCFM(GATT_READ_CHAR_VAL_CFM_T *cfm)
{
    if(cfm->result != sys_status_success)
    {
        /* If we have received an error with error code. */
        g_time_serv_data.conf_handle_ptr = NULL;
        return;
    }

    /* If this signal is for Time characteristic read, It will
     * get handled in handleTimeGattReadCharValCFM
     */
    if(g_time_serv_data.conf_handle_ptr == &g_time_serv_data.cur_time_handle)
    {
        /* This read characteristic value confirmation is for current time read.
         * contains the year (u16), month(u8), day(u8), hour(u8), minutes(u8),
         * seconds(u8), day of week (u8), Fractions256 (u8), adjust reason (u8)
         */
        g_time_serv_data.conf_handle_ptr = NULL;

        DisplayTime(cfm->value, cfm->size_value);
    }
    else if(g_time_serv_data.conf_handle_ptr ==
                &g_time_serv_data.local_time_info_handle)
    {
        /* This read characteristic value confirmation is for current time
         * zone read.
         */
        g_time_serv_data.conf_handle_ptr = NULL;

        DisplayTimeZone(cfm->value, cfm->size_value);
    }
    else if(g_time_serv_data.conf_handle_ptr ==
                &g_time_serv_data.ref_time_info_handle)
    {
        /* This read characteristic value confirmation is for the reference
         * time source information.
         */
        g_time_serv_data.conf_handle_ptr = NULL;

        DisplayRefSource(cfm->value, cfm->size_value);
    }
    else if(g_time_serv_data.conf_handle_ptr ==
                &g_time_serv_data.time_with_dst_handle)
    {
        /* This read characteristic value confirmation is for the next
         * dst time information.
         */
        g_time_serv_data.conf_handle_ptr = NULL;

        DisplayNextDST(cfm->value, cfm->size_value);
    }
    else if(g_time_serv_data.conf_handle_ptr ==
                &g_time_serv_data.time_update_state_handle)
    {
        /* This read characteristic value confirmation is for the status
         * of the update reference time source.
         */
        g_time_serv_data.conf_handle_ptr = NULL;

        DisplayUpdate(cfm->value, cfm->size_value);
    }
}
Пример #3
0
//*****************************************************************************
//
// The main loop for the user interface.
//
//*****************************************************************************
int
main(void)
{
    unsigned long ulPanel;

    //
    // If running on Rev A2 silicon, turn the LDO voltage up to 2.75V.  This is
    // a workaround to allow the PLL to operate reliably.
    //
    if(REVISION_IS_A2)
    {
        SysCtlLDOSet(SYSCTL_LDO_2_75V);
    }

    //
    // Set the clocking to run at 50MHz from the PLL.
    //
    SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
                   SYSCTL_XTAL_8MHZ);

    //
    // Set the priority of the interrupts.
    //
    IntPrioritySet(INT_CAN0, 0x00);
    IntPrioritySet(FAULT_SYSTICK, 0x20);

    //
    // Configure SysTick to generate an interrupt every millisecond.
    //
    SysTickPeriodSet(SysCtlClockGet() / 1000);
    SysTickIntEnable();
    SysTickEnable();

    //
    // Initialize the push button driver.
    //
    ButtonsInit();

    //
    // Initialize the CAN communication channel.
    //
    CANCommInit();

    //
    // Initialize the UART used to perform a "firmware update".
    //
    UpdateUARTInit();

    //
    // Initialize the display.
    //
    RIT128x96x4Init(3500000);

    //
    // Add the screen-clearing widget to the widget tree.  As the first widget
    // in the tree, this will always be drawn first, resulting in a blank
    // screen before anything else is drawn.
    //
    WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sBackground);

    //
    // Display the splash screen.
    //
    DisplaySplash();

    //
    // Set the CAN device ID to one.
    //
    CANSetID(1);

    //
    // The "Voltage Control Mode" panel should be displayed first.
    //
    ulPanel = PANEL_VOLTAGE;

    //
    // Loop forever.
    //
    while(1)
    {
        //
        // Determine which panel to display.
        //
        switch(ulPanel)
        {
            //
            // The "Voltage Control Mode" panel should be displayed.
            //
            case PANEL_VOLTAGE:
            {
                ulPanel = DisplayVoltage();
                break;
            }

            //
            // The "VComp Control Mode" panel should be displayed.
            //
            case PANEL_VCOMP:
            {
                ulPanel = DisplayVComp();
                break;
            }

            //
            // The "Current Control Mode" panel should be displayed.
            //
            case PANEL_CURRENT:
            {
                ulPanel = DisplayCurrent();
                break;
            }

            //
            // The "Speed Control Mode" panel should be displayed.
            //
            case PANEL_SPEED:
            {
                ulPanel = DisplaySpeed();
                break;
            }

            //
            // The "Position Control Mode" panel should be displayed.
            //
            case PANEL_POSITION:
            {
                ulPanel = DisplayPosition();
                break;
            }

            //
            // The "Configuration" panel should be displayed.
            //
            case PANEL_CONFIGURATION:
            {
                ulPanel = DisplayConfig();
                break;
            }

            //
            // The "Device List" panel should be displayed.
            //
            case PANEL_DEV_LIST:
            {
                ulPanel = DisplayDevList();
                break;
            }

            //
            // The "Firmware Update" panel should be displayed.
            //
            case PANEL_UPDATE:
            {
                ulPanel = DisplayUpdate();
                break;
            }

            //
            // The "Help" panel should be displayed.
            //
            case PANEL_HELP:
            {
                ulPanel = DisplayHelp();
                break;
            }

            //
            // The "About" panel should be displayed.
            //
            case PANEL_ABOUT:
            {
                ulPanel = DisplayAbout();
                break;
            }
        }
    }
}