firmware/teensy_sketchbook/libraries/DmaSpi/DmaSpi.h
/** \brief arduino-style initialization.
     *
     * During initialization, two DMA channels are allocated. If that fails, this function returns false.
     * If the channels could be allocated, those DMA channel fields that don't change during DMA SPI operation
     * are initialized to the values they will have at runtime.
     *
     * \return true if initialization was successful; false otherwise.
     * \see end()
    **/
\brief arduino-style initialization.
During initialization, two DMA channels are allocated. If that fails, this function returns false.
If the channels could be allocated, those DMA channel fields that don't change during DMA SPI operation
are initialized to the values they will have at runtime.

\return true if initialization was successful; false otherwise.
\see end()
\ brief arduino - style initialization . During initialization two DMA channels are allocated . If that fails this function returns false . If the channels could be allocated those DMA channel fields that don ' t change during DMA SPI operation are initialized to the values they will have at runtime . \ return true if initialization was successful ; false otherwise . \ see end ()
static bool begin()
    {
      if(init_count_ > 0)
      {
        return true; 
      }
      init_count_++;
      DMASPI_PRINT(("DmaSpi::begin() : "));
      if (!createDmaChannels())
      {
        DMASPI_PRINT(("could not create DMA channels\n"));
        return false;
      }
      state_ = eStopped;
      begin_setup_txChannel();
      if (txChannel_()->error())
      {
        destroyDmaChannels();
        DMASPI_PRINT(("tx channel error\n"));
        return false;
      }
      begin_setup_rxChannel();
      if (rxChannel_()->error())
      {
        destroyDmaChannels();
        DMASPI_PRINT(("rx channel error\n"));
        return false;
      }
      return true;
    }
static bool begin ( ) { if ( init_count_ > 0 ) { return true ; } init_count_ ++ ; DMASPI_PRINT ( ( " " ) ) ; if ( ! createDmaChannels ( ) ) { DMASPI_PRINT ( ( " \n " ) ) ; return false ; } state_ = eStopped ; begin_setup_txChannel ( ) ; if ( txChannel_ ( ) -> error ( ) ) { destroyDmaChannels ( ) ; DMASPI_PRINT ( ( " \n " ) ) ; return false ; } begin_setup_rxChannel ( ) ; if ( rxChannel_ ( ) -> error ( ) ) { destroyDmaChannels ( ) ; DMASPI_PRINT ( ( " \n " ) ) ; return false ; } return true ; }
\brief arduino-style initialization.
\ brief arduino - style initialization .
// this is not particularly bad, so we can return true // create DMA channels, might fail // tx: known destination (SPI), no interrupt, finish silently // rx: known source (SPI), interrupt on completion