weAut_01 / weAutSys    R 2.2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Defines | Functions | Variables
include/we-aut_sys/spi.h File Reference

Overview

weAutSys'/weAut_01' system calls and services for the SPI interfaces

This file contains the definitions for weAutSys / weAut_01 (low level) system calls and services for the serial peripheral interfaces (SPI). This is system software and must not be modified for user or application programs.

This file is part of weAutSys   <weinert-automation.de>

  Copyright © 2011 Albrecht Weinert, Bochum

Author:
Albrecht Weinert   <a-weinert.de>
Revision:
2
Date:
2017-01-25 17:49:03 +0100 (Mi, 25 Jan 2017)

Defines

#define memCardIsSelected()
 The memory card (inserted) is chip-selected.
#define nicIsSelected()
 The Ethernet driver is chip-selected.
#define SPI100kHz
 control value to set SPI 2 clock to 100 kHz
#define SPI10MHz   0
 Divisor register for UART as SPI (UBRR) setting for 10 MHz.
#define SPI1MHz
 control value to set SPI 2 clock to 1 MHz
#define SPI200kHz
 control value to set SPI 2 clock to 200 kHz
#define SPI2COND_ERR_RET(cond, err, ret)
 Check a SPI2 condition with timeout.
#define SPI2MHz
 UBRR value to set SPI clock to 2 MHz.
#define SPI400kHz
 control value to set SPI 2 clock to 400 kHz
#define SPI5MHz   1
 Divisor register for UART as SPI (UBRR)) setting for 5 MHz.
#define UCPHA1
 UCSR1C register (bit number)

Functions

uint8_t deSelectSPI1 (void) __attribute__((always_inline))
 De-select all SPI1 devices.
void deSelectSPI1_impl (void) __attribute__((always_inline))
 De-select all SPI1 devices (raw)
void deSelectSPI2 (void) __attribute__((always_inline))
 De-select all SPI2 devices.
void selectDIdisplayLEDs (void) __attribute__((always_inline))
 Chip-select a SPI 1 device: the digital input display LEDS (HMI)
void selectDOdrivDIleds (void) __attribute__((always_inline))
 Chip-select two SPI 1 devices: the DO driver and the DI LEDs (HMI)
void selectDOdriver (void) __attribute__((always_inline))
 Chip-select a SPI 1 device: the digital output driver (DO)
void selectEtherChip (void) __attribute__((always_inline))
 Chip-select a SPI 2 device: the Ethernet driver chip.
void selectMemCard (void) __attribute__((always_inline))
 Chip-select a SPI 2 device: the memory card (holder)
uint8_t spi2Receive (void) __attribute__((always_inline))
 Receive one byte from SPI 2.
void spi2ReceiveNS (uint8_t *receiveB, uint16_t n, uint8_t skip)
 Receive n bytes to a buffer via SPI 2 with optional skip (afterwards)
void spi2ReceiveSN (uint8_t *receiveB, uint16_t skip, uint16_t n)
 Receive n bytes to a buffer via SPI 2 with optional skip (before)
uint8_t spi2Tranceive (uint8_t sendB) __attribute__((always_inline))
 Send and receive one byte via SPI 2.
uint8_t spi2Tranceive2 (uint8_t sendB1, uint8_t sendB2)
 Send two bytes and receive one byte via SPI 2.
uint8_t spi2TranceiveN (uint8_t sendB, uint8_t n)
 Send a byte n times and receive one byte via SPI 2.
void spi2Transmit (uint8_t sendB) __attribute__((always_inline))
 Send one byte over SPI 2.

Variables

uint8_t spi2Errors
 Accumulated errors at SPI 2.
uint8_t spi2EtherChipBaud
 The SPI (2) clock frequency used for the Ethernet driver chip.
uint8_t spi2MemCardBaud
 The SPI (2) clock frequency used for the memory card (holder)