PSOC E8XXGP Device Support Library

| PSOC E8XXGP Device Support Library

Functions
Functions
PDL API Reference » SysTick (Arm&reg; System Timer)

## General Description

## Functions
void | Cy_SysTick_Init (cy_en_systick_clock_source_t clockSource, uint32_t interval)
| Initializes the SysTick driver: More...
void | Cy_SysTick_Enable (void)
| Enables the SysTick timer and its interrupt. More...
void | Cy_SysTick_Disable (void)
| Disables the SysTick timer and its interrupt. More...
Cy_SysTick_Callback | Cy_SysTick_SetCallback (uint32_t number, Cy_SysTick_Callback function)
| Sets the callback function to the specified callback number. More...
Cy_SysTick_Callback | Cy_SysTick_GetCallback (uint32_t number)
| Gets the specified callback function address. More...
void | Cy_SysTick_SetClockSource (cy_en_systick_clock_source_t clockSource)
| Sets the clock source for the SysTick counter. More...
cy_en_systick_clock_source_t | Cy_SysTick_GetClockSource (void)
| Gets the clock source for the SysTick counter. More...
void | Cy_NsSysTick_Enable (void)
| Enables the Non-Secure SysTick timer and its interrupt. More...
void | Cy_NsSysTick_Disable (void)
| Disables the Non-Secure SysTick timer and its interrupt. More...
void | Cy_SysTick_EnableInterrupt (void)
| Enables the SysTick interrupt. More...
void | Cy_SysTick_DisableInterrupt (void)
| Disables the SysTick interrupt. More...
void | Cy_NsSysTick_EnableInterrupt (void)
| Enables the Non-Secure SysTick interrupt. More...
void | Cy_NsSysTick_DisableInterrupt (void)
| Disables the Non-Secure SysTick interrupt. More...
void | Cy_SysTick_SetReload (uint32_t value)
| Sets the value the counter is set to on a startup and after it reaches zero. More...
uint32_t | Cy_SysTick_GetReload (void)
| Gets the value the counter is set to on a startup and after it reaches zero. More...
uint32_t | Cy_SysTick_GetValue (void)
| Gets the current SysTick counter value. More...
void | Cy_SysTick_Clear (void)
| Clears the SysTick counter for a well-defined startup.
uint32_t | Cy_SysTick_GetCountFlag (void)
| Gets the values of the count flag. More...

## Function Documentation

## ◆ Cy_SysTick_Init()

void Cy_SysTick_Init | ( | cy_en_systick_clock_source_t | clockSource,
|  | uint32_t | interval
| ) |  |

Initializes the SysTick driver:

- Initializes the callback addresses with pointers to NULL
- Associates the SysTick system vector with the callback functions
- Sets the SysTick clock by calling Cy_SysTick_SetClockSource()
- Sets the SysTick reload interval by calling Cy_SysTick_SetReload()
- Clears the SysTick counter value by calling Cy_SysTick_Clear()
- Enables the SysTick by calling Cy_SysTick_Enable(). Note the Cy_SysTick_Enable() function also enables the SysTick interrupt by calling Cy_SysTick_EnableInterrupt().

Parameters

  clockSource | The SysTick clock source cy_en_systick_clock_source_t
  interval | The SysTick reload value.

Note
  The parameter interval is a tick value not the actual time interval. If user wants to configure systick interrupt based on time then the interval parameter value will be (((time in micro seconds) / 1000000.0) * source clock frequency in Hz)

Side Effects
  Clears the SysTick count flag if it was set.

## ◆ Cy_SysTick_Enable()

void Cy_SysTick_Enable | ( | void |  | ) |

Enables the SysTick timer and its interrupt.

Side Effects
  Clears the SysTick count flag if it was set

## ◆ Cy_SysTick_Disable()

void Cy_SysTick_Disable | ( | void |  | ) |

Disables the SysTick timer and its interrupt.

Side Effects
  Clears the SysTick count flag if it was set

## ◆ Cy_SysTick_SetCallback()

Cy_SysTick_Callback Cy_SysTick_SetCallback | ( | uint32_t | number,
|  | Cy_SysTick_Callback | function
| ) |  |

Sets the callback function to the specified callback number.

Parameters

  number | The number of the callback function addresses to be set. The valid range is from 0 to CY_SYS_SYST_NUM_OF_CALLBACKS - 1.
  function | The pointer to the function that will be associated with the SysTick ISR for the specified number.

Returns
  Cy_SysTick_Callback Returns the address of the previous callback function. The NULL is returned if the specified address in not set or incorrect parameter is specified.

Side Effects
  The registered callback functions will be executed in the interrupt.

