(&mut self, key: u32)
| 222 | } |
| 223 | |
| 224 | pub fn trigger_key(&mut self, key: u32) -> Result<()> { |
| 225 | let mask = (1 << key) as u32; |
| 226 | if (!self.dir & mask) > 0 { |
| 227 | // emulate key event |
| 228 | // By default, Input Pin is configured to detect both rising and falling edges. |
| 229 | // So reverse the input pin data to generate a pulse. |
| 230 | self.data |= !(self.data & mask) & mask; |
| 231 | self.pl061_internal_update(); |
| 232 | |
| 233 | match self.trigger_gpio_interrupt() { |
| 234 | Ok(_) | Err(Error::GpioInterruptDisabled) => return Ok(()), |
| 235 | Err(e) => return Err(e), |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | Err(Error::GpioTriggerKeyFailure(key)) |
| 240 | } |
| 241 | |
| 242 | fn trigger_gpio_interrupt(&self) -> Result<()> { |
| 243 | // Bits set to high in GPIOIE(Interrupt mask register) allow the corresponding pins to |
no test coverage detected