hal_dual_tim.h File Reference

Header file containing functions prototypes of DUAL TIMER HAL library. More...

#include "hal_def.h"
#include "ll_dual_tim.h"

Go to the source code of this file.

Classes

struct  _dual_timer_init
 DUAL TIMER init Structure definition. More...
 
struct  _dual_timer_io_ctrl_cfg
 DUAL TIMER io crtl config Structure definition. More...
 
struct  _dual_timer_handle
 DUAL_TIMER handle Structure definition. More...
 
struct  _hal_dual_timer_callback
 HAL_DUAL_TIMER Callback function definition. More...
 

Macros

#define DUAL_TIMER_PRESCALER_DIV0   LL_DUAL_TIMER_PRESCALER_DIV0
 
#define DUAL_TIMER_PRESCALER_DIV16   LL_DUAL_TIMER_PRESCALER_DIV16
 
#define DUAL_TIMER_PRESCALER_DIV256   LL_DUAL_TIMER_PRESCALER_DIV256
 
#define DUAL_TIMER_COUNTERMODE_LOOP   0x00000000U
 
#define DUAL_TIMER_COUNTERMODE_ONESHOT   DUAL_TIMER_CTRL_ONESHOT
 
#define DUAL_TIMER_IO_INIT_RESET   LL_DUAL_TIMER_IO_INIT_RESET
 
#define DUAL_TIMER_IO_INIT_SET   LL_DUAL_TIMER_IO_INIT_SET
 
#define DUAL_TIMER_IO_ACTION_NONE   LL_DUAL_TIMER_IO_ACTION_NONE
 
#define DUAL_TIMER_IO_ACTION_SET   LL_DUAL_TIMER_IO_ACTION_SET
 
#define DUAL_TIMER_IO_ACTION_RESET   LL_DUAL_TIMER_IO_ACTION_RESET
 
#define DUAL_TIMER_IO_ACTION_TOGGLE   LL_DUAL_TIMER_IO_ACTION_TOGGLE
 
#define __HAL_DUAL_TIMER_RESET_HANDLE_STATE(__HANDLE__)   ((__HANDLE__)->state = HAL_DUAL_TIMER_STATE_RESET)
 Reset DUAL TIMER handle states. More...
 
#define __HAL_DUAL_TIMER_ENABLE(__HANDLE__)   SET_BITS((__HANDLE__)->p_instance->CTRL, DUAL_TIMER_CTRL_EN)
 Enable the specified DUAL TIMER peripheral. More...
 
#define __HAL_DUAL_TIMER_DISABLE(__HANDLE__)   CLEAR_BITS((__HANDLE__)->p_instance->CTRL, DUAL_TIMER_CTRL_EN)
 Disable the specified DUAL TIMER peripheral. More...
 
#define __HAL_DUAL_TIMER_ENABLE_IT(__HANDLE__)   SET_BITS((__HANDLE__)->p_instance->CTRL, DUAL_TIMER_CTRL_INTEN)
 Enable the DUAL TIMER interrupt. More...
 
#define __HAL_DUAL_TIMER_DISABLE_IT(__HANDLE__)   CLEAR_BITS((__HANDLE__)->p_instance->CTRL, DUAL_TIMER_CTRL_INTEN)
 Disable the DUAL TIMER interrupt. More...
 
#define __HAL_DUAL_TIMER_GET_FLAG_IT(__HANDLE__)   ll_dual_timer_is_active_flag_it(__HANDLE__->p_instance)
 Check whether the DUAL TIMER interrupt has occurred or not. More...
 
#define __HAL_DUAL_TIMER_CLEAR_FLAG_IT(__HANDLE__)   ll_dual_timer_clear_flag_it(__HANDLE__->p_instance)
 Clear the DUAL TIMER interrupt flag. More...
 
#define IS_DUAL_TIMER_PRESCALER(__PRESCALER__)
 Check if DUAL TIMER prescaler is valid. More...
 
#define IS_DUAL_TIMER_COUNTERMODE(__MODE__)
 Check if DUAL TIMER counter mode is valid. More...
 
#define IS_DUAL_TIMER_IO_INIT_STATE(__MODE__)
 Check if DUAL TIMER io initial state is valid. More...
 
#define IS_DUAL_TIMER_IO_ACT_MODE(__MODE__)
 Check if DUAL TIMER io action mode is valid. More...
 

Typedefs

typedef struct _dual_timer_init dual_timer_init_t
 DUAL TIMER init Structure definition. More...
 
typedef struct _dual_timer_io_ctrl_cfg dual_timer_io_ctrl_cfg_t
 DUAL TIMER io crtl config Structure definition. More...
 
typedef struct _dual_timer_handle dual_timer_handle_t
 DUAL_TIMER handle Structure definition. More...
 
typedef struct _hal_dual_timer_callback hal_dual_timer_callback_t
 HAL_DUAL_TIMER Callback function definition. More...
 

Enumerations

enum  hal_dual_timer_state_t {
  HAL_DUAL_TIMER_STATE_RESET = 0x00,
  HAL_DUAL_TIMER_STATE_READY = 0x01,
  HAL_DUAL_TIMER_STATE_BUSY = 0x02,
  HAL_DUAL_TIMER_STATE_ERROR = 0x04
}
 HAL DUAL TIMER State Enumerations definition. More...
 
enum  hal_dual_timer_channel_t {
  HAL_DUAL_TIMER_CHANNEL_A = 0x00,
  HAL_DUAL_TIMER_CHANNEL_B = 0x01,
  HAL_DUAL_TIMER_CHANNEL_C = 0x02
}
 HAL DUAL TIMER Channel Enumerations definition. More...
 

Functions

hal_status_t hal_dual_timer_base_init (dual_timer_handle_t *p_dual_timer)
 Initialize the DUAL TIMER according to the specified parameters in the dual_timer_init_t and initialize the associated handle. More...
 
hal_status_t hal_dual_timer_base_deinit (dual_timer_handle_t *p_dual_timer)
 De-initialize the DUAL TIMER peripheral. More...
 
void hal_dual_timer_base_msp_init (dual_timer_handle_t *p_dual_timer)
 Initialize the DUAL TIMER MSP. More...
 
void hal_dual_timer_base_msp_deinit (dual_timer_handle_t *p_dual_timer)
 De-initialize the DUAL TIMER MSP. More...
 
hal_status_t hal_dual_timer_base_start (dual_timer_handle_t *p_dual_timer)
 Starts the DUAL TIMER counter. More...
 
hal_status_t hal_dual_timer_base_stop (dual_timer_handle_t *p_dual_timer)
 Stops the DUAL TIMER counter. More...
 
hal_status_t hal_dual_timer_base_start_it (dual_timer_handle_t *p_dual_timer)
 Starts the DUAL TIMER counter in interrupt mode. More...
 
hal_status_t hal_dual_timer_base_stop_it (dual_timer_handle_t *p_dual_timer)
 Stops the DUAL TIMER counter in interrupt mode. More...
 
void hal_dual_timer_irq_handler (dual_timer_handle_t *p_dual_timer)
 Handle DUAL TIMER interrupt request. More...
 
void hal_dual_timer_period_elapsed_callback (dual_timer_handle_t *p_dual_timer)
 Period elapsed callback in non-blocking mode. More...
 
void hal_dual_timer_act_start_event_callback (dual_timer_handle_t *p_dual_timer)
 Action when timer start callback in non-blocking mode. More...
 
void hal_dual_timer_ioa_act_c1_event_callback (dual_timer_handle_t *p_dual_timer)
 Action when timer value meets to COUNT_A1IO callback in non-blocking mode. More...
 
void hal_dual_timer_ioa_act_c2_event_callback (dual_timer_handle_t *p_dual_timer)
 Action when timer value meets to COUNT_A2IO callback in non-blocking mode. More...
 
void hal_dual_timer_act_period_event_callback (dual_timer_handle_t *p_dual_timer)
 Action when timer value meets to 0 callback in non-blocking mode. More...
 
void hal_dual_timer_act_stop_event_callback (dual_timer_handle_t *p_dual_timer)
 Action when timer stop callback in non-blocking mode. More...
 
void hal_dual_timer_iob_act_c1_event_callback (dual_timer_handle_t *p_dual_timer)
 Action when timer value meets to COUNT_B1IO callback in non-blocking mode. More...
 
void hal_dual_timer_iob_act_c2_event_callback (dual_timer_handle_t *p_dual_timer)
 Action when timer value meets to COUNT_B2IO callback in non-blocking mode. More...
 
void hal_dual_timer_ioc_act_c1_event_callback (dual_timer_handle_t *p_dual_timer)
 Action when timer value meets to COUNT_C1IO callback in non-blocking mode. More...
 
void hal_dual_timer_ioc_act_c2_event_callback (dual_timer_handle_t *p_dual_timer)
 Action when timer value meets to COUNT_C2IO callback in non-blocking mode. More...
 
void hal_dual_timer_ble_pulse1_event_callback (dual_timer_handle_t *p_dual_timer)
 Action when timer value meets to BLE_COUNT1 callback in non-blocking mode. More...
 
void hal_dual_timer_ble_pulse2_event_callback (dual_timer_handle_t *p_dual_timer)
 Action when timer value meets to BLE_COUNT2 callback in non-blocking mode. More...
 
hal_dual_timer_state_t hal_dual_timer_get_state (const dual_timer_handle_t *p_dual_timer)
 Return the DUAL TIMER handle state. More...
 
hal_status_t hal_dual_timer_set_config (dual_timer_handle_t *p_dual_timer, const dual_timer_init_t *p_structure)
 DUAL TIMER configuration. More...
 
hal_status_t hal_dual_timer_set_background_reload (dual_timer_handle_t *p_dual_timer, uint32_t reload_value)
 DUAL TIMER set background reload value The background reload value contains the value from which the counter is to decrement. This is the value used to reload the counter when Periodic mode is enabled, and the current count reaches 0. The difference is that writes to background reload value do not cause the counter to immediately restart from the new value. More...
 
hal_status_t hal_dual_timer_set_onetime_reload (const dual_timer_handle_t *p_dual_timer, uint32_t reload_value)
 DUAL TIMER set one-time reload value The one-time reload value contains the value from which the counter is to decrement. This is the value used to reload the counter when Periodic mode is enabled, and the current count reaches 0. The difference is that writes to one-time reload value do not cause the counter to immediately restart from the new value. The one-time reload value only takes effect in the next cycle. It has higher priority than background reload. More...
 
hal_status_t hal_dual_timer_set_period_count (const dual_timer_handle_t *p_dual_timer, uint32_t count_value)
 DUAL TIMER set period count value The value is valid when the value is greater than 1. This fucntion is only avaliable in Period/Loop mode with IO control. This function call must be after hal_dual_timer_io_crtl_config. This function will force the stop action interrupt to be turned on. If the current count value of the dual timer is not the period value, it may cause the first period to be shortened. More...
 
hal_status_t hal_dual_timer_io_crtl_config (const dual_timer_handle_t *p_dual_timer, const dual_timer_io_ctrl_cfg_t *p_structure)
 DUAL TIMER io ctrl configuration This function call must be after hal_dual_timer_base_init. More...
 

Detailed Description

Header file containing functions prototypes of DUAL TIMER HAL library.

Author
BLE Driver Team
Attention
#####Copyright (c) 2019 GOODIX All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file hal_dual_tim.h.