Module rp2040_pac::timer

source ·
Expand description

Controls time and alarms
time is a 64 bit value indicating the time in usec since power-on
timeh is the top 32 bits of time & timel is the bottom 32 bits
to change time write to timelw before timehw
to read time read from timelr before timehr
An alarm is set by setting alarm_enable and writing to the corresponding alarm register
When an alarm is pending, the corresponding alarm_running signal will be high
An alarm can be cancelled before it has finished by clearing the alarm_enable
When an alarm fires, the corresponding alarm_irq is set and alarm_running is cleared
To clear the interrupt write a 1 to the corresponding alarm_irq

Modules§

  • Arm alarm 0, and configure the time it will fire.
    Once armed, the alarm fires when TIMER_ALARM0 == TIMELR.
    The alarm will disarm itself once it fires, and can
    be disarmed early using the ARMED status register.
  • Arm alarm 1, and configure the time it will fire.
    Once armed, the alarm fires when TIMER_ALARM1 == TIMELR.
    The alarm will disarm itself once it fires, and can
    be disarmed early using the ARMED status register.
  • Arm alarm 2, and configure the time it will fire.
    Once armed, the alarm fires when TIMER_ALARM2 == TIMELR.
    The alarm will disarm itself once it fires, and can
    be disarmed early using the ARMED status register.
  • Arm alarm 3, and configure the time it will fire.
    Once armed, the alarm fires when TIMER_ALARM3 == TIMELR.
    The alarm will disarm itself once it fires, and can
    be disarmed early using the ARMED status register.
  • Indicates the armed/disarmed status of each alarm.
    A write to the corresponding ALARMx register arms the alarm.
    Alarms automatically disarm upon firing, but writing ones here
    will disarm immediately without waiting to fire.
  • Set bits high to enable pause when the corresponding debug ports are active
  • Interrupt Enable
  • Interrupt Force
  • Raw Interrupts
  • Interrupt status after masking & forcing
  • Set high to pause the timer
  • Read from bits 63:32 of time
    always read timelr before timehr
  • Write to bits 63:32 of time
    always write timelw before timehw
  • Read from bits 31:0 of time
  • Write to bits 31:0 of time
    writes do not get copied to time until timehw is written
  • Raw read from bits 63:32 of time (no side effects)
  • Raw read from bits 31:0 of time (no side effects)

Structs§

Type Aliases§

  • ALARM0 (rw) register accessor: Arm alarm 0, and configure the time it will fire.
    Once armed, the alarm fires when TIMER_ALARM0 == TIMELR.
    The alarm will disarm itself once it fires, and can
    be disarmed early using the ARMED status register.
  • ALARM1 (rw) register accessor: Arm alarm 1, and configure the time it will fire.
    Once armed, the alarm fires when TIMER_ALARM1 == TIMELR.
    The alarm will disarm itself once it fires, and can
    be disarmed early using the ARMED status register.
  • ALARM2 (rw) register accessor: Arm alarm 2, and configure the time it will fire.
    Once armed, the alarm fires when TIMER_ALARM2 == TIMELR.
    The alarm will disarm itself once it fires, and can
    be disarmed early using the ARMED status register.
  • ALARM3 (rw) register accessor: Arm alarm 3, and configure the time it will fire.
    Once armed, the alarm fires when TIMER_ALARM3 == TIMELR.
    The alarm will disarm itself once it fires, and can
    be disarmed early using the ARMED status register.
  • ARMED (rw) register accessor: Indicates the armed/disarmed status of each alarm.
    A write to the corresponding ALARMx register arms the alarm.
    Alarms automatically disarm upon firing, but writing ones here
    will disarm immediately without waiting to fire.
  • DBGPAUSE (rw) register accessor: Set bits high to enable pause when the corresponding debug ports are active
  • INTE (rw) register accessor: Interrupt Enable
  • INTF (rw) register accessor: Interrupt Force
  • INTR (rw) register accessor: Raw Interrupts
  • INTS (r) register accessor: Interrupt status after masking & forcing
  • PAUSE (rw) register accessor: Set high to pause the timer
  • TIMEHR (r) register accessor: Read from bits 63:32 of time
    always read timelr before timehr
  • TIMEHW (w) register accessor: Write to bits 63:32 of time
    always write timelw before timehw
  • TIMELR (r) register accessor: Read from bits 31:0 of time
  • TIMELW (w) register accessor: Write to bits 31:0 of time
    writes do not get copied to time until timehw is written
  • TIMERAWH (r) register accessor: Raw read from bits 63:32 of time (no side effects)
  • TIMERAWL (r) register accessor: Raw read from bits 31:0 of time (no side effects)