InPlay API
Counter driver

HAL_COUNTER. More...

Enumerations

enum  cnt_int_pin
 Counter internal pin.
 

Functions

cnt_dev_t * hal_cnt_open (int id, cnt_init_t *init)
 Open counter device. More...
 
void hal_cnt_close (cnt_dev_t *dev)
 Close counter device. More...
 
int hal_cnt_sync (cnt_dev_t *dev, uint32_t mask)
 Synchronize status registers manually. Will block until register finish update. More...
 
int hal_cnt_intr_mask (cnt_dev_t *dev)
 Set interrupt mask. More...
 
int hal_cnt_intr_unmask (cnt_dev_t *dev)
 Set interrupt unmask. More...
 
int hal_cnt_pin_mux_en (int port, int pin, int en)
 Set pin mux. More...
 
int hal_cnt_internal_din_pinmux (int inner_pin, int ext_port, int ext_pin)
 Set din pin mux. More...
 
int hal_cnt_internal_dout_pinmux (int inner_pin, int ext_port, int ext_pin)
 Set dout pin mux. More...
 
int hal_cnt_enable (cnt_dev_t *dev)
 Enable counter. More...
 
int hal_cnt_disable (cnt_dev_t *dev)
 Disable counter. More...
 
uint32_t hal_cnt_get_clk (cnt_dev_t *dev)
 Get counter clock frequency. More...
 
int hal_cnt_pin_chk (int port, int pin)
 Check counter pinmux. More...
 
void hal_cnt_set_handler (cnt_dev_t *dev, CNT_ISR_FUN fun, void *arg)
 Set ISR handler. More...
 

Detailed Description

HAL_COUNTER.

Function Documentation

◆ hal_cnt_close()

void hal_cnt_close ( cnt_dev_t *  dev)

Close counter device.

Parameters
[in]devCounter device struct

◆ hal_cnt_disable()

int hal_cnt_disable ( cnt_dev_t *  dev)

Disable counter.

Parameters
[in]devCounter device struct
Returns
See also
enum cnt_error for return code.

◆ hal_cnt_enable()

int hal_cnt_enable ( cnt_dev_t *  dev)

Enable counter.

Parameters
[in]devCounter device struct
Returns
See also
enum cnt_error for return code.

◆ hal_cnt_get_clk()

uint32_t hal_cnt_get_clk ( cnt_dev_t *  dev)

Get counter clock frequency.

Parameters
[in]devCounter device struct
Returns
Counter clock frequency, 0 if failed

◆ hal_cnt_internal_din_pinmux()

int hal_cnt_internal_din_pinmux ( int  inner_pin,
int  ext_port,
int  ext_pin 
)

Set din pin mux.

Parameters
[in]inner_pininternal pin id
See also
enum cnt_int_pin.
Parameters
[in]ext_portexternal port
See also
enum gpio_port
Parameters
[in]ext_pinexternal pin
See also
enum gpio_pin
Returns
See also
enum cnt_error for return code.

◆ hal_cnt_internal_dout_pinmux()

int hal_cnt_internal_dout_pinmux ( int  inner_pin,
int  ext_port,
int  ext_pin 
)

Set dout pin mux.

Parameters
[in]inner_pininternal pin id
See also
enum cnt_int_pin.
Parameters
[in]ext_portexternal port
See also
enum gpio_port
Parameters
[in]ext_pinexternal pin
See also
enum gpio_pin
Returns
See also
enum cnt_error for return code.

◆ hal_cnt_intr_mask()

int hal_cnt_intr_mask ( cnt_dev_t *  dev)

Set interrupt mask.

Parameters
[in]devCounter device struct
Returns
See also
enum cnt_error for return code.

◆ hal_cnt_intr_unmask()

int hal_cnt_intr_unmask ( cnt_dev_t *  dev)

Set interrupt unmask.

Parameters
[in]devCounter device struct
Returns
See also
enum cnt_error for return code.

◆ hal_cnt_open()

cnt_dev_t* hal_cnt_open ( int  id,
cnt_init_t *  init 
)

Open counter device.

Parameters
[in]idCounter ID
[in]initinit paramter,
See also
cnt_init_t
Returns
Counter device struct, NULL if failed

◆ hal_cnt_pin_chk()

int hal_cnt_pin_chk ( int  port,
int  pin 
)

Check counter pinmux.

Parameters
[in]portport
See also
enum gpio_port
Parameters
[in]pinpin
See also
enum gpio_pin
Returns
See also
enum cnt_error for return code.

◆ hal_cnt_pin_mux_en()

int hal_cnt_pin_mux_en ( int  port,
int  pin,
int  en 
)

Set pin mux.

Parameters
[in]portport
See also
enum gpio_port
Parameters
[in]pinpin
See also
enum gpio_pin
Parameters
[in]enenable or disable pin
Returns
See also
enum cnt_error for return code.

◆ hal_cnt_set_handler()

void hal_cnt_set_handler ( cnt_dev_t *  dev,
CNT_ISR_FUN  fun,
void *  arg 
)

Set ISR handler.

Parameters
[in]devCounter device struct.
[in]funCallback function.
[in]argCallback fucntion arguments.
Returns
See also
enum cnt_error for return code.

◆ hal_cnt_sync()

int hal_cnt_sync ( cnt_dev_t *  dev,
uint32_t  mask 
)

Synchronize status registers manually. Will block until register finish update.

Parameters
[in]devCounter device struct
[in]maskRegister mask
Returns
See also
enum cnt_error for return code.