-
Notifications
You must be signed in to change notification settings - Fork 0
QDEC Peripheral incorporated into tockOS #1
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
base: master
Are you sure you want to change the base?
Conversation
…e caught at startup
hudson-ayers
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Michaela, I made some notes throughout about (mostly small) changes I think are needed -- let me know if you have any questions. I think the most important test of this will be whether you are able to build a usable userspace QDEC application with this interface -- I am a little concerned that the interrupt focused interface could fall apart if the encoder fires quickly, and interrupts could be dropped before callbacks are delivered to userspace
|
How does it look now? I will run userspace tests later tonight/tomorrow morning. |
chips/nrf52/src/chip.rs
Outdated
| peripheral_interrupts::SPI0_TWI0 => { | ||
| // SPI0 and TWI0 share interrupts. | ||
| // Dispatch the correct handler. | ||
| match (spi::SPIM0.is_enabled(), i2c::TWIM0.is_enabled()) { | ||
| (false, false) => (), | ||
| (true, false) => spi::SPIM0.handle_interrupt(), | ||
| (false, true) => i2c::TWIM0.handle_interrupt(), | ||
| (true, true) => debug_assert!( | ||
| false, | ||
| "SPIM0 and TWIM0 cannot be \ | ||
| enabled at the same time." | ||
| ), | ||
| } | ||
| } | ||
| peripheral_interrupts::SPI1_TWI1 => { | ||
| // SPI1 and TWI1 share interrupts. | ||
| // Dispatch the correct handler. | ||
| match (spi::SPIM1.is_enabled(), i2c::TWIM1.is_enabled()) { | ||
| (false, false) => (), | ||
| (true, false) => spi::SPIM1.handle_interrupt(), | ||
| (false, true) => i2c::TWIM1.handle_interrupt(), | ||
| (true, true) => debug_assert!( | ||
| false, | ||
| "SPIM1 and TWIM1 cannot be \ | ||
| enabled at the same time." | ||
| ), | ||
| } | ||
| } | ||
| peripheral_interrupts::SPIM2_SPIS2_SPI2 => spi::SPIM2.handle_interrupt(), | ||
| peripheral_interrupts::ADC => adc::ADC.handle_interrupt(), | ||
| peripheral_interrupts::QDEC => qdec::QDEC.handle_interrupt(), | ||
| _ => debug!("NvicIdx not supported by Tock"), | ||
| // match interrupt { | ||
| // peripheral_interrupts::ECB => nrf5x::aes::AESECB.handle_interrupt(), | ||
| // peripheral_interrupts::GPIOTE => self.gpio_port.handle_interrupt(), | ||
| // peripheral_interrupts::POWER_CLOCK => power::POWER.handle_interrupt(), | ||
| // peripheral_interrupts::RADIO => { | ||
| // match ( | ||
| // ieee802154_radio::RADIO.is_enabled(), | ||
| // ble_radio::RADIO.is_enabled(), | ||
| // ) { | ||
| // (false, false) => (), | ||
| // (true, false) => ieee802154_radio::RADIO.handle_interrupt(), | ||
| // (false, true) => ble_radio::RADIO.handle_interrupt(), | ||
| // (true, true) => debug!( | ||
| // "nRF 802.15.4 and BLE radios cannot be simultaneously enabled!" | ||
| // ), | ||
| // } | ||
| // } | ||
| // peripheral_interrupts::RNG => nrf5x::trng::TRNG.handle_interrupt(), | ||
| // peripheral_interrupts::RTC1 => nrf5x::rtc::RTC.handle_interrupt(), | ||
| // peripheral_interrupts::TEMP => nrf5x::temperature::TEMP.handle_interrupt(), | ||
| // peripheral_interrupts::TIMER0 => nrf5x::timer::TIMER0.handle_interrupt(), | ||
| // peripheral_interrupts::TIMER1 => nrf5x::timer::ALARM1.handle_interrupt(), | ||
| // peripheral_interrupts::TIMER2 => nrf5x::timer::TIMER2.handle_interrupt(), | ||
| // peripheral_interrupts::UART0 => uart::UARTE0.handle_interrupt(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You commented out all interrupts!
capsules/src/qdec.rs
Outdated
| for cntr in self.apps.iter() { | ||
| cntr.enter(|app, _| { | ||
| if app.subscribed { | ||
| app.subscribed = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't set to false here -- apps want to continue receiving interrupts without resubscribing
hudson-ayers
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really close! If you want to make these few changes I am happy to go ahead and rebase this PR on master.
Co-authored-by: Hudson Ayers <32688905+hudson-ayers@users.noreply.github.com>
Pull Request Overview
This pull request adds the QDEC peripheral functionality to TockOS. This includes an addition of HIL and Capsule files. The associated documentation that helped guide the design and implementation of the qdec can be found here.
Testing Strategy
There is a corresponding userspace application which actively tests the full end-to-end functionality of the QDEC peripheral. In order to test the QDEC, a rotary encoder, nrf52840dk board, and three wires hooked up between the rotary encoder and the GPIO Pins 02, 29, and GND.
This pull request was tested and verified by Michaela Murray (author) and Hudson Ayers.
Documentation Updated
Formatting
make formatall.