summaryrefslogtreecommitdiff
path: root/digital/beacon/src/Bitcloud_stack/Components/HAL/avr/atmega1281/common/include/halSpi.h
diff options
context:
space:
mode:
Diffstat (limited to 'digital/beacon/src/Bitcloud_stack/Components/HAL/avr/atmega1281/common/include/halSpi.h')
-rw-r--r--digital/beacon/src/Bitcloud_stack/Components/HAL/avr/atmega1281/common/include/halSpi.h180
1 files changed, 0 insertions, 180 deletions
diff --git a/digital/beacon/src/Bitcloud_stack/Components/HAL/avr/atmega1281/common/include/halSpi.h b/digital/beacon/src/Bitcloud_stack/Components/HAL/avr/atmega1281/common/include/halSpi.h
deleted file mode 100644
index 59ab72c8..00000000
--- a/digital/beacon/src/Bitcloud_stack/Components/HAL/avr/atmega1281/common/include/halSpi.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/*****************************************************************************//**
-\file halSpi.h
-
-\brief Declarations of USART SPI mode.
-
-\author
- Atmel Corporation: http://www.atmel.com \n
- Support email: avr@atmel.com
-
- Copyright (c) 2008-2011, Atmel Corporation. All rights reserved.
- Licensed under Atmel's Limited License Agreement (BitCloudTM).
-
-\internal
- History:
- 29/06/07 E. Ivanov - Created
-**********************************************************************************/
-/******************************************************************************
- * WARNING: CHANGING THIS FILE MAY AFFECT CORE FUNCTIONALITY OF THE STACK. *
- * EXPERT USERS SHOULD PROCEED WITH CAUTION. *
- ******************************************************************************/
-#ifndef _HALSPI_H
-#define _HALSPI_H
-
-/******************************************************************************
- Includes section
-******************************************************************************/
-#include <usart.h>
-
-/******************************************************************************
- Define(s) section
-******************************************************************************/
-#define SPI_CHANNEL_0 USART_CHANNEL_0 // USART0 AtMega1281/2561 start addresss
-#define SPI_CHANNEL_1 USART_CHANNEL_1 // USART1 AtMega1281/2561 start addresss
-
-/******************************************************************************
- Types section
-******************************************************************************/
-// spi channel
-typedef UsartChannel_t SpiChannel_t;
-
-// types of the clock mode
-typedef enum
-{
- // leading edge sample RX bit (rising), trailing edge setup TX bit (falling).
- SPI_CLOCK_MODE0,
- // leading edge setup TX bit (rising), trailing edge sample RX bit (falling).
- SPI_CLOCK_MODE1,
- // leading edge sample RX bit (falling), trailing edge setup TX bit (rising).
- SPI_CLOCK_MODE2,
- // leading edge setup TX bit (falling), trailing edge sample RX bit (rising).
- SPI_CLOCK_MODE3
-} SpiClockMode_t;
-
-// clock rate
-typedef enum
-{
- SPI_CLOCK_RATE_62 = ((F_CPU / (2 * 62500ul)) - 1),
- SPI_CLOCK_RATE_125 = ((F_CPU / (2 * 125000ul)) - 1),
- SPI_CLOCK_RATE_250 = ((F_CPU / (2 * 250000ul)) - 1),
- SPI_CLOCK_RATE_500 = ((F_CPU / (2 * 500000ul)) - 1),
- SPI_CLOCK_RATE_1000 = ((F_CPU / (2 * 1000000ul)) - 1),
- SPI_CLOCK_RATE_2000 = ((F_CPU / (2 * 2000000ul)) - 1)
-} SpiBaudRate_t;
-
-// Data order
-typedef enum
-{
- SPI_DATA_MSB_FIRST, // data with MSB first
- SPI_DATA_LSB_FIRST // data with LSB first
-} SpiDataOrder_t;
-
-/******************************************************************************
- Prototypes section
-******************************************************************************/
-/******************************************************************************
-Disables USART channel.
-Parameters:
- tty - spi channel.
-******************************************************************************/
-void halClearUsartSpi(SpiChannel_t tty);
-
-/******************************************************************************
-Write a length bytes to the SPI.
-Parameters:
- tty - spi channel
- buffer - pointer to application data buffer;
- length - number bytes for transfer;
-Returns:
- number of written bytes
-******************************************************************************/
-uint16_t halSyncUsartSpiWriteData(SpiChannel_t tty, uint8_t *buffer, uint16_t length);
-
-/******************************************************************************
-Write & read a length bytes to & from the SPI.
-Parameters:
- tty - spi channel
- buffer - pointer to application data buffer;
- length - number bytes for transfer;
-Returns:
- number of written & read bytes
-******************************************************************************/
-uint16_t halSyncUsartSpiReadData(SpiChannel_t tty, uint8_t *buffer, uint16_t length);
-
-/******************************************************************************
- Inline static functions section
-******************************************************************************/
-/******************************************************************************
-Enables data register empty interrupt.
-Parameters:
- tty - spi channel.
-Returns:
- none.
-******************************************************************************/
-INLINE void halEnableUsartSpiDremInterrupt(SpiChannel_t tty)
-{
- UCSRnB(tty) |= (1 << UDRIE0);
-}
-
-/******************************************************************************
-Disables data register empty interrupt.
-Parameters:
- tty - spi channel.
-Returns:
- none.
-******************************************************************************/
-INLINE void halDisableUsartSpiDremInterrupt(SpiChannel_t tty)
-{
- UCSRnB(tty) &= ~(1 << UDRIE0);
-}
-
-/******************************************************************************
-Enables transmit complete interrupt.
-Parameters:
- tty - spi channel.
-Returns:
- none.
-******************************************************************************/
-INLINE void halEnableUsartSpiTxcInterrupt(SpiChannel_t tty)
-{
- UCSRnB(tty) |= (1 << TXCIE0);
-}
-
-/******************************************************************************
-Disables transmit complete interrupt.
-Parameters:
- tty - spi channel.
-Returns:
- none.
-******************************************************************************/
-INLINE void halDisableUsartSpiTxcInterrupt(SpiChannel_t tty)
-{
- UCSRnB(tty) &= ~(1 << TXCIE0);
-}
-
-/*****************************************************************************
-Enables receive complete interrupt.
-Parameters:
- tty - spi channel.
-Returns:
- none.
-******************************************************************************/
-INLINE void halEnableUsartSpiRxcInterrupt(SpiChannel_t tty)
-{
- UCSRnB(tty) |= (1 << RXCIE0);
-}
-
-/*****************************************************************************
-Disables receive complete interrupt.
-Parameters:
- tty - spi channel.
-Returns:
- none.
-******************************************************************************/
-INLINE void halDisableUsartSpiRxcInterrupt(SpiChannel_t tty)
-{
- UCSRnB(tty) &= ~(1 << RXCIE0);
-}
-#endif
-//eof halSpi.h
-