## ◆ Cy_SysTick_GetCallback()

Cy_SysTick_Callback Cy_SysTick_GetCallback | ( | uint32_t | number | ) |

Gets the specified callback function address.

Parameters

  number | The number of the callback function address to get. The valid range is from 0 to CY_SYS_SYST_NUM_OF_CALLBACKS - 1.

Returns
  Cy_SysTick_Callback Returns the address of the specified callback function. The NULL is returned if the specified address in not initialized or incorrect parameter is specified.

## ◆ Cy_SysTick_SetClockSource()

void Cy_SysTick_SetClockSource | ( | cy_en_systick_clock_source_t | clockSource | ) |

Sets the clock source for the SysTick counter.

Clears the SysTick count flag if it was set. If the clock source is not ready this function call will have no effect. After changing the clock source to the low frequency clock, the counter and reload register values will remain unchanged so the time to the interrupt will be significantly longer and vice versa.

Changing the SysTick clock source and/or its frequency will change the interrupt interval and Cy_SysTick_SetReload() should be called to compensate this change.

Parameters

  clockSource | cy_en_systick_clock_source_t Clock source. For the PSoC 64 devices, passing any other value than CY_SYSTICK_CLOCK_SOURCE_CLK_CPU will not affect clock source and it will be as Cy_SysTick_GetClockSource() reports.

## ◆ Cy_SysTick_GetClockSource()

cy_en_systick_clock_source_t Cy_SysTick_GetClockSource | ( | void |  | ) |

Gets the clock source for the SysTick counter.

Returns
  cy_en_systick_clock_source_t Clock source

## ◆ Cy_NsSysTick_Enable()

void Cy_NsSysTick_Enable | ( | void |  | ) |

Enables the Non-Secure SysTick timer and its interrupt.

Side Effects
  Clears the SysTick count flag if it was set

Note
  This macro is available for devices having M33SYSCPUSS IP.

## ◆ Cy_NsSysTick_Disable()

void Cy_NsSysTick_Disable | ( | void |  | ) |

Disables the Non-Secure SysTick timer and its interrupt.

Side Effects
  Clears the SysTick count flag if it was set

Note
  This macro is available for devices having M33SYSCPUSS IP.

## ◆ Cy_SysTick_EnableInterrupt()

void Cy_SysTick_EnableInterrupt | ( | void |  | ) |

Enables the SysTick interrupt.

Side Effects
  Clears the SysTick count flag if it was set

## ◆ Cy_SysTick_DisableInterrupt()

void Cy_SysTick_DisableInterrupt | ( | void |  | ) |

Disables the SysTick interrupt.

Side Effects
  Clears the SysTick count flag if it was set

## ◆ Cy_NsSysTick_EnableInterrupt()

void Cy_NsSysTick_EnableInterrupt | ( | void |  | ) |

Enables the Non-Secure SysTick interrupt.

Side Effects
  Clears the SysTick count flag if it was set

Note
  It is available for devices that support TrustZone.

## ◆ Cy_NsSysTick_DisableInterrupt()

void Cy_NsSysTick_DisableInterrupt | ( | void |  | ) |

Disables the Non-Secure SysTick interrupt.

Side Effects
  Clears the SysTick count flag if it was set

Note
  It is available for devices that support TrustZone.

## ◆ Cy_SysTick_SetReload()

void Cy_SysTick_SetReload | ( | uint32_t | value | ) |

Sets the value the counter is set to on a startup and after it reaches zero.

This function does not change or reset the current sysTick counter value, so it should be cleared using the Cy_SysTick_Clear() API.

Parameters

  value | The valid range is [0x0-0x00FFFFFF]. The counter reset value.

## ◆ Cy_SysTick_GetReload()

uint32_t Cy_SysTick_GetReload | ( | void |  | ) |

Gets the value the counter is set to on a startup and after it reaches zero.

Returns
  The counter reset value.

## ◆ Cy_SysTick_GetValue()

uint32_t Cy_SysTick_GetValue | ( | void |  | ) |

Gets the current SysTick counter value.

Returns
  The current SysTick counter value.

## ◆ Cy_SysTick_GetCountFlag()

uint32_t Cy_SysTick_GetCountFlag | ( | void |  | ) |

Gets the values of the count flag.

The count flag is set once the SysTick counter reaches zero. The flag is cleared on read.

Returns
  Returns a non-zero value if a flag is set; otherwise a zero is returned.

Side Effects
  Clears the SysTick count flag if it was set.

Note
  Applicable only in Polling mode. If the SysTick interrupt is enabled, the count flag will be cleared automatically on interrupt event.