Skip to content

Group ns-timer

Modules > ns-timer

Classes

Type Name
struct ns_timer_config
ns-timer configuration struct

Public Types

Type Name
typedef void(* ns_timer_callback_cb
typedef struct ns_timer_config ns_timer_config_t
ns-timer configuration struct
enum ns_timers_e
Supported Timers.

Public Attributes

Type Name
const ns_core_api_t ns_timer_V0_0_1
const ns_core_api_t ns_timer_V1_0_0
const ns_core_api_t ns_timer_current_version
const ns_core_api_t ns_timer_oldest_supported_version

Public Functions

Type Name
uint32_t ns_timer_clear (ns_timer_config_t * cfg)
Clear timer.
uint32_t ns_timer_init (ns_timer_config_t * cfg)
Initialize one of 3 timers supported by NeuralSPOT.
uint32_t ns_us_ticker_read (ns_timer_config_t * cfg)
Read current value of timer.

Macros

Type Name
define NS_TIMER_API_ID 0xCA0002
define NS_TIMER_CURRENT_VERSION NS_TIMER_V1_0_0
define NS_TIMER_OLDEST_SUPPORTED_VERSION NS_TIMER_V0_0_1
define NS_TIMER_V0_0_1 { .major = 0, .minor = 0, .revision = 1 }
define NS_TIMER_V1_0_0 { .major = 1, .minor = 0, .revision = 0 }

Public Types Documentation

typedef ns_timer_callback_cb

typedef void(* ns_timer_callback_cb) (struct ns_timer_config *);

typedef ns_timer_config_t

typedef struct ns_timer_config ns_timer_config_t;

enum ns_timers_e

enum ns_timers_e {
    NS_TIMER_COUNTER = 0,
    NS_TIMER_INTERRUPT = 1,
    NS_TIMER_USB = 2,
    NS_TIMER_TEMPCO = 3
};

Public Attributes Documentation

variable ns_timer_V0_0_1

const ns_core_api_t ns_timer_V0_0_1;

variable ns_timer_V1_0_0

const ns_core_api_t ns_timer_V1_0_0;

variable ns_timer_current_version

const ns_core_api_t ns_timer_current_version;

variable ns_timer_oldest_supported_version

const ns_core_api_t ns_timer_oldest_supported_version;

Public Functions Documentation

function ns_timer_clear

Clear timer.

uint32_t ns_timer_clear (
    ns_timer_config_t * cfg
) 

Parameters:

  • cfg

Returns:

uint32_t status

function ns_timer_init

Initialize one of 3 timers supported by NeuralSPOT.

uint32_t ns_timer_init (
    ns_timer_config_t * cfg
) 

NS_TIMER_COUNTER Intended use is reading timerticks NS_TIMER_INTERRUPT Calls a callback periodically NS_TIMER_USB Used by ns_usb to periodically service USB NS_TIMER_TEMPCO Used by ns_tempco to periodically collect temps

Parameters:

  • cfg

Returns:

uint32_t status

function ns_us_ticker_read

Read current value of timer.

uint32_t ns_us_ticker_read (
    ns_timer_config_t * cfg
) 

Parameters:

  • cfg

Returns:

uint32_t timer if success, 0xDEADBEEF if bad handle

Macro Definition Documentation

define NS_TIMER_API_ID

#define NS_TIMER_API_ID 0xCA0002

define NS_TIMER_CURRENT_VERSION

#define NS_TIMER_CURRENT_VERSION NS_TIMER_V1_0_0

define NS_TIMER_OLDEST_SUPPORTED_VERSION

#define NS_TIMER_OLDEST_SUPPORTED_VERSION NS_TIMER_V0_0_1

define NS_TIMER_V0_0_1

#define NS_TIMER_V0_0_1 { .major = 0, .minor = 0, .revision = 1 }

define NS_TIMER_V1_0_0

#define NS_TIMER_V1_0_0 { .major = 1, .minor = 0, .revision = 0 }