Bare Metal Programming Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Types | Static Public Member Functions | List of all members
bmptk::hardware::spi_channel< bus, ss_extern, mode > Class Template Reference

a spi channel to a specific peripheral chip More...

#include <spi.h>

Public Types

enum  { type = type_spi_channel }
 identify this type as a spi channel
 

Static Public Member Functions

static void init ()
 intilialize the spi channel and the underlying spi bus
 
static void transaction_in_out_n (unsigned char *input, unsigned char *output, int n_bytes)
 spi read-and-write transaction
 
static void transaction_in_n (unsigned char *input, int n_bytes)
 spi read-only transaction
 
static void transaction_out_n (unsigned char *output, int n_bytes)
 spi write-only transaction
 

Detailed Description

template<typename bus, typename ss_extern, int mode = spi_mode_0>
class bmptk::hardware::spi_channel< bus, ss_extern, mode >

a spi channel to a specific peripheral chip

This template represents a spi channel to one specific chip or chain of chips. It is created from a spi bus (which represents the sclk, miso and mosi lines, and the maximum bus frequency) and the ss (slave select) line, and the spi mode. The ss line is acive low.

Definition at line 143 of file spi.h.

Member Function Documentation

template<typename bus , typename ss_extern , int mode = spi_mode_0>
static void bmptk::hardware::spi_channel< bus, ss_extern, mode >::transaction_in_out_n ( unsigned char *  input,
unsigned char *  output,
int  n_bytes 
)
inlinestatic

spi read-and-write transaction

This method performs an n_byte spi write-and-read transaction. The output pointer must point to the array of bytes to be written, the input pointer must point to the array of bytes to be read. Both arrays must be n_bytes long. Alternatively, one of the pointers can be 0. (In fact both can be 0, but that would be pointless.)

Definition at line 223 of file spi.h.


The documentation for this class was generated from the following file: