/* Attaches an SPI peripheral slave. 
This function will initialize the software SPI peripheral slave, based on the values of the config struct. The slave can then be selected and optionally addressed by the  */
void spi_attach_slave(struct spi_slave_inst *const slave, struct spi_slave_inst_config *const config)
/* Attaches an SPI peripheral slave. 
This function will initialize the software SPI peripheral slave, based on the values of the config struct. The slave can then be selected and optionally addressed by the  */
void spi_attach_slave(struct spi_slave_inst *const slave, struct spi_slave_inst_config *const config)
{
	Assert(slave);
	Assert(config);
	slave->ss_pin          = config->ss_pin;
	slave->address_enabled = config->address_enabled;
	slave->address         = config->address;
	struct gpio_config config_gpio;
	gpio_get_config_defaults(&config_gpio);
	config_gpio.direction = GPIO_PIN_DIR_OUTPUT;
	gpio_pin_set_config(slave->ss_pin, &config_gpio);
	gpio_pin_set_output_level(slave->ss_pin, true);
}