⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 touchscreen.c

📁 MTK6225
💻 C
📖 第 1 页 / 共 5 页
字号:
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_pen_disable();
    g_pen_cntx.is_blocked = 1;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_unblock
 * DESCRIPTION
 *  Unblock pen system
 *  
 *  Note: typically used for keypad lock in idle screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_pen_unblock(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_pen_cntx.is_blocked = 0;
    mmi_pen_enable();
}


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_enable
 * DESCRIPTION
 *  Enable pen system
 *  
 *  Note: typically on Keypad Up
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_pen_enable(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_pen_cntx.is_blocked || g_pen_cntx.is_enabled)
    {
        return;
    }

    memset(&g_pen_cntx, 0, sizeof(g_pen_cntx));
    g_pen_cntx.is_enabled = 1;

#if !defined(MMI_ON_WIN32)
    mmi_pen_MODIS_start_timer();
#endif 
}


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_disable
 * DESCRIPTION
 *  Disable pen system
 *  
 *  Note: typically on Keypad Down because we don't want to use keypad and touch screen
 *  at the same time
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_pen_disable(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_pen_cntx.is_blocked || !g_pen_cntx.is_enabled)
    {
        return;
    }

    gui_cancel_timer(mmi_pen_simulator_repeat_hdlr);

    if (g_pen_cntx.is_pen_down)
    {
        if (g_pen_event_table[MMI_PEN_EVENT_ABORT])
        {
            (g_pen_event_table[MMI_PEN_EVENT_ABORT]) (g_pen_cntx.pen_current_pos);
        }
    }

    memset(&g_pen_cntx, 0, sizeof(g_pen_cntx));

#if !defined(MMI_ON_WIN32)
    mmi_pen_MODIS_flush_queue();
#endif 
}


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_reset
 * DESCRIPTION
 *  Reset the status of touch screen
 *  - Flush event queue
 *  - If the pen is currently tapped down, ignore all subsequent pen events until the pen is up.
 *  
 *  Note: typically on MMI screen switching
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_pen_reset(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_pen_cntx.is_blocked || !g_pen_cntx.is_enabled)
    {
        return;
    }

    gui_cancel_timer(mmi_pen_simulator_repeat_hdlr);

    if (g_pen_cntx.is_pen_down)
    {
        gui_cancel_timer(mmi_pen_simulator_repeat_hdlr);

        if (g_pen_event_table[MMI_PEN_EVENT_ABORT])
        {
            (g_pen_event_table[MMI_PEN_EVENT_ABORT]) (g_pen_cntx.pen_current_pos);
        }
    }

    memset(&g_pen_cntx, 0, sizeof(g_pen_cntx));
    g_pen_cntx.is_enabled = 1;

#if !defined(MMI_ON_WIN32)
    mmi_pen_MODIS_flush_queue();
#endif 
}


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_get_state
 * DESCRIPTION
 *  Get the current state of touch screen
 * PARAMETERS
 *  is_enabled      [OUT]         
 *  is_pen_down     [OUT]         
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_pen_get_state(kal_bool *is_enabled, kal_bool *is_pen_down)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_pen_cntx.is_enabled)
    {
        *is_enabled = KAL_TRUE;
        if (g_pen_cntx.is_pen_down)
        {
            *is_pen_down = KAL_TRUE;
        }
        else
        {
            *is_pen_down = KAL_FALSE;
        }
    }
    else
    {
        *is_enabled = KAL_FALSE;
        *is_pen_down = KAL_FALSE;
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_start_calibration
 * DESCRIPTION
 *  Start pen calibration
 * PARAMETERS
 *  num         [IN]        Number of calibration points
 *  points      [IN]        Calibration points
 * RETURNS
 *  void
 * REMARKS
 *  After mmi_pen_reset(), the calibration process is terminated.
 *****************************************************************************/
void mmi_pen_start_calibration(kal_uint16 num, const mmi_pen_point_struct *points)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* DUMMY */
}


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_set_calibration_data
 * DESCRIPTION
 *  Assign driver calibration data
 * PARAMETERS
 *  data        [IN]        
 * RETURNS
 *  void
 * REMARKS
 *  
 *****************************************************************************/
void mmi_pen_set_calibration_data(const mmi_pen_calibration_struct *data)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* DUMMY */
}


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_read_calibration_data
 * DESCRIPTION
 *  Read the current value of driver calibration data
 * PARAMETERS
 *  data        [OUT]       
 * RETURNS
 *  void
 * REMARKS
 *  
 *****************************************************************************/
void mmi_pen_read_calibration_data(mmi_pen_calibration_struct *data)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* DUMMY */
}


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_register_down_handler
 * DESCRIPTION
 *  Register the Pen Down handler
 * PARAMETERS
 *  pen_fp      [IN]        Callback handler
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_pen_register_down_handler(mmi_pen_hdlr pen_fp)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_pen_event_table[MMI_PEN_EVENT_DOWN] = pen_fp;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_register_long_tap_handler
 * DESCRIPTION
 *  Register the Pen LongTap handler
 *  
 *  LongTap handler is invoked when  the pen is tapped for a period of time
 *  and stays at the same place where it is tapped down.
 *  
 *  It is invoked atmost one time before pen up.
 * PARAMETERS
 *  pen_fp      [IN]        Callback handler
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_pen_register_long_tap_handler(mmi_pen_hdlr pen_fp)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_pen_event_table[MMI_PEN_EVENT_LONG_TAP] = pen_fp;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_register_repeat_handler
 * DESCRIPTION
 *  Register the Pen Repeat handler.
 *  
 *  Repeat handler is invoked after LongTap handler.
 *  However, unlike LongTap handler, Repeat handler is invoked even if
 *  it does not stays at the same place as Pen Down.
 *  
 *  it might be invoked more than one times before pen up.
 * PARAMETERS
 *  pen_fp      [IN]        Callback handler
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_pen_register_repeat_handler(mmi_pen_hdlr pen_fp)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_pen_event_table[MMI_PEN_EVENT_REPEAT] = pen_fp;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_register_move_handler
 * DESCRIPTION
 *  Register the Pen Move handler.
 *  
 *  The invocation frequency of Pen Move handler is typically less than driver sampling rate.
 * PARAMETERS
 *  pen_fp      [IN]        Callback handler
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_pen_register_move_handler(mmi_pen_hdlr pen_fp)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -