MT7697 API Reference  LinkIt SDK v4
Enum
HAL » GPT

Overview

Macros

#define HAL_GPT_MAXIMUM_MS_TIMER_TIME   (130150523)
 The maximum time of millisecond timer.
 

Enumerations

enum  hal_gpt_timer_type_t {
  HAL_GPT_TIMER_TYPE_ONE_SHOT = 0,
  HAL_GPT_TIMER_TYPE_REPEAT = 1
}
 This enum defines the GPT timer type. More...
 
enum  hal_gpt_status_t {
  HAL_GPT_STATUS_ERROR_PORT_USED = -4,
  HAL_GPT_STATUS_ERROR = -3,
  HAL_GPT_STATUS_ERROR_PORT = -2,
  HAL_GPT_STATUS_INVALID_PARAMETER = -1,
  HAL_GPT_STATUS_OK = 0
}
 This enum defines the GPT status. More...
 
enum  hal_gpt_running_status_t {
  HAL_GPT_STOPPED = 0,
  HAL_GPT_RUNNING = 1
}
 This enum defines the GPT running status. More...
 
enum  hal_gpt_port_t {
  HAL_GPT_0 = 0,
  HAL_GPT_1 = 1,
  HAL_GPT_2 = 2,
  HAL_GPT_4 = 4,
  HAL_GPT_MAX
}
 GPT port. More...
 
enum  hal_gpt_clock_source_t {
  HAL_GPT_CLOCK_SOURCE_32K = 0,
  HAL_GPT_CLOCK_SOURCE_1M = 1,
  HAL_GPT_CLOCK_SOURCE_BUS = 2
}
 GPT clock source. More...
 

Enumeration Type Documentation

GPT clock source.

Enumerator
HAL_GPT_CLOCK_SOURCE_32K 

1 tick = 1/32768 second

HAL_GPT_CLOCK_SOURCE_1M 

1 tick = 1 micro second, when using this clock source, please do not use hal_gpt_get_free_run_count() to caculate duaration count.

Instead, calculate the duration count by yourself, and notice that the rollback_value = 0xffffffff/(systemclock / 1000000)

HAL_GPT_CLOCK_SOURCE_BUS 

1 tick = 1/systemclock second.

User could use the api top_mcu_freq_get() defined in top.h to get the system clock time_us = count / (systemclock / 1000000)

GPT port.

Enumerator
HAL_GPT_0 

GPT port0: Used for tickless timer.

The clock source is 32Khz.

HAL_GPT_1 

GPT port1: User defined.

The clock source is 32Khz

HAL_GPT_2 

GPT port2: Use to set a millisecond delay and get 1/32Khz free count.

The clock source is 32768Hz.

HAL_GPT_4 

GPT port4: Use to set a microsecond delay and get microsecond free count.

The clock source is bus_clock.

HAL_GPT_MAX 

GPT max port <invalid>

This enum defines the GPT running status.

Enumerator
HAL_GPT_STOPPED 

The GPT has stopped.

HAL_GPT_RUNNING 

The GPT is running.

This enum defines the GPT status.

Enumerator
HAL_GPT_STATUS_ERROR_PORT_USED 

The timer has beed used.

HAL_GPT_STATUS_ERROR 

GPT function error occurred.

HAL_GPT_STATUS_ERROR_PORT 

A wrong GPT port is set.

HAL_GPT_STATUS_INVALID_PARAMETER 

An invalid parameter.

HAL_GPT_STATUS_OK 

No error occurred during the function call.

This enum defines the GPT timer type.

Enumerator
HAL_GPT_TIMER_TYPE_ONE_SHOT 

Set the GPT oneshot mode.

HAL_GPT_TIMER_TYPE_REPEAT 

Set the GPT repeat mode.