/** * This file is part of license combination gpl version 3 license and eCos. * The corresponding license terms are below. * * gpl version 3 Licence: * * The file were developed during the student thesis "Datensammlung in Wireless * Sensor Networks fuer Autonomic Home NetworkingÒ of Thomas Kothmayr and is * included in the dissertation "Secure Data Transmission in Wireless * Sensor Networks" by Corinna Schmitt during employment at the Technische * UniversitŠt MŸnchen, Department Computer Science, Chair Network * Architectures and Services (Germany). * Copyright (C) 2013 * Authors: Thomas Kothmayr and Corinna Schmitt (schmitt[at]net.in.tum.de) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * * eCos Licence: (http://ecos.sourceware.org) * * This file is part of eCos, the Embedded Configurable Operating System. * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, * 2007, 2008, 2009 Free Software Foundation, Inc. * * eCos is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free * Software Foundation; either version 3 any later version. * * eCos is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with eCos; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * As a special exception, if other files instantiate templates or use * macros or inline functions from this file, or you compile this file and * link it with other works to produce a work based on this file, this file * does not by itself cause the resulting work to be covered by the GNU * General Public License. However the source code for this file must still * be made available in accordance with section (3) of the GNU General * Public License v2. * * This exception does not invalidate any other reasons why a work based on * this file might be covered by the GNU General Public License. * */ Interface: tos.chips.atm128.timer.HplAtm128Timer

Interface: tos.chips.atm128.timer.HplAtm128Timer

interface HplAtm128Timer<typedef timer_size>

Basic interface to the hardware timers on an ATmega128.

This interface is designed to be independent of whether the underlying hardware is an 8-bit or 16-bit wide counter. As such, timer_size is specified via a generics parameter. Because this is exposing a common subset of functionality that all ATmega128 hardware timers share, all that is exposed is access to the overflow capability. Compare and capture functionality are exposed on separate interfaces to allow easy configurability via wiring.

This interface provides four major groups of functionality:

  1. Timer Value: get/set current time
  2. Overflow Interrupt event
  3. Control of Overflow Interrupt: start/stop/clear...
  4. Timer Initialization: turn on/off clock source

Author:
Martin Turon <mturon@xbow.com>

Commands
command timer_size get() Get the current time.
command uint8_t getScale() Get prescaler setting.
command bool isOn() Is overflow interrupt on?
command void off() Turn off the clock.
command void reset() Clear the overflow interrupt flag.
command void set(timer_size t) Set the current time.
command void setScale(uint8_t scale) Turn on the clock.
command void start() Enable the overflow interrupt.
command void stop() Turn off overflow interrupts.
command bool test() Did an overflow interrupt occur?

Events
event void overflow() Signalled on timer overflow interrupt.

Commands - Details

get

command timer_size get()

Get the current time.

Returns:
the current time

getScale

command uint8_t getScale()

Get prescaler setting.

Returns:
Prescaler setting of clock -- see Atm128Timer.h

isOn

command bool isOn()

Is overflow interrupt on?

Returns:
TRUE if overflow enabled, FALSE otherwise

off

command void off()

Turn off the clock. *

reset

command void reset()

Clear the overflow interrupt flag. *

set

command void set(timer_size t)

Set the current time.

Parameters:
t - the time to set

setScale

command void setScale(uint8_t scale)

Turn on the clock.

Parameters:
scale - Prescaler setting of clock -- see Atm128Timer.h

start

command void start()

Enable the overflow interrupt. *

stop

command void stop()

Turn off overflow interrupts. *

test

command bool test()

Did an overflow interrupt occur?

Returns:
TRUE if overflow triggered, FALSE otherwise

Events - Details

overflow

event void overflow()

Signalled on timer overflow interrupt. *