non breaking API?
This commit is contained in:
		| @@ -214,8 +214,32 @@ pub async fn new<'a, PWR, SPI>( | |||||||
|     pwr: PWR, |     pwr: PWR, | ||||||
|     spi: SPI, |     spi: SPI, | ||||||
|     firmware: &[u8], |     firmware: &[u8], | ||||||
|     bluetooth_firmware_offsets: Option<&[(u32, usize)]>, | ) -> (NetDriver<'a>, Control<'a>, Runner<'a, PWR, SPI>) | ||||||
|     bluetooth_firmware: Option<&[u8]>, | where | ||||||
|  |     PWR: OutputPin, | ||||||
|  |     SPI: SpiBusCyw43, | ||||||
|  | { | ||||||
|  |     let (ch_runner, device) = ch::new(&mut state.ch, ch::driver::HardwareAddress::Ethernet([0; 6])); | ||||||
|  |     let state_ch = ch_runner.state_runner(); | ||||||
|  |  | ||||||
|  |     let mut runner = Runner::new(ch_runner, Bus::new(pwr, spi), &state.ioctl_state, &state.events); | ||||||
|  |  | ||||||
|  |     runner.init(firmware, None, None).await; | ||||||
|  |  | ||||||
|  |     ( | ||||||
|  |         device, | ||||||
|  |         Control::new(state_ch, &state.events, &state.ioctl_state), | ||||||
|  |         runner, | ||||||
|  |     ) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | pub async fn new_with_bluetooth<'a, PWR, SPI>( | ||||||
|  |     state: &'a mut State, | ||||||
|  |     pwr: PWR, | ||||||
|  |     spi: SPI, | ||||||
|  |     firmware: &[u8], | ||||||
|  |     bluetooth_firmware_offsets: &[(u32, usize)], | ||||||
|  |     bluetooth_firmware: &[u8], | ||||||
| ) -> (NetDriver<'a>, Control<'a>, Runner<'a, PWR, SPI>) | ) -> (NetDriver<'a>, Control<'a>, Runner<'a, PWR, SPI>) | ||||||
| where | where | ||||||
|     PWR: OutputPin, |     PWR: OutputPin, | ||||||
| @@ -227,7 +251,7 @@ where | |||||||
|     let mut runner = Runner::new(ch_runner, Bus::new(pwr, spi), &state.ioctl_state, &state.events); |     let mut runner = Runner::new(ch_runner, Bus::new(pwr, spi), &state.ioctl_state, &state.events); | ||||||
|  |  | ||||||
|     runner |     runner | ||||||
|         .init(firmware, bluetooth_firmware_offsets, bluetooth_firmware) |         .init(firmware, Some(bluetooth_firmware_offsets), Some(bluetooth_firmware)) | ||||||
|         .await; |         .await; | ||||||
|  |  | ||||||
|     ( |     ( | ||||||
|   | |||||||
| @@ -49,15 +49,8 @@ async fn main(spawner: Spawner) { | |||||||
|     let state = make_static!(cyw43::State::new()); |     let state = make_static!(cyw43::State::new()); | ||||||
|     let bluetooth_firmware_offsets = &cyw43_firmware::BLUETOOTH_FIRMWARE_OFFSETS; |     let bluetooth_firmware_offsets = &cyw43_firmware::BLUETOOTH_FIRMWARE_OFFSETS; | ||||||
|     let bluetooth_firmware = &cyw43_firmware::BLUETOOTH_FIRMWARE; |     let bluetooth_firmware = &cyw43_firmware::BLUETOOTH_FIRMWARE; | ||||||
|     let (_net_device, mut control, runner) = cyw43::new( |     let (_net_device, mut control, runner) = | ||||||
|         state, |         cyw43::new_with_bluetooth(state, pwr, spi, fw, bluetooth_firmware_offsets, bluetooth_firmware).await; | ||||||
|         pwr, |  | ||||||
|         spi, |  | ||||||
|         fw, |  | ||||||
|         Some(bluetooth_firmware_offsets), |  | ||||||
|         Some(bluetooth_firmware), |  | ||||||
|     ) |  | ||||||
|     .await; |  | ||||||
|     unwrap!(spawner.spawn(cyw43_runner_task(runner))); |     unwrap!(spawner.spawn(cyw43_runner_task(runner))); | ||||||
|  |  | ||||||
|     control.init(clm).await; |     control.init(clm).await; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user