Microchip® Advanced Software Framework

tc-clock.c File Reference
#include "contiki.h"
#include "asf.h"

Macros

#define TC3_WAIT_BUSY()   while(REG_TC3_STATUS & TC_STATUS_SYNCBUSY)
 
#define TIMER   TC3
 
#define TIMER_PERIOD   UINT16_MAX
 

Functions

void _TC3_Handler (void)
 [module_inst] More...
 
void clock_adjust_ticks (clock_time_t howmany)
 Adjust the system current clock time. More...
 
void clock_init (void)
 Initialize the clock library. More...
 
static void clock_irq_callback (struct tc_module *const module_inst)
 
unsigned long clock_seconds (void)
 Get the current value of the platform seconds. More...
 
clock_time_t clock_time (void)
 Get the current clock time. More...
 
void configure_tc3 (void)
 
static void configure_tc3_callbacks (void)
 

Variables

static volatile uint32_t seconds
 
long sleepseconds
 
struct tc_module tc3_instance
 [module_inst] More...
 
static struct tc_module tc_instance
 
static volatile uint32_t ticks
 Copyright (c) 2015 Microchip Technology Inc and 2012 – 2013, Thingsquare, http://www.thingsquare.com/. More...
 

#define TC3_WAIT_BUSY ( )    while(REG_TC3_STATUS & TC_STATUS_SYNCBUSY)

Referenced by configure_tc3().

#define TIMER   TC3

Referenced by clock_init().

#define TIMER_PERIOD   UINT16_MAX

Referenced by clock_init().

void clock_adjust_ticks ( clock_time_t  howmany)

Adjust the system current clock time.

Parameters
dtHow many ticks to add

Typically used to add ticks after an MCU sleep clock_seconds will increment if necessary to reflect the tick addition. Leap ticks or seconds can (rarely) be introduced if the ISR is not blocked.

References CLOCK_SECOND, seconds, sleepseconds, and ticks.

Referenced by rtimer_adjust_ticks().

static void clock_irq_callback ( struct tc_module *const  module_inst)
static
void configure_tc3 ( void  )

[setup_config]

[setup_config] [setup_config_defaults]

[setup_config_defaults]

[setup_change_config]

[setup_change_config]

[setup_change_config_pwm]

[setup_change_config_pwm]

[setup_set_config]

[setup_set_config]

[setup_enable]

[setup_enable]

References tc_16bit_config::compare_capture_channel, configure_tc3_callbacks(), tc_config::counter_16_bit, tc_config::counter_size, tc3_instance, TC3_WAIT_BUSY, TC_COUNTER_SIZE_16BIT, tc_enable(), tc_get_config_defaults(), tc_init(), TC_WAVE_GENERATION_NORMAL_PWM, and tc_config::wave_generation.

Referenced by main().

static void configure_tc3_callbacks ( void  )
static

[setup_register_callback]

[setup_register_callback]

[setup_enable_callback]

[setup_enable_callback]

References _TC3_Handler(), tc3_instance, TC_CALLBACK_CC_CHANNEL0, tc_enable_callback(), and tc_register_callback().

Referenced by configure_tc3().

volatile uint32_t seconds
static
long sleepseconds

Referenced by clock_adjust_ticks().

struct tc_module tc3_instance

[module_inst]

Referenced by configure_tc3(), and configure_tc3_callbacks().

struct tc_module tc_instance
static
volatile uint32_t ticks
static

Copyright (c) 2015 Microchip Technology Inc and 2012 – 2013, Thingsquare, http://www.thingsquare.com/.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Atmel nor the name of Thingsquare nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
  4. This software may only be redistributed and used in connection with an Atmel microcontroller or Atmel wireless product.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Referenced by _TC3_Handler(), clock_adjust_ticks(), clock_irq_callback(), clock_time(), new_dio_interval(), rtimer_adjust_ticks(), and while().