/** * 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.spi.Atm128Spi

Interface: tos.chips.atm128.spi.Atm128Spi

interface Atm128Spi

HPL-level access to the Atmega128 SPI bus. Refer to pages 162-9 of the Atmega128 datasheet (rev. 2467M-AVR-11/04) for details.

  $Id: Atm128Spi.nc,v 1.4 2006/12/12 18:23:04 vlahan Exp $
 

Author:
Philip Levis
Martin Turon <mturon@xbow.com>
Date:
September 8 2005

Commands
command void enableInterrupt(bool enabled)
command void enableSpi(bool busOn)
command uint8_t getClock()
command bool getClockPhase()
command bool getClockPolarity()
command bool hasWriteCollided()
command void initMaster() Initialize the ATmega128 SPI bus into master mode.
command void initSlave() Initialize the ATmega128 SPI bus into slave mode.
command bool isInterruptEnabled()
command bool isInterruptPending()
command bool isMasterBitSet()
command bool isMasterDoubleSpeed()
command bool isOrderLsbFirst()
command bool isSpiEnabled()
command uint8_t read() Read the SPI data register
command void setClock(uint8_t speed)
command void setClockPhase(bool sampleOnTrailing)
command void setClockPolarity(bool highWhenIdle)
command void setDataOrder(bool lsbFirst)
command void setMasterBit(bool isMaster)
command void setMasterDoubleSpeed(bool on)
command void sleep() Disable and sleep the ATmega128 SPI bus.
command void write(uint8_t data) Write the SPI data register

Events
event void dataReady(uint8_t data) Interrupt signalling SPI data cycle is complete.

Commands - Details

enableInterrupt

command void enableInterrupt(bool enabled)

enableSpi

command void enableSpi(bool busOn)

getClock

command uint8_t getClock()

getClockPhase

command bool getClockPhase()

getClockPolarity

command bool getClockPolarity()

hasWriteCollided

command bool hasWriteCollided()

initMaster

command void initMaster()

Initialize the ATmega128 SPI bus into master mode. *

initSlave

command void initSlave()

Initialize the ATmega128 SPI bus into slave mode. *

isInterruptEnabled

command bool isInterruptEnabled()

isInterruptPending

command bool isInterruptPending()

isMasterBitSet

command bool isMasterBitSet()

isMasterDoubleSpeed

command bool isMasterDoubleSpeed()

isOrderLsbFirst

command bool isOrderLsbFirst()

isSpiEnabled

command bool isSpiEnabled()

read

command uint8_t read()

Read the SPI data register

Returns:
last data byte

setClock

command void setClock(uint8_t speed)

setClockPhase

command void setClockPhase(bool sampleOnTrailing)

setClockPolarity

command void setClockPolarity(bool highWhenIdle)

setDataOrder

command void setDataOrder(bool lsbFirst)

setMasterBit

command void setMasterBit(bool isMaster)

setMasterDoubleSpeed

command void setMasterDoubleSpeed(bool on)

sleep

command void sleep()

Disable and sleep the ATmega128 SPI bus. *

write

command void write(uint8_t data)

Write the SPI data register

Parameters:
data - next data byte

Events - Details

dataReady

event void dataReady(uint8_t data)

Interrupt signalling SPI data cycle is complete.

Parameters:
data - data byte from data register