Sha256: 145397008f450ec09b8bd010b02430c3becddc92a7fcbe31c06a5baf99e32105

Contents?: true

Size: 1.06 KB

Versions: 27

Compression:

Stored size: 1.06 KB

Contents

#include "Types.h"
#include "TimerConfigurator.h"
#include "TimerInterruptConfigurator.h"

void Timer_EnablePeripheralClocks(void)
{
  AT91C_BASE_PMC->PMC_PCER = TIMER0_CLOCK_ENABLE | PIOB_CLOCK_ENABLE;
}

void Timer_Reset(void)
{
  uint32 dummy;
  AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKDIS;
  AT91C_BASE_TC0->TC_IDR = 0xffffffff;
  dummy = AT91C_BASE_TC0->TC_SR;
  dummy = dummy;
}

void Timer_ConfigureMode(void)
{
  AT91C_BASE_TC0->TC_CMR = 0x000CC004; // ACPC=toggle TIOA on RC compare; mode=WAVE; WAVE_SEL=UP w/auto-trigger on RC compare; clock=MCK/1024
}

void Timer_ConfigurePeriod(void)
{
  AT91C_BASE_TC0->TC_RC = 469; // 10ms period for timer clock source of MCK/1024 with MCK=48054857
}

void Timer_EnableOutputPin(void)
{
  AT91C_BASE_PIOB->PIO_PDR = TIOA0_PIN_MASK;
}

void Timer_Enable(void)
{
  AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKEN;
}

void Timer_ConfigureInterruptHandler(void)
{
  Timer_DisableInterrupt();
  Timer_ResetSystemTime();
  Timer_ConfigureInterrupt();
  Timer_EnableInterrupt();
}

void Timer_Start(void)
{
  AT91C_BASE_TC0->TC_CCR = AT91C_TC_SWTRG;
}

Version data entries

27 entries across 14 versions & 1 rubygems

Version Path
ceedling-0.31.1 vendor/cmock/examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.31.1 examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.31.0 vendor/cmock/examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.31.0 examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.30.0 examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.30.0 vendor/cmock/examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.28.3 vendor/cmock/examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.28.3 examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.28.2 vendor/cmock/examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.28.2 examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.28.1 vendor/cmock/examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.28.1 examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.27.0 examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.27.0 vendor/cmock/examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.25.0 vendor/cmock/examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.25.0 examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.24.0 vendor/cmock/examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.24.0 examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.22.0 examples/temp_sensor/src/TimerConfigurator.c
ceedling-0.22.0 vendor/cmock/examples/temp_sensor/src/TimerConfigurator.c