Example #1
0
/*
 * These configuration parameters specify how to clock the
 * bits that are sent and received on the Aardvark SPI
 * interface.
 *
 *   The polarity option specifies which transition
 *   constitutes the leading edge and which transition is the
 *   falling edge.  For example, AA_SPI_POL_RISING_FALLING
 *   would configure the SPI to idle the SCK clock line low.
 *   The clock would then transition low-to-high on the
 *   leading edge and high-to-low on the trailing edge.
 *
 *   The phase option determines whether to sample or setup on
 *   the leading edge.  For example, AA_SPI_PHASE_SAMPLE_SETUP
 *   would configure the SPI to sample on the leading edge and
 *   setup on the trailing edge.
 *
 *   The bitorder option is used to indicate whether LSB or
 *   MSB is shifted first.
 *
 * See the diagrams in the Aardvark datasheet for
 * more details.
 */
// enum AardvarkSpiPolarity  (from declaration above)
//     AA_SPI_POL_RISING_FALLING = 0
//     AA_SPI_POL_FALLING_RISING = 1

// enum AardvarkSpiPhase  (from declaration above)
//     AA_SPI_PHASE_SAMPLE_SETUP = 0
//     AA_SPI_PHASE_SETUP_SAMPLE = 1

// enum AardvarkSpiBitorder  (from declaration above)
//     AA_SPI_BITORDER_MSB = 0
//     AA_SPI_BITORDER_LSB = 1

/* Configure the SPI master or slave interface */
        public static int aa_spi_configure(
            int aardvark,
            AardvarkSpiPolarity polarity,
            AardvarkSpiPhase phase,
            AardvarkSpiBitorder bitorder
            )
        {
            if (!AA_LIBRARY_LOADED)
            {
                return((int)AardvarkStatus.AA_INCOMPATIBLE_LIBRARY);
            }
            return(net_aa_spi_configure(aardvark, polarity, phase, bitorder));
        }
Example #2
0
 private static extern int net_aa_spi_configure(int aardvark, AardvarkSpiPolarity polarity, AardvarkSpiPhase phase, AardvarkSpiBitorder bitorder);
Example #3
0
 private static extern int net_aa_spi_configure(int aardvark, AardvarkSpiPolarity polarity, AardvarkSpiPhase phase, AardvarkSpiBitorder bitorder);
Example #4
0
 /*
  * These configuration parameters specify how to clock the
  * bits that are sent and received on the Aardvark SPI
  * interface.
  *
  *   The polarity option specifies which transition
  *   constitutes the leading edge and which transition is the
  *   falling edge.  For example, AA_SPI_POL_RISING_FALLING
  *   would configure the SPI to idle the SCK clock line low.
  *   The clock would then transition low-to-high on the
  *   leading edge and high-to-low on the trailing edge.
  *
  *   The phase option determines whether to sample or setup on
  *   the leading edge.  For example, AA_SPI_PHASE_SAMPLE_SETUP
  *   would configure the SPI to sample on the leading edge and
  *   setup on the trailing edge.
  *
  *   The bitorder option is used to indicate whether LSB or
  *   MSB is shifted first.
  *
  * See the diagrams in the Aardvark datasheet for
  * more details.
  */
 // enum AardvarkSpiPolarity  (from declaration above)
 //     AA_SPI_POL_RISING_FALLING = 0
 //     AA_SPI_POL_FALLING_RISING = 1
 // enum AardvarkSpiPhase  (from declaration above)
 //     AA_SPI_PHASE_SAMPLE_SETUP = 0
 //     AA_SPI_PHASE_SETUP_SAMPLE = 1
 // enum AardvarkSpiBitorder  (from declaration above)
 //     AA_SPI_BITORDER_MSB = 0
 //     AA_SPI_BITORDER_LSB = 1
 /* Configure the SPI master or slave interface */
 public static int aa_spi_configure(
     int                  aardvark,
     AardvarkSpiPolarity  polarity,
     AardvarkSpiPhase     phase,
     AardvarkSpiBitorder  bitorder
     )
 {
     if (!AA_LIBRARY_LOADED) return (int)AardvarkStatus.AA_INCOMPATIBLE_LIBRARY;
     return net_aa_spi_configure(aardvark, polarity, phase, bitorder);
 }
Example #5
0
 public static int aa_spi_configure(int aardvark, AardvarkSpiPolarity polarity, AardvarkSpiPhase phase, AardvarkSpiBitorder bitorder)
 {
     if (!AA_LIBRARY_LOADED)
     {
         return -4;
     }
     return net_aa_spi_configure(aardvark, polarity, phase, bitorder);
 }