1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** GUIX Component                                                        */
17 /**                                                                       */
18 /**   Scroll Wheel Management (Scroll Wheel)                              */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_scroll_wheel.h"
29 
30 GX_CALLER_CHECKING_EXTERNS
31 
32 
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _gxe_scroll_wheel_speed_set                         PORTABLE C      */
38 /*                                                           6.1          */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Kenneth Maxwell, Microsoft Corporation                              */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    This function checks for errors in scroll wheel speed set.          */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    wheel                                 Scroll wheel control block    */
50 /*    wheel                                 Scroll wheel control block    */
51 /*    start_speed_rate                      The rate of start speed to    */
52 /*                                            flick speed.                */
53 /*    end_speed_rate                        The rate of end speed to      */
54 /*                                            flick speed.                */
55 /*    max_steps                             Max steps for scrolling       */
56 /*    delay                                 Delay time of each step       */
57 /*                                                                        */
58 /*  OUTPUT                                                                */
59 /*                                                                        */
60 /*    status                                Completion status             */
61 /*                                                                        */
62 /*  CALLS                                                                 */
63 /*                                                                        */
64 /*    _gx_scroll_wheel_speed_set            Actual scroll wheel speed set */
65 /*                                            call                        */
66 /*                                                                        */
67 /*  CALLED BY                                                             */
68 /*                                                                        */
69 /*    Application Code                                                    */
70 /*                                                                        */
71 /*  RELEASE HISTORY                                                       */
72 /*                                                                        */
73 /*    DATE              NAME                      DESCRIPTION             */
74 /*                                                                        */
75 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
76 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
77 /*                                            resulting in version 6.1    */
78 /*                                                                        */
79 /**************************************************************************/
_gxe_scroll_wheel_speed_set(GX_SCROLL_WHEEL * wheel,GX_FIXED_VAL start_speed_rate,GX_FIXED_VAL end_speed_rate,GX_VALUE max_steps,GX_VALUE delay)80 UINT _gxe_scroll_wheel_speed_set(GX_SCROLL_WHEEL *wheel, GX_FIXED_VAL start_speed_rate, GX_FIXED_VAL end_speed_rate,
81     GX_VALUE max_steps, GX_VALUE delay)
82 {
83 UINT status;
84 
85     /* Check for appropriate caller.  */
86     GX_INIT_AND_THREADS_CALLER_CHECKING
87 
88     if (wheel == GX_NULL)
89     {
90         return GX_PTR_ERROR;
91     }
92 
93     if (wheel -> gx_widget_type == 0)
94     {
95         return GX_INVALID_WIDGET;
96     }
97 
98     if (delay <= 0)
99     {
100         return GX_INVALID_VALUE;
101     }
102 
103     status = _gx_scroll_wheel_speed_set(wheel, start_speed_rate, end_speed_rate, max_steps, delay);
104 
105     return status;
106 }
107 
108