9 #include "contiki-conf.h"
10 #include "sys/clock.h"
18 #define PRINTF(...) printf(__VA_ARGS__)
23 static volatile clock_time_t current_tick;
24 static volatile unsigned long current_seconds = 0;
25 static volatile unsigned long second_countdown =
CLOCK_SECOND;
42 return current_seconds;
51 current_seconds = sec;
104 LPTMR0->PSR = (LPTMR_PSR_PBYP_MASK | LPTMR_PSR_PCS(0b10));
106 LPTMR0->CSR |= (LPTMR_CSR_TEN_MASK | LPTMR_CSR_TIE_MASK);
120 PRINTF(
"LPT: Interrupt\n");
125 if(--second_countdown == 0) {
__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
Enable External Interrupt.
#define LPTMR0
Peripheral LPTMR0 base pointer.
#define SIM
Peripheral SIM base pointer.
void clock_init(void)
Initialize the clock library.
K60 hardware register header wrapper.
CCIF clock_time_t clock_time(void)
Get the current clock time.
Power mode switching functions for the K60 CPU.
void etimer_request_poll(void)
Make the event timer aware that the clock has changed.
void clock_set_seconds(unsigned long sec)
Set the value of the platform seconds.
CCIF unsigned long clock_seconds(void)
Get the current value of the platform seconds.
int etimer_pending(void)
Check if there are any non-expired event timers.
void clock_delay(unsigned int delay)
Obsolete delay function but we implement it here since some code still uses it.
void clock_wait(clock_time_t t)
Wait for a given number of ticks.
#define BITBAND_REG(Reg, Bit)
Macro to access a single bit of a peripheral register (bit band region 0x40000000 to 0x400FFFFF) usin...
#define CLOCK_SECOND
A second, measured in system clock time.