COSA
An Object-Oriented Platform for Arduino Programming
|
#include <SPI.hh>
Public Member Functions | |
Driver (Board::DigitalPin cs, Pulse pulse=DEFAULT_PULSE, Clock rate=DEFAULT_CLOCK, uint8_t mode=0, Order order=MSB_ORDER, Interrupt::Handler *irq=NULL) | |
void | set_clock (Clock rate) |
void | set_clock (uint32_t freq) |
Static Public Member Functions | |
static Clock | clock (uint32_t freq) |
static Clock | cycle (uint16_t ns) |
Protected Attributes | |
Driver * | m_next |
List of drivers. More... | |
Interrupt::Handler * | m_irq |
Interrupt handler. More... | |
OutputPin | m_cs |
Device chip select pin. More... | |
Pulse | m_pulse |
Chip select pulse width. More... | |
uint8_t | m_spcr |
SPI/SPCR hardware control register setting. More... | |
uint8_t | m_spsr |
SPI/SPSR hardware status register. More... | |
Friends | |
class | SPI |
SPI device driver abstract class. Holds SPI/USI hardware settings to allow handling of several SPI devices with different clock, mode and/or bit order. Handles device chip select and disables/enables interrupts during SPI transaction.
SPI::Driver::Driver | ( | Board::DigitalPin | cs, |
Pulse | pulse = DEFAULT_PULSE , |
||
Clock | rate = DEFAULT_CLOCK , |
||
uint8_t | mode = 0 , |
||
Order | order = MSB_ORDER , |
||
Interrupt::Handler * | irq = NULL |
||
) |
Construct SPI Device driver with given chip select pin, pulse, clock, mode, and bit order.
[in] | cs | chip select pin. |
[in] | pulse | chip select pulse mode (default ACTIVE_LOW). |
[in] | rate | SPI hardware setting (default DIV4_CLOCK). |
[in] | mode | SPI mode for phase and transition (0..3, default 0). |
[in] | order | bit order (default MSB_ORDER). |
[in] | irq | interrupt handler (default null). |
Definition at line 25 of file SOFT_SPI.cpp.
|
inlinestatic |
|
inlinestatic |
void SPI::Driver::set_clock | ( | Clock | rate | ) |
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |