Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rtic example will panic when taking peripherals #44

Closed
kuon opened this issue Jan 11, 2021 · 0 comments
Closed

Rtic example will panic when taking peripherals #44

kuon opened this issue Jan 11, 2021 · 0 comments

Comments

@kuon
Copy link

kuon commented Jan 11, 2021

The current examples use pub fn take_peripherals() -> (nrf_softdevice::Peripherals, Peripherals) in example_common.rs but this crashes with an error when using rtic.

error: `Unwrap of a None option value`
└─ firmware::common::take_peripherals @ src/example_common.rs:40

The fix implies to put them in Resources

    struct Resources {
        timer: Timer<TIMER1, Periodic>,
        sdp: Option<nrf_softdevice::Peripherals>,
    }
   // init
      let sdp = nrf_softdevice::Peripherals {
            AAR: cx.device.AAR,
            ACL: cx.device.ACL,
            CCM: cx.device.CCM,
            CLOCK: cx.device.CLOCK,
            ECB: cx.device.ECB,
            EGU1: cx.device.EGU1,
            EGU2: cx.device.EGU2,
            EGU5: cx.device.EGU5,
            MWU: cx.device.MWU,
            NVMC: cx.device.NVMC,
            POWER: cx.device.POWER,
            RADIO: cx.device.RADIO,
            RNG: cx.device.RNG,
            RTC0: cx.device.RTC0,
            SWI1: cx.device.SWI1,
            SWI2: cx.device.SWI2,
            SWI5: cx.device.SWI5,
            TEMP: cx.device.TEMP,
            TIMER0: cx.device.TIMER0,
        };
        let sdp = Some(sdp);

        init::LateResources {
            sdp,
            timer,
        }
// when creating soft device
        let sd = Softdevice::enable(cx.resources.sdp.take().unwrap(), &config);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant