*/
unsigned int maa_check_i2c();
+/** Check spi interface, sets up multiplexer on device.
+ *
+ * @return unsigned int if using /dev/spi-1.0 returned would be 1.0
+ */
+double maa_check_spi();
+
/** Check PWM
*
* Will check input is valid for pwm and will also setup required multiplexers.
return plat->i2c_bus[bus].bus_id;
}
+double
+maa_check_spi(int bus_s)
+{
+ if (plat == NULL)
+ return -3;
+
+ if (plat->i2c_bus_count >! 0) {
+ fprintf(stderr, "No spi buses defined in platform");
+ return -1;
+ }
+ int bus = 0;
+
+ int pos = plat->spi_bus[0].sclk;
+ if (plat->pins[pos].spi.mux_total > 0)
+ if (maa_setup_mux_mapped(plat->pins[pos].spi) != MAA_SUCCESS)
+ return -2;
+
+ pos = plat->spi_bus[0].mosi;
+ if (plat->pins[pos].spi.mux_total > 0)
+ if (maa_setup_mux_mapped(plat->pins[pos].spi) != MAA_SUCCESS)
+ return -2;
+
+ pos = plat->spi_bus[0].miso;
+ if (plat->pins[pos].spi.mux_total > 0)
+ if (maa_setup_mux_mapped(plat->pins[pos].spi) != MAA_SUCCESS)
+ return -2;
+
+ return plat->spi_bus[bus].bus_id;
+}
+
maa_pin_t*
maa_check_pwm(int pin)
{