raspberry_pi.c: Remove max spi freq by adding replace func
Closes
@@ -210,6 +210,14 @@ mraa_raspberry_pi_mmap_setup(mraa_gpio_context dev, mraa_boolean_t en)
return MRAA_SUCCESS;
}
+mraa_result_t
+mraa_raspberry_pi_spi_frequency_replace(mraa_spi_context dev, int hz)
+{
+ // RPI driver doesn't like being queried for it's max speed
+ dev->clock = hz;
+ return MRAA_SUCCESS;
+}
+
mraa_board_t*
mraa_raspberry_pi()
{
@@ -384,6 +392,7 @@ mraa_raspberry_pi()
b->adv_func->spi_init_pre = &mraa_raspberry_pi_spi_init_pre;
b->adv_func->i2c_init_pre = &mraa_raspberry_pi_i2c_init_pre;
b->adv_func->gpio_mmap_setup = &mraa_raspberry_pi_mmap_setup;
+ b->adv_func->spi_frequency_replace = &mraa_raspberry_pi_spi_frequency_replace;
strncpy(b->pins[0].name, "INVALID", MRAA_PIN_NAME_SIZE);
b->pins[0].capabilities = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
