typedef enum { VM_DCL_EINT_COMMAND_GROUP_START = 0x1E00, VM_DCL_EINT_COMMAND_CONFIG, VM_DCL_EINT_COMMAND_SET_HW_DEBOUNCE, VM_DCL_EINT_COMMAND_SET_POLARITY, VM_DCL_EINT_COMMAND_SET_SENSITIVITY, VM_DCL_EINT_COMMAND_MASK, VM_DCL_EINT_COMMAND_UNMASK, VM_DCL_EINT_COMMAND_RESERVED, VM_DCL_EINT_COMMAND_SET_AUTO_CHANGE_POLARITY } VM_DCL_EINT_COMMAND;
typedef enum { VM_DCL_EINT_COMMAND_GROUP_START = 0x1E00, VM_DCL_EINT_COMMAND_CONFIG, VM_DCL_EINT_COMMAND_SET_HW_DEBOUNCE, VM_DCL_EINT_COMMAND_SET_POLARITY, VM_DCL_EINT_COMMAND_SET_SENSITIVITY, VM_DCL_EINT_COMMAND_MASK, VM_DCL_EINT_COMMAND_UNMASK, VM_DCL_EINT_COMMAND_RESERVED, VM_DCL_EINT_COMMAND_SET_AUTO_CHANGE_POLARITY } VM_DCL_EINT_COMMAND;
Defines the EINT control commands, used by vm_dcl_control() as a parameter. With different commands, user could control the different function of the EINTs. To control EINTs, you should use DCL(Driver Common Layer) APIs.
#include "vmdcl.h" VM_DCL_HANDLE eint_handle; // Declares a VM_DCL_HANDLE variable. vm_eint_control_config_t eint_config; // Declares a vm_eint_control_config_t variable. vm_eint_control_sensitivity_t sens_data; // Declares a vm_eint_control_sensitivity_t variable. vm_eint_control_hw_debounce_t debounce_time; // Declares a vm_eint_control_hw_debounce_t variable. eint_handle = vm_dcl_open(VM_DCL_EINT, PIN2EINT(VM_PIN_P0)); // Calls vm_dcl_open() to get a handle. Use PIN2EINT to convert from pin name to EINT number. vm_dcl_control(eint_handle, VM_EINT_COMMAND_MASK, NULL); // Before configuring EINT, we mask it firstly. vm_dcl_registercallback(eint_handle, EVENT_EINT_TRIGGER, eint_callback, (void*)NULL ); // Registers the callback. Note: the last parameter is NULL. sens_data.sensitivity = 1; // 1 means the Level Sensitive. 0 means the Edge Sensitive. vm_dcl_control(eint_handle, VM_EINT_COMMAND_SET_SENSITIVITY, (void *)&sens_data); // Sets EINT sensitivity. debounce_time.debounce_time = 10; // Debounce time 10ms vm_dcl_control(eint_handle,VM_EINT_COMMAND_SET_HW_DEBOUNCE,(void *)&debounce_time); // Set debounce time eint_config.act_polarity = 0; // 1 means positive activated. 0 means negative activated. eint_config.debounce_en = 1; // 1 means to enable the HW debounce. 0 means to disable the HW debounce. eint_config.auto_unmask = 1; // 1 means to unmask after callback. 0 means not to unmask and the callers should unmask themselves. vm_dcl_control(eint_handle, VM_EINT_COMMAND_CONFIG, (void*)&eint_config); // Calls this API prior to unmasking the EINT next. vm_dcl_control(eint_handle, VM_EINT_COMMAND_UNMASK, NULL); // Calls this function to unmask the EINT. vm_dcl_close(eint_handle); // Finally, calls vm_dcl_close().
vmdcl_eint.h
|
Members |
Description |
|
VM_DCL_EINT_COMMAND_GROUP_START = 0x1E00 |
EINT command group starts. |
|
VM_DCL_EINT_COMMAND_CONFIG |
EINT configure command. |
|
VM_DCL_EINT_COMMAND_SET_HW_DEBOUNCE |
EINT set hardware debounce command. |
|
VM_DCL_EINT_COMMAND_SET_POLARITY |
EINT set polarity command. |
|
VM_DCL_EINT_COMMAND_SET_SENSITIVITY |
EINT set sensitivity command. |
|
VM_DCL_EINT_COMMAND_MASK |
EINT mask command. |
|
VM_DCL_EINT_COMMAND_UNMASK |
EINT unmask command. |
|
VM_DCL_EINT_COMMAND_RESERVED |
Reserved. Do not use it. |
|
VM_DCL_EINT_COMMAND_SET_AUTO_CHANGE_POLARITY |
EINT set auto change polarity command. |
Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at
support@toolsfactory.com.