Created
June 14, 2023 18:35
-
-
Save AfoHT/ab60e9e78c52596f8db3c836c7d9ea31 to your computer and use it in GitHub Desktop.
Formatted rtic-expansion.rs - issue 762
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[doc = r" The RTIC application module"] | |
pub mod app { | |
#[doc = r" Always include the device crate which contains the vector table"] | |
use kiibohd_atsam4s::hal::pac as you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml; | |
#[doc = r" Holds the maximum priority level for use by async HAL drivers."] | |
#[no_mangle] | |
static RTIC_ASYNC_MAX_LOGICAL_PRIO: u8 = 0u8; | |
use super::*; | |
type LayerLookup = kiibohd_atsam4s::kll_core::layout::LayerLookup<'static, LAYOUT_SIZE>; | |
type Matrix = kiibohd_atsam4s::hall_effect::HallMatrix<CSIZE, MSIZE>; | |
#[doc = r" User code end"] | |
impl<'a> __rtic_internal_initLocalResources<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_initLocalResources { | |
adc_buf: &mut *__rtic_internal_local_init_adc_buf.get_mut(), | |
ctrl_queue: &mut *__rtic_internal_local_init_ctrl_queue.get_mut(), | |
kbd_queue: &mut *__rtic_internal_local_init_kbd_queue.get_mut(), | |
kbd_led_queue: &mut *__rtic_internal_local_init_kbd_led_queue.get_mut(), | |
mouse_queue: &mut *__rtic_internal_local_init_mouse_queue.get_mut(), | |
usb_state_queue: &mut *__rtic_internal_local_init_usb_state_queue.get_mut(), | |
serial_number: &mut *__rtic_internal_local_init_serial_number.get_mut(), | |
spi_tx_buf: &mut *__rtic_internal_local_init_spi_tx_buf.get_mut(), | |
spi_rx_buf: &mut *__rtic_internal_local_init_spi_rx_buf.get_mut(), | |
usb_bus: &mut *__rtic_internal_local_init_usb_bus.get_mut(), | |
__rtic_internal_marker: ::core::marker::PhantomData, | |
} | |
} | |
} | |
struct Shared { | |
adc: Option<kiibohd_atsam4s::hall_effect::AdcTransfer<ADC_BUF_SIZE>>, | |
hidio_intf: kiibohd_atsam4s::HidioCommandInterface, | |
issi: kiibohd_atsam4s::issi_spi::Is31fl3743bAtsam4Dma< | |
ISSI_DRIVER_CHIPS, | |
ISSI_DRIVER_QUEUE_SIZE, | |
>, | |
layer_state: LayerState, | |
led_lock_mask: [kiibohd_atsam4s::issi_spi::LedMask; LED_MASK_SIZE], | |
led_test: kiibohd_atsam4s::LedTest, | |
manu_test_data: heapless::Vec<u8, { kiibohd_hid_io::MESSAGE_LEN - 4 }>, | |
matrix: Matrix, | |
spi: Option<kiibohd_atsam4s::issi_spi::SpiParkedDma>, | |
spi_rxtx: Option<kiibohd_atsam4s::issi_spi::SpiTransferRxTx>, | |
tcc0: TimerCounterChannel<TC0, Tc0Clock<Enabled>, 0, TCC0_FREQ>, | |
usb_dev: kiibohd_atsam4s::UsbDevice, | |
usb_hid: kiibohd_atsam4s::HidInterface, | |
} | |
struct Local { | |
ctrl_producer: Producer<'static, kiibohd_usb::CtrlState, CTRL_QUEUE_SIZE>, | |
kbd_led_consumer: Consumer<'static, kiibohd_usb::LedState, KBD_LED_QUEUE_SIZE>, | |
kbd_producer: Producer<'static, kiibohd_usb::KeyState, KBD_QUEUE_SIZE>, | |
led_indicators: kiibohd_atsam4s::IndicatorLeds<LED_MASK_SIZE>, | |
mouse_producer: Producer<'static, kiibohd_usb::MouseState, MOUSE_QUEUE_SIZE>, | |
rtt: kiibohd_atsam4s::RealTimeTimer, | |
sense_pins: kiibohd_atsam4s::hall_effect::SensePins, | |
tcc1: TimerCounterChannel<TC0, Tc1Clock<Enabled>, 1, TCC1_FREQ>, | |
usb_state: UsbDeviceState, | |
usb_state_consumer: Consumer<'static, kiibohd_atsam4s::UsbState, USB_STATE_QUEUE_SIZE>, | |
usb_state_producer: Producer<'static, kiibohd_atsam4s::UsbState, USB_STATE_QUEUE_SIZE>, | |
wdt: Watchdog, | |
} | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
#[doc = "Local resources `init` has access to"] | |
pub struct __rtic_internal_initLocalResources<'a> { | |
#[allow(missing_docs)] | |
pub adc_buf: &'static mut [u16; ADC_BUF_SIZE], | |
#[allow(missing_docs)] | |
pub ctrl_queue: &'static mut Queue<kiibohd_usb::CtrlState, CTRL_QUEUE_SIZE>, | |
#[allow(missing_docs)] | |
pub kbd_queue: &'static mut Queue<kiibohd_usb::KeyState, KBD_QUEUE_SIZE>, | |
#[allow(missing_docs)] | |
pub kbd_led_queue: &'static mut Queue<kiibohd_usb::LedState, KBD_LED_QUEUE_SIZE>, | |
#[allow(missing_docs)] | |
pub mouse_queue: &'static mut Queue<kiibohd_usb::MouseState, MOUSE_QUEUE_SIZE>, | |
#[allow(missing_docs)] | |
pub usb_state_queue: &'static mut Queue<UsbState, USB_STATE_QUEUE_SIZE>, | |
#[allow(missing_docs)] | |
pub serial_number: &'static mut String<126>, | |
#[allow(missing_docs)] | |
pub spi_tx_buf: &'static mut [u32; SPI_TX_BUF_SIZE], | |
#[allow(missing_docs)] | |
pub spi_rx_buf: &'static mut [u32; SPI_RX_BUF_SIZE], | |
#[allow(missing_docs)] | |
pub usb_bus: &'static mut Option<UsbBusAllocator<UdpBus>>, | |
#[doc(hidden)] | |
pub __rtic_internal_marker: ::core::marker::PhantomData<&'a ()>, | |
} | |
#[doc = r" Execution context"] | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
pub struct __rtic_internal_init_Context<'a> { | |
#[doc(hidden)] | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
#[doc = r" Core peripherals"] | |
pub core: rtic::export::Peripherals, | |
#[doc = r" Device peripherals (PAC)"] | |
pub device: kiibohd_atsam4s::hal::pac::Peripherals, | |
#[doc = r" Critical section token for init"] | |
pub cs: rtic::export::CriticalSection<'a>, | |
#[doc = r" Local Resources this task has access to"] | |
pub local: init::LocalResources<'a>, | |
} | |
impl<'a> __rtic_internal_init_Context<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new(core: rtic::export::Peripherals) -> Self { | |
__rtic_internal_init_Context { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
device: kiibohd_atsam4s::hal::pac::Peripherals::steal(), | |
cs: rtic::export::CriticalSection::new(), | |
core, | |
local: init::LocalResources::new(), | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
#[doc = "Initialization function"] | |
pub mod init { | |
#[doc(inline)] | |
pub use super::__rtic_internal_initLocalResources as LocalResources; | |
#[doc(inline)] | |
pub use super::__rtic_internal_init_Context as Context; | |
} | |
#[inline(always)] | |
#[allow(non_snake_case)] | |
fn init(cx: init::Context) -> (Shared, Local) { | |
let (wdt, mut clocks, chip, tc0_chs, rtt, gpio_ports) = kiibohd_atsam4s::initial_init( | |
cx.device.CHIPID, | |
cx.device.EFC0, | |
cx.device.PIOA, | |
cx.device.PIOB, | |
cx.device.PMC, | |
cx.device.RTT, | |
&cx.device.SUPC, | |
cx.device.TC0, | |
cx.device.WDT, | |
MainClock::Crystal12Mhz, | |
SlowClock::RcOscillator32Khz, | |
cx.local.serial_number, | |
VERGEN_GIT_COMMIT_COUNT.parse().unwrap(), | |
); | |
let mut pins = Pins::new(gpio_ports, &cx.device.MATRIX); | |
let mut sense_pins = kiibohd_atsam4s::hall_effect::SensePins { | |
sense1: pins.sense1, | |
sense2: pins.sense2, | |
sense3: pins.sense3, | |
sense4: pins.sense4, | |
sense5: pins.sense5, | |
sense6: pins.sense6, | |
}; | |
let mut tcc0 = tc0_chs.ch0; | |
let (adc, matrix) = kiibohd_atsam4s::hall_effect::init::<CSIZE, RSIZE, MSIZE>( | |
cx.device.ADC, | |
clocks.peripheral_clocks.adc.into_enabled_clock(), | |
[ | |
pins.strobe1.downgrade(), | |
pins.strobe2.downgrade(), | |
pins.strobe3.downgrade(), | |
pins.strobe4.downgrade(), | |
pins.strobe5.downgrade(), | |
pins.strobe6.downgrade(), | |
pins.strobe7.downgrade(), | |
pins.strobe8.downgrade(), | |
pins.strobe9.downgrade(), | |
pins.strobe10.downgrade(), | |
pins.strobe11.downgrade(), | |
pins.strobe12.downgrade(), | |
pins.strobe13.downgrade(), | |
pins.strobe14.downgrade(), | |
pins.strobe15.downgrade(), | |
pins.strobe16.downgrade(), | |
pins.strobe17.downgrade(), | |
pins.strobe18.downgrade(), | |
pins.strobe19.downgrade(), | |
pins.strobe20.downgrade(), | |
pins.strobe21.downgrade(), | |
pins.strobe22.downgrade(), | |
], | |
&mut sense_pins, | |
&mut tcc0, | |
); | |
let loop_condition_lookup: &[u32] = &[0]; | |
let layer_lookup = LayerLookup::new( | |
kll::LAYER_LOOKUP, | |
kll::TRIGGER_GUIDES, | |
kll::RESULT_GUIDES, | |
kll::TRIGGER_RESULT_MAPPING, | |
loop_condition_lookup, | |
); | |
let layer_state = LayerState::new(layer_lookup, 0); | |
let issi_default_brightness = 255; | |
let issi_default_enable = true; | |
let mut tcc1 = tc0_chs.ch1; | |
let (spi_rxtx, mut issi) = kiibohd_atsam4s::issi_spi::init( | |
&mut pins.debug_led, | |
issi_default_brightness, | |
issi_default_enable, | |
cx.device.SPI, | |
clocks.peripheral_clocks.spi.into_enabled_clock(), | |
pins.spi_miso, | |
pins.spi_mosi, | |
cx.local.spi_rx_buf, | |
pins.spi_sck, | |
cx.local.spi_tx_buf, | |
&mut tcc1, | |
); | |
for chip in issi.pwm_page_buf() { | |
chip.iter_mut().for_each(|e| *e = 255); | |
} | |
for chip in issi.scaling_page_buf() { | |
chip.iter_mut().for_each(|e| *e = 100); | |
} | |
issi.scaling().unwrap(); | |
issi.pwm().unwrap(); | |
let led_lock_mask = [ | |
kiibohd_atsam4s::issi_spi::LedMask::new(0, 33, [0, 0, 0]), | |
kiibohd_atsam4s::issi_spi::LedMask::new(0, 51, [0, 0, 0]), | |
]; | |
let led_indicators = kiibohd_atsam4s::IndicatorLeds::new(); | |
let (usb_state_producer, usb_state_consumer) = cx.local.usb_state_queue.split(); | |
let usb_state = UsbDeviceState::Default; | |
let ( | |
usb_dev, | |
usb_hid, | |
hidio_intf, | |
ctrl_producer, | |
kbd_led_consumer, | |
kbd_producer, | |
mouse_producer, | |
) = kiibohd_atsam4s::usb_init( | |
&chip, | |
cx.local.ctrl_queue, | |
cx.local.kbd_led_queue, | |
cx.local.kbd_queue, | |
VERGEN_GIT_COMMIT_COUNT.parse().unwrap(), | |
VERGEN_GIT_SEMVER, | |
cx.local.mouse_queue, | |
cx.local.serial_number, | |
cx.device.UDP, | |
clocks.peripheral_clocks.udp, | |
pins.udp_ddm, | |
pins.udp_ddp, | |
cx.local.usb_bus, | |
); | |
let mono_token = rtic_monotonics::create_systick_token!(); | |
Systick::start(cx.core.SYST, MCU_FREQ, mono_token); | |
defmt::trace!("Systick (Monotonic) started"); | |
let manu_test_data = heapless::Vec::from_slice(&[0, 0]).unwrap(); | |
( | |
Shared { | |
adc: Some(adc.read(cx.local.adc_buf)), | |
hidio_intf, | |
issi, | |
layer_state, | |
led_test: kiibohd_atsam4s::LedTest::Disabled, | |
led_lock_mask, | |
manu_test_data, | |
matrix, | |
spi: None, | |
spi_rxtx: Some(spi_rxtx), | |
tcc0, | |
usb_dev, | |
usb_hid, | |
}, | |
Local { | |
ctrl_producer, | |
kbd_led_consumer, | |
kbd_producer, | |
led_indicators, | |
mouse_producer, | |
rtt, | |
sense_pins, | |
tcc1, | |
usb_state, | |
usb_state_consumer, | |
usb_state_producer, | |
wdt, | |
}, | |
) | |
} | |
#[allow(non_snake_case)] | |
#[no_mangle] | |
unsafe fn TC0() { | |
const PRIORITY: u8 = 13u8; | |
rtic::export::run(PRIORITY, || tc0(tc0::Context::new())); | |
} | |
impl<'a> __rtic_internal_tc0SharedResources<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_tc0SharedResources { | |
adc: shared_resources::adc_that_needs_to_be_locked::new(), | |
tcc0: shared_resources::tcc0_that_needs_to_be_locked::new(), | |
__rtic_internal_marker: core::marker::PhantomData, | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
#[no_mangle] | |
unsafe fn TC1() { | |
const PRIORITY: u8 = 13u8; | |
rtic::export::run(PRIORITY, || tc1(tc1::Context::new())); | |
} | |
impl<'a> __rtic_internal_tc1LocalResources<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_tc1LocalResources { | |
tcc1: &mut *(&mut *__rtic_internal_local_resource_tcc1.get_mut()).as_mut_ptr(), | |
__rtic_internal_marker: ::core::marker::PhantomData, | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
#[no_mangle] | |
unsafe fn RTT() { | |
const PRIORITY: u8 = 1u8; | |
rtic::export::run(PRIORITY, || rtt(rtt::Context::new())); | |
} | |
impl<'a> __rtic_internal_rttLocalResources<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_rttLocalResources { | |
led_indicators: &mut *(&mut *__rtic_internal_local_resource_led_indicators | |
.get_mut()) | |
.as_mut_ptr(), | |
rtt: &mut *(&mut *__rtic_internal_local_resource_rtt.get_mut()).as_mut_ptr(), | |
wdt: &mut *(&mut *__rtic_internal_local_resource_wdt.get_mut()).as_mut_ptr(), | |
__rtic_internal_marker: ::core::marker::PhantomData, | |
} | |
} | |
} | |
impl<'a> __rtic_internal_rttSharedResources<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_rttSharedResources { | |
issi: shared_resources::issi_that_needs_to_be_locked::new(), | |
led_lock_mask: shared_resources::led_lock_mask_that_needs_to_be_locked::new(), | |
__rtic_internal_marker: core::marker::PhantomData, | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
#[no_mangle] | |
unsafe fn ADC() { | |
const PRIORITY: u8 = 14u8; | |
rtic::export::run(PRIORITY, || adc(adc::Context::new())); | |
} | |
impl<'a> __rtic_internal_adcLocalResources<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_adcLocalResources { | |
sense_pins: &mut *(&mut *__rtic_internal_local_resource_sense_pins.get_mut()) | |
.as_mut_ptr(), | |
__rtic_internal_marker: ::core::marker::PhantomData, | |
} | |
} | |
} | |
impl<'a> __rtic_internal_adcSharedResources<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_adcSharedResources { | |
adc: shared_resources::adc_that_needs_to_be_locked::new(), | |
hidio_intf: shared_resources::hidio_intf_that_needs_to_be_locked::new(), | |
layer_state: shared_resources::layer_state_that_needs_to_be_locked::new(), | |
manu_test_data: shared_resources::manu_test_data_that_needs_to_be_locked::new(), | |
matrix: shared_resources::matrix_that_needs_to_be_locked::new(), | |
tcc0: shared_resources::tcc0_that_needs_to_be_locked::new(), | |
__rtic_internal_marker: core::marker::PhantomData, | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
#[no_mangle] | |
unsafe fn SPI() { | |
const PRIORITY: u8 = 12u8; | |
rtic::export::run(PRIORITY, || spi(spi::Context::new())); | |
} | |
impl<'a> __rtic_internal_spiSharedResources<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_spiSharedResources { | |
issi: shared_resources::issi_that_needs_to_be_locked::new(), | |
spi: shared_resources::spi_that_needs_to_be_locked::new(), | |
spi_rxtx: shared_resources::spi_rxtx_that_needs_to_be_locked::new(), | |
__rtic_internal_marker: core::marker::PhantomData, | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
#[no_mangle] | |
unsafe fn UDP() { | |
const PRIORITY: u8 = 14u8; | |
rtic::export::run(PRIORITY, || udp(udp::Context::new())); | |
} | |
impl<'a> __rtic_internal_udpSharedResources<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_udpSharedResources { | |
hidio_intf: shared_resources::hidio_intf_that_needs_to_be_locked::new(), | |
usb_dev: shared_resources::usb_dev_that_needs_to_be_locked::new(), | |
usb_hid: shared_resources::usb_hid_that_needs_to_be_locked::new(), | |
__rtic_internal_marker: core::marker::PhantomData, | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
#[doc = "Shared resources `tc0` has access to"] | |
pub struct __rtic_internal_tc0SharedResources<'a> { | |
#[allow(missing_docs)] | |
pub adc: shared_resources::adc_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub tcc0: shared_resources::tcc0_that_needs_to_be_locked<'a>, | |
#[doc(hidden)] | |
pub __rtic_internal_marker: core::marker::PhantomData<&'a ()>, | |
} | |
#[doc = r" Execution context"] | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
pub struct __rtic_internal_tc0_Context<'a> { | |
#[doc(hidden)] | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
#[doc = r" Shared Resources this task has access to"] | |
pub shared: tc0::SharedResources<'a>, | |
} | |
impl<'a> __rtic_internal_tc0_Context<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_tc0_Context { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
shared: tc0::SharedResources::new(), | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
#[doc = "Hardware task"] | |
pub mod tc0 { | |
#[doc(inline)] | |
pub use super::__rtic_internal_tc0SharedResources as SharedResources; | |
#[doc(inline)] | |
pub use super::__rtic_internal_tc0_Context as Context; | |
} | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
#[doc = "Local resources `tc1` has access to"] | |
pub struct __rtic_internal_tc1LocalResources<'a> { | |
#[allow(missing_docs)] | |
pub tcc1: &'a mut TimerCounterChannel<TC0, Tc1Clock<Enabled>, 1, TCC1_FREQ>, | |
#[doc(hidden)] | |
pub __rtic_internal_marker: ::core::marker::PhantomData<&'a ()>, | |
} | |
#[doc = r" Execution context"] | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
pub struct __rtic_internal_tc1_Context<'a> { | |
#[doc(hidden)] | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
#[doc = r" Local Resources this task has access to"] | |
pub local: tc1::LocalResources<'a>, | |
} | |
impl<'a> __rtic_internal_tc1_Context<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_tc1_Context { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
local: tc1::LocalResources::new(), | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
#[doc = "Hardware task"] | |
pub mod tc1 { | |
#[doc(inline)] | |
pub use super::__rtic_internal_tc1LocalResources as LocalResources; | |
#[doc(inline)] | |
pub use super::__rtic_internal_tc1_Context as Context; | |
} | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
#[doc = "Local resources `rtt` has access to"] | |
pub struct __rtic_internal_rttLocalResources<'a> { | |
#[allow(missing_docs)] | |
pub led_indicators: &'a mut kiibohd_atsam4s::IndicatorLeds<LED_MASK_SIZE>, | |
#[allow(missing_docs)] | |
pub rtt: &'a mut kiibohd_atsam4s::RealTimeTimer, | |
#[allow(missing_docs)] | |
pub wdt: &'a mut Watchdog, | |
#[doc(hidden)] | |
pub __rtic_internal_marker: ::core::marker::PhantomData<&'a ()>, | |
} | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
#[doc = "Shared resources `rtt` has access to"] | |
pub struct __rtic_internal_rttSharedResources<'a> { | |
#[allow(missing_docs)] | |
pub issi: shared_resources::issi_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub led_lock_mask: shared_resources::led_lock_mask_that_needs_to_be_locked<'a>, | |
#[doc(hidden)] | |
pub __rtic_internal_marker: core::marker::PhantomData<&'a ()>, | |
} | |
#[doc = r" Execution context"] | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
pub struct __rtic_internal_rtt_Context<'a> { | |
#[doc(hidden)] | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
#[doc = r" Local Resources this task has access to"] | |
pub local: rtt::LocalResources<'a>, | |
#[doc = r" Shared Resources this task has access to"] | |
pub shared: rtt::SharedResources<'a>, | |
} | |
impl<'a> __rtic_internal_rtt_Context<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_rtt_Context { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
local: rtt::LocalResources::new(), | |
shared: rtt::SharedResources::new(), | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
#[doc = "Hardware task"] | |
pub mod rtt { | |
#[doc(inline)] | |
pub use super::__rtic_internal_rttLocalResources as LocalResources; | |
#[doc(inline)] | |
pub use super::__rtic_internal_rttSharedResources as SharedResources; | |
#[doc(inline)] | |
pub use super::__rtic_internal_rtt_Context as Context; | |
} | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
#[doc = "Local resources `adc` has access to"] | |
pub struct __rtic_internal_adcLocalResources<'a> { | |
#[allow(missing_docs)] | |
pub sense_pins: &'a mut kiibohd_atsam4s::hall_effect::SensePins, | |
#[doc(hidden)] | |
pub __rtic_internal_marker: ::core::marker::PhantomData<&'a ()>, | |
} | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
#[doc = "Shared resources `adc` has access to"] | |
pub struct __rtic_internal_adcSharedResources<'a> { | |
#[allow(missing_docs)] | |
pub adc: shared_resources::adc_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub hidio_intf: shared_resources::hidio_intf_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub layer_state: shared_resources::layer_state_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub manu_test_data: shared_resources::manu_test_data_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub matrix: shared_resources::matrix_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub tcc0: shared_resources::tcc0_that_needs_to_be_locked<'a>, | |
#[doc(hidden)] | |
pub __rtic_internal_marker: core::marker::PhantomData<&'a ()>, | |
} | |
#[doc = r" Execution context"] | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
pub struct __rtic_internal_adc_Context<'a> { | |
#[doc(hidden)] | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
#[doc = r" Local Resources this task has access to"] | |
pub local: adc::LocalResources<'a>, | |
#[doc = r" Shared Resources this task has access to"] | |
pub shared: adc::SharedResources<'a>, | |
} | |
impl<'a> __rtic_internal_adc_Context<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_adc_Context { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
local: adc::LocalResources::new(), | |
shared: adc::SharedResources::new(), | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
#[doc = "Hardware task"] | |
pub mod adc { | |
#[doc(inline)] | |
pub use super::__rtic_internal_adcLocalResources as LocalResources; | |
#[doc(inline)] | |
pub use super::__rtic_internal_adcSharedResources as SharedResources; | |
#[doc(inline)] | |
pub use super::__rtic_internal_adc_Context as Context; | |
} | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
#[doc = "Shared resources `spi` has access to"] | |
pub struct __rtic_internal_spiSharedResources<'a> { | |
#[allow(missing_docs)] | |
pub issi: shared_resources::issi_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub spi: shared_resources::spi_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub spi_rxtx: shared_resources::spi_rxtx_that_needs_to_be_locked<'a>, | |
#[doc(hidden)] | |
pub __rtic_internal_marker: core::marker::PhantomData<&'a ()>, | |
} | |
#[doc = r" Execution context"] | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
pub struct __rtic_internal_spi_Context<'a> { | |
#[doc(hidden)] | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
#[doc = r" Shared Resources this task has access to"] | |
pub shared: spi::SharedResources<'a>, | |
} | |
impl<'a> __rtic_internal_spi_Context<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_spi_Context { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
shared: spi::SharedResources::new(), | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
#[doc = "Hardware task"] | |
pub mod spi { | |
#[doc(inline)] | |
pub use super::__rtic_internal_spiSharedResources as SharedResources; | |
#[doc(inline)] | |
pub use super::__rtic_internal_spi_Context as Context; | |
} | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
#[doc = "Shared resources `udp` has access to"] | |
pub struct __rtic_internal_udpSharedResources<'a> { | |
#[allow(missing_docs)] | |
pub hidio_intf: shared_resources::hidio_intf_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub usb_dev: shared_resources::usb_dev_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub usb_hid: shared_resources::usb_hid_that_needs_to_be_locked<'a>, | |
#[doc(hidden)] | |
pub __rtic_internal_marker: core::marker::PhantomData<&'a ()>, | |
} | |
#[doc = r" Execution context"] | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
pub struct __rtic_internal_udp_Context<'a> { | |
#[doc(hidden)] | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
#[doc = r" Shared Resources this task has access to"] | |
pub shared: udp::SharedResources<'a>, | |
} | |
impl<'a> __rtic_internal_udp_Context<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_udp_Context { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
shared: udp::SharedResources::new(), | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
#[doc = "Hardware task"] | |
pub mod udp { | |
#[doc(inline)] | |
pub use super::__rtic_internal_udpSharedResources as SharedResources; | |
#[doc(inline)] | |
pub use super::__rtic_internal_udp_Context as Context; | |
} | |
#[allow(non_snake_case)] | |
fn tc0(cx: tc0::Context) { | |
use rtic::mutex::prelude::*; | |
use rtic::Mutex as _; | |
(cx.shared.adc, cx.shared.tcc0).lock(|adc, tcc0| { | |
if tcc0.clear_interrupt_flags() { | |
if let Some(adc) = adc { | |
adc.resume(); | |
} | |
} | |
}); | |
} | |
#[allow(non_snake_case)] | |
fn tc1(cx: tc1::Context) { | |
use rtic::mutex::prelude::*; | |
use rtic::Mutex as _; | |
if cx.local.tcc1.clear_interrupt_flags() { | |
if led_frame_process::spawn().is_err() { | |
defmt::warn!("Unable to schedule frame...FPS unstable"); | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
fn rtt(cx: rtt::Context) { | |
use rtic::mutex::prelude::*; | |
use rtic::Mutex as _; | |
cx.local.rtt.clear_interrupt_flags(); | |
cx.local.wdt.feed(); | |
let status = cx.local.led_indicators.get(0); | |
cx.local.led_indicators.set(0, !status); | |
(cx.shared.issi, cx.shared.led_lock_mask).lock(|issi, led_lock_mask| { | |
if status { | |
led_lock_mask[0].mask = [0, 0, 0]; | |
} else { | |
led_lock_mask[0].mask = [0, 50, 0]; | |
} | |
led_lock_mask[0].frames_since_update = 0; | |
issi.pwm().unwrap(); | |
}); | |
} | |
#[allow(non_snake_case)] | |
fn adc(cx: adc::Context) { | |
use rtic::mutex::prelude::*; | |
use rtic::Mutex as _; | |
let adc = cx.shared.adc; | |
let hidio_intf = cx.shared.hidio_intf; | |
let layer_state = cx.shared.layer_state; | |
let manu_test_data = cx.shared.manu_test_data; | |
let matrix = cx.shared.matrix; | |
let sense_pins = cx.local.sense_pins; | |
let tcc0 = cx.shared.tcc0; | |
(adc, hidio_intf, layer_state, manu_test_data, matrix, tcc0).lock( | |
|adc_pdc, hidio_intf, layer_state, manu_test_data, matrix, tcc0| { | |
let strobe = | |
kiibohd_atsam4s::hall_effect::adc_irq::<CSIZE, RSIZE, MSIZE, ADC_BUF_SIZE>( | |
adc_pdc, | |
sense_pins, | |
tcc0, | |
hidio_intf, | |
layer_state, | |
manu_test_data, | |
matrix, | |
SWITCH_REMAP, | |
); | |
if strobe == 0 && macro_process::spawn().is_err() { | |
defmt::warn!("Could not schedule macro_process"); | |
} | |
}, | |
); | |
} | |
#[allow(non_snake_case)] | |
fn spi(cx: spi::Context) { | |
use rtic::mutex::prelude::*; | |
use rtic::Mutex as _; | |
let issi = cx.shared.issi; | |
let spi_periph = cx.shared.spi; | |
let spi_rxtx = cx.shared.spi_rxtx; | |
(issi, spi_periph, spi_rxtx).lock(|issi, spi_periph, spi_rxtx| { | |
kiibohd_atsam4s::issi_spi::spi_irq(issi, spi_periph, spi_rxtx); | |
}); | |
} | |
#[allow(non_snake_case)] | |
fn udp(cx: udp::Context) { | |
use rtic::mutex::prelude::*; | |
use rtic::Mutex as _; | |
let usb_dev = cx.shared.usb_dev; | |
let usb_hid = cx.shared.usb_hid; | |
let hidio_intf = cx.shared.hidio_intf; | |
(usb_dev, usb_hid, hidio_intf).lock(|usb_dev, usb_hid, hidio_intf| { | |
kiibohd_atsam4s::udp_irq(usb_dev, usb_hid, hidio_intf); | |
}); | |
} | |
impl<'a> __rtic_internal_led_frame_processLocalResources<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_led_frame_processLocalResources { | |
usb_state_consumer: &mut *(&mut *__rtic_internal_local_resource_usb_state_consumer | |
.get_mut()) | |
.as_mut_ptr(), | |
__rtic_internal_marker: ::core::marker::PhantomData, | |
} | |
} | |
} | |
impl<'a> __rtic_internal_led_frame_processSharedResources<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_led_frame_processSharedResources { | |
hidio_intf: shared_resources::hidio_intf_that_needs_to_be_locked::new(), | |
issi: shared_resources::issi_that_needs_to_be_locked::new(), | |
led_lock_mask: shared_resources::led_lock_mask_that_needs_to_be_locked::new(), | |
led_test: shared_resources::led_test_that_needs_to_be_locked::new(), | |
spi: shared_resources::spi_that_needs_to_be_locked::new(), | |
spi_rxtx: shared_resources::spi_rxtx_that_needs_to_be_locked::new(), | |
__rtic_internal_marker: core::marker::PhantomData, | |
} | |
} | |
} | |
impl<'a> __rtic_internal_led_testSharedResources<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_led_testSharedResources { | |
hidio_intf: shared_resources::hidio_intf_that_needs_to_be_locked::new(), | |
issi: shared_resources::issi_that_needs_to_be_locked::new(), | |
led_test: shared_resources::led_test_that_needs_to_be_locked::new(), | |
__rtic_internal_marker: core::marker::PhantomData, | |
} | |
} | |
} | |
impl<'a> __rtic_internal_macro_processLocalResources<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_macro_processLocalResources { | |
ctrl_producer: &mut *(&mut *__rtic_internal_local_resource_ctrl_producer.get_mut()) | |
.as_mut_ptr(), | |
kbd_led_consumer: &mut *(&mut *__rtic_internal_local_resource_kbd_led_consumer | |
.get_mut()) | |
.as_mut_ptr(), | |
kbd_producer: &mut *(&mut *__rtic_internal_local_resource_kbd_producer.get_mut()) | |
.as_mut_ptr(), | |
mouse_producer: &mut *(&mut *__rtic_internal_local_resource_mouse_producer | |
.get_mut()) | |
.as_mut_ptr(), | |
__rtic_internal_marker: ::core::marker::PhantomData, | |
} | |
} | |
} | |
impl<'a> __rtic_internal_macro_processSharedResources<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_macro_processSharedResources { | |
hidio_intf: shared_resources::hidio_intf_that_needs_to_be_locked::new(), | |
layer_state: shared_resources::layer_state_that_needs_to_be_locked::new(), | |
matrix: shared_resources::matrix_that_needs_to_be_locked::new(), | |
__rtic_internal_marker: core::marker::PhantomData, | |
} | |
} | |
} | |
impl<'a> __rtic_internal_usb_processLocalResources<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_usb_processLocalResources { | |
usb_state: &mut *(&mut *__rtic_internal_local_resource_usb_state.get_mut()) | |
.as_mut_ptr(), | |
usb_state_producer: &mut *(&mut *__rtic_internal_local_resource_usb_state_producer | |
.get_mut()) | |
.as_mut_ptr(), | |
__rtic_internal_marker: ::core::marker::PhantomData, | |
} | |
} | |
} | |
impl<'a> __rtic_internal_usb_processSharedResources<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_usb_processSharedResources { | |
usb_dev: shared_resources::usb_dev_that_needs_to_be_locked::new(), | |
usb_hid: shared_resources::usb_hid_that_needs_to_be_locked::new(), | |
__rtic_internal_marker: core::marker::PhantomData, | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
#[doc = "Local resources `led_frame_process` has access to"] | |
pub struct __rtic_internal_led_frame_processLocalResources<'a> { | |
#[allow(missing_docs)] | |
pub usb_state_consumer: | |
&'a mut Consumer<'static, kiibohd_atsam4s::UsbState, USB_STATE_QUEUE_SIZE>, | |
#[doc(hidden)] | |
pub __rtic_internal_marker: ::core::marker::PhantomData<&'a ()>, | |
} | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
#[doc = "Shared resources `led_frame_process` has access to"] | |
pub struct __rtic_internal_led_frame_processSharedResources<'a> { | |
#[allow(missing_docs)] | |
pub hidio_intf: shared_resources::hidio_intf_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub issi: shared_resources::issi_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub led_lock_mask: shared_resources::led_lock_mask_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub led_test: shared_resources::led_test_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub spi: shared_resources::spi_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub spi_rxtx: shared_resources::spi_rxtx_that_needs_to_be_locked<'a>, | |
#[doc(hidden)] | |
pub __rtic_internal_marker: core::marker::PhantomData<&'a ()>, | |
} | |
#[doc = r" Execution context"] | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
pub struct __rtic_internal_led_frame_process_Context<'a> { | |
#[doc(hidden)] | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
#[doc = r" Local Resources this task has access to"] | |
pub local: led_frame_process::LocalResources<'a>, | |
#[doc = r" Shared Resources this task has access to"] | |
pub shared: led_frame_process::SharedResources<'a>, | |
} | |
impl<'a> __rtic_internal_led_frame_process_Context<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_led_frame_process_Context { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
local: led_frame_process::LocalResources::new(), | |
shared: led_frame_process::SharedResources::new(), | |
} | |
} | |
} | |
#[doc = r" Spawns the task directly"] | |
#[allow(non_snake_case)] | |
#[doc(hidden)] | |
pub fn __rtic_internal_led_frame_process_spawn() -> Result<(), ()> { | |
unsafe { | |
if __rtic_internal_led_frame_process_EXEC.try_allocate() { | |
let f = led_frame_process(unsafe { led_frame_process::Context::new() }); | |
__rtic_internal_led_frame_process_EXEC.spawn(f); | |
rtic::export::pend(kiibohd_atsam4s::hal::pac::interrupt::ACC); | |
Ok(()) | |
} else { | |
Err(()) | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
#[doc = "Software task"] | |
pub mod led_frame_process { | |
#[doc(inline)] | |
pub use super::__rtic_internal_led_frame_processLocalResources as LocalResources; | |
#[doc(inline)] | |
pub use super::__rtic_internal_led_frame_processSharedResources as SharedResources; | |
#[doc(inline)] | |
pub use super::__rtic_internal_led_frame_process_Context as Context; | |
#[doc(inline)] | |
pub use super::__rtic_internal_led_frame_process_spawn as spawn; | |
} | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
#[doc = "Shared resources `led_test` has access to"] | |
pub struct __rtic_internal_led_testSharedResources<'a> { | |
#[allow(missing_docs)] | |
pub hidio_intf: shared_resources::hidio_intf_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub issi: shared_resources::issi_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub led_test: shared_resources::led_test_that_needs_to_be_locked<'a>, | |
#[doc(hidden)] | |
pub __rtic_internal_marker: core::marker::PhantomData<&'a ()>, | |
} | |
#[doc = r" Execution context"] | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
pub struct __rtic_internal_led_test_Context<'a> { | |
#[doc(hidden)] | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
#[doc = r" Shared Resources this task has access to"] | |
pub shared: led_test::SharedResources<'a>, | |
} | |
impl<'a> __rtic_internal_led_test_Context<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_led_test_Context { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
shared: led_test::SharedResources::new(), | |
} | |
} | |
} | |
#[doc = r" Spawns the task directly"] | |
#[allow(non_snake_case)] | |
#[doc(hidden)] | |
pub fn __rtic_internal_led_test_spawn() -> Result<(), ()> { | |
unsafe { | |
if __rtic_internal_led_test_EXEC.try_allocate() { | |
let f = led_test(unsafe { led_test::Context::new() }); | |
__rtic_internal_led_test_EXEC.spawn(f); | |
rtic::export::pend(kiibohd_atsam4s::hal::pac::interrupt::PWM); | |
Ok(()) | |
} else { | |
Err(()) | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
#[doc = "Software task"] | |
pub mod led_test { | |
#[doc(inline)] | |
pub use super::__rtic_internal_led_testSharedResources as SharedResources; | |
#[doc(inline)] | |
pub use super::__rtic_internal_led_test_Context as Context; | |
#[doc(inline)] | |
pub use super::__rtic_internal_led_test_spawn as spawn; | |
} | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
#[doc = "Local resources `macro_process` has access to"] | |
pub struct __rtic_internal_macro_processLocalResources<'a> { | |
#[allow(missing_docs)] | |
pub ctrl_producer: &'a mut Producer<'static, kiibohd_usb::CtrlState, CTRL_QUEUE_SIZE>, | |
#[allow(missing_docs)] | |
pub kbd_led_consumer: &'a mut Consumer<'static, kiibohd_usb::LedState, KBD_LED_QUEUE_SIZE>, | |
#[allow(missing_docs)] | |
pub kbd_producer: &'a mut Producer<'static, kiibohd_usb::KeyState, KBD_QUEUE_SIZE>, | |
#[allow(missing_docs)] | |
pub mouse_producer: &'a mut Producer<'static, kiibohd_usb::MouseState, MOUSE_QUEUE_SIZE>, | |
#[doc(hidden)] | |
pub __rtic_internal_marker: ::core::marker::PhantomData<&'a ()>, | |
} | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
#[doc = "Shared resources `macro_process` has access to"] | |
pub struct __rtic_internal_macro_processSharedResources<'a> { | |
#[allow(missing_docs)] | |
pub hidio_intf: shared_resources::hidio_intf_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub layer_state: shared_resources::layer_state_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub matrix: shared_resources::matrix_that_needs_to_be_locked<'a>, | |
#[doc(hidden)] | |
pub __rtic_internal_marker: core::marker::PhantomData<&'a ()>, | |
} | |
#[doc = r" Execution context"] | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
pub struct __rtic_internal_macro_process_Context<'a> { | |
#[doc(hidden)] | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
#[doc = r" Local Resources this task has access to"] | |
pub local: macro_process::LocalResources<'a>, | |
#[doc = r" Shared Resources this task has access to"] | |
pub shared: macro_process::SharedResources<'a>, | |
} | |
impl<'a> __rtic_internal_macro_process_Context<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_macro_process_Context { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
local: macro_process::LocalResources::new(), | |
shared: macro_process::SharedResources::new(), | |
} | |
} | |
} | |
#[doc = r" Spawns the task directly"] | |
#[allow(non_snake_case)] | |
#[doc(hidden)] | |
pub fn __rtic_internal_macro_process_spawn() -> Result<(), ()> { | |
unsafe { | |
if __rtic_internal_macro_process_EXEC.try_allocate() { | |
let f = macro_process(unsafe { macro_process::Context::new() }); | |
__rtic_internal_macro_process_EXEC.spawn(f); | |
rtic::export::pend(kiibohd_atsam4s::hal::pac::interrupt::TWI0); | |
Ok(()) | |
} else { | |
Err(()) | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
#[doc = "Software task"] | |
pub mod macro_process { | |
#[doc(inline)] | |
pub use super::__rtic_internal_macro_processLocalResources as LocalResources; | |
#[doc(inline)] | |
pub use super::__rtic_internal_macro_processSharedResources as SharedResources; | |
#[doc(inline)] | |
pub use super::__rtic_internal_macro_process_Context as Context; | |
#[doc(inline)] | |
pub use super::__rtic_internal_macro_process_spawn as spawn; | |
} | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
#[doc = "Local resources `usb_process` has access to"] | |
pub struct __rtic_internal_usb_processLocalResources<'a> { | |
#[allow(missing_docs)] | |
pub usb_state: &'a mut UsbDeviceState, | |
#[allow(missing_docs)] | |
pub usb_state_producer: | |
&'a mut Producer<'static, kiibohd_atsam4s::UsbState, USB_STATE_QUEUE_SIZE>, | |
#[doc(hidden)] | |
pub __rtic_internal_marker: ::core::marker::PhantomData<&'a ()>, | |
} | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
#[doc = "Shared resources `usb_process` has access to"] | |
pub struct __rtic_internal_usb_processSharedResources<'a> { | |
#[allow(missing_docs)] | |
pub usb_dev: shared_resources::usb_dev_that_needs_to_be_locked<'a>, | |
#[allow(missing_docs)] | |
pub usb_hid: shared_resources::usb_hid_that_needs_to_be_locked<'a>, | |
#[doc(hidden)] | |
pub __rtic_internal_marker: core::marker::PhantomData<&'a ()>, | |
} | |
#[doc = r" Execution context"] | |
#[allow(non_snake_case)] | |
#[allow(non_camel_case_types)] | |
pub struct __rtic_internal_usb_process_Context<'a> { | |
#[doc(hidden)] | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
#[doc = r" Local Resources this task has access to"] | |
pub local: usb_process::LocalResources<'a>, | |
#[doc = r" Shared Resources this task has access to"] | |
pub shared: usb_process::SharedResources<'a>, | |
} | |
impl<'a> __rtic_internal_usb_process_Context<'a> { | |
#[inline(always)] | |
#[allow(missing_docs)] | |
pub unsafe fn new() -> Self { | |
__rtic_internal_usb_process_Context { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
local: usb_process::LocalResources::new(), | |
shared: usb_process::SharedResources::new(), | |
} | |
} | |
} | |
#[doc = r" Spawns the task directly"] | |
#[allow(non_snake_case)] | |
#[doc(hidden)] | |
pub fn __rtic_internal_usb_process_spawn() -> Result<(), ()> { | |
unsafe { | |
if __rtic_internal_usb_process_EXEC.try_allocate() { | |
let f = usb_process(unsafe { usb_process::Context::new() }); | |
__rtic_internal_usb_process_EXEC.spawn(f); | |
rtic::export::pend(kiibohd_atsam4s::hal::pac::interrupt::TWI1); | |
Ok(()) | |
} else { | |
Err(()) | |
} | |
} | |
} | |
#[allow(non_snake_case)] | |
#[doc = "Software task"] | |
pub mod usb_process { | |
#[doc(inline)] | |
pub use super::__rtic_internal_usb_processLocalResources as LocalResources; | |
#[doc(inline)] | |
pub use super::__rtic_internal_usb_processSharedResources as SharedResources; | |
#[doc(inline)] | |
pub use super::__rtic_internal_usb_process_Context as Context; | |
#[doc(inline)] | |
pub use super::__rtic_internal_usb_process_spawn as spawn; | |
} | |
#[allow(non_snake_case)] | |
async fn led_frame_process<'a>(cx: led_frame_process::Context<'a>) { | |
use rtic::mutex::prelude::*; | |
use rtic::Mutex as _; | |
( | |
cx.shared.hidio_intf, | |
cx.shared.issi, | |
cx.shared.led_lock_mask, | |
cx.shared.led_test, | |
) | |
.lock(|hidio_intf, issi, led_lock_mask, led_test| { | |
let (regular_processing, spawn_led_test) = | |
kiibohd_atsam4s::issi_spi::led_frame_process_manufacturing_tests_task( | |
hidio_intf, issi, led_test, | |
); | |
if spawn_led_test { | |
led_test::spawn().unwrap(); | |
} | |
(cx.shared.spi, cx.shared.spi_rxtx).lock(|spi_periph, spi_rxtx| { | |
kiibohd_atsam4s::issi_spi::led_frame_process_is31fl3743b_dma_task( | |
hidio_intf, | |
issi, | |
spi_periph, | |
spi_rxtx, | |
led_lock_mask, | |
regular_processing, | |
cx.local.usb_state_consumer, | |
); | |
}); | |
}); | |
} | |
#[allow(non_snake_case)] | |
async fn led_test<'a>(cx: led_test::Context<'a>) { | |
use rtic::mutex::prelude::*; | |
use rtic::Mutex as _; | |
Systick::delay(2_u32.millis()).await; | |
(cx.shared.hidio_intf, cx.shared.issi, cx.shared.led_test).lock( | |
|hidio_intf, issi, led_test| { | |
if kiibohd_atsam4s::issi_spi::led_test_task(hidio_intf, issi, led_test) { | |
led_test::spawn().unwrap(); | |
led_frame_process::spawn().ok(); | |
} | |
}, | |
); | |
} | |
#[allow(non_snake_case)] | |
async fn macro_process<'a>(mut cx: macro_process::Context<'a>) { | |
use rtic::mutex::prelude::*; | |
use rtic::Mutex as _; | |
(cx.shared.layer_state, cx.shared.matrix).lock(|layer_state, matrix| { | |
cx.shared.hidio_intf.lock(|hidio_intf| { | |
kiibohd_atsam4s::macro_process_led_events_task( | |
cx.local.kbd_led_consumer, | |
hidio_intf, | |
layer_state, | |
); | |
}); | |
kiibohd_atsam4s::macro_process_task::<CSIZE, MSIZE, Matrix>( | |
cx.local.ctrl_producer, | |
cx.local.kbd_producer, | |
cx.local.mouse_producer, | |
layer_state, | |
matrix, | |
); | |
}); | |
if usb_process::spawn().is_err() { | |
defmt::warn!("Could not schedule usb_process"); | |
} | |
} | |
#[allow(non_snake_case)] | |
async fn usb_process<'a>(cx: usb_process::Context<'a>) { | |
use rtic::mutex::prelude::*; | |
use rtic::Mutex as _; | |
let usb_dev = cx.shared.usb_dev; | |
let usb_hid = cx.shared.usb_hid; | |
(usb_hid, usb_dev).lock(|usb_hid, usb_dev| { | |
kiibohd_atsam4s::usb_process_task( | |
usb_dev, | |
usb_hid, | |
cx.local.usb_state, | |
cx.local.usb_state_producer, | |
); | |
}); | |
} | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic0"] | |
static __rtic_internal_shared_resource_adc: rtic::RacyCell< | |
core::mem::MaybeUninit<Option<kiibohd_atsam4s::hall_effect::AdcTransfer<ADC_BUF_SIZE>>>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
impl<'a> rtic::Mutex for shared_resources::adc_that_needs_to_be_locked<'a> { | |
type T = Option<kiibohd_atsam4s::hall_effect::AdcTransfer<ADC_BUF_SIZE>>; | |
#[inline(always)] | |
fn lock<RTIC_INTERNAL_R>( | |
&mut self, | |
f: impl FnOnce( | |
&mut Option<kiibohd_atsam4s::hall_effect::AdcTransfer<ADC_BUF_SIZE>>, | |
) -> RTIC_INTERNAL_R, | |
) -> RTIC_INTERNAL_R { | |
#[doc = r" Priority ceiling"] | |
const CEILING: u8 = 14u8; | |
unsafe { | |
rtic::export::lock( | |
__rtic_internal_shared_resource_adc.get_mut() as *mut _, | |
CEILING, | |
kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS, | |
f, | |
) | |
} | |
} | |
} | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic1"] | |
static __rtic_internal_shared_resource_hidio_intf: rtic::RacyCell< | |
core::mem::MaybeUninit<kiibohd_atsam4s::HidioCommandInterface>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
impl<'a> rtic::Mutex for shared_resources::hidio_intf_that_needs_to_be_locked<'a> { | |
type T = kiibohd_atsam4s::HidioCommandInterface; | |
#[inline(always)] | |
fn lock<RTIC_INTERNAL_R>( | |
&mut self, | |
f: impl FnOnce(&mut kiibohd_atsam4s::HidioCommandInterface) -> RTIC_INTERNAL_R, | |
) -> RTIC_INTERNAL_R { | |
#[doc = r" Priority ceiling"] | |
const CEILING: u8 = 14u8; | |
unsafe { | |
rtic::export::lock( | |
__rtic_internal_shared_resource_hidio_intf.get_mut() as *mut _, | |
CEILING, | |
kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS, | |
f, | |
) | |
} | |
} | |
} | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic2"] | |
static __rtic_internal_shared_resource_issi: rtic::RacyCell< | |
core::mem::MaybeUninit< | |
kiibohd_atsam4s::issi_spi::Is31fl3743bAtsam4Dma< | |
ISSI_DRIVER_CHIPS, | |
ISSI_DRIVER_QUEUE_SIZE, | |
>, | |
>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
impl<'a> rtic::Mutex for shared_resources::issi_that_needs_to_be_locked<'a> { | |
type T = kiibohd_atsam4s::issi_spi::Is31fl3743bAtsam4Dma< | |
ISSI_DRIVER_CHIPS, | |
ISSI_DRIVER_QUEUE_SIZE, | |
>; | |
#[inline(always)] | |
fn lock<RTIC_INTERNAL_R>( | |
&mut self, | |
f: impl FnOnce( | |
&mut kiibohd_atsam4s::issi_spi::Is31fl3743bAtsam4Dma< | |
ISSI_DRIVER_CHIPS, | |
ISSI_DRIVER_QUEUE_SIZE, | |
>, | |
) -> RTIC_INTERNAL_R, | |
) -> RTIC_INTERNAL_R { | |
#[doc = r" Priority ceiling"] | |
const CEILING: u8 = 12u8; | |
unsafe { | |
rtic::export::lock( | |
__rtic_internal_shared_resource_issi.get_mut() as *mut _, | |
CEILING, | |
kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS, | |
f, | |
) | |
} | |
} | |
} | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic3"] | |
static __rtic_internal_shared_resource_layer_state: rtic::RacyCell< | |
core::mem::MaybeUninit<LayerState>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
impl<'a> rtic::Mutex for shared_resources::layer_state_that_needs_to_be_locked<'a> { | |
type T = LayerState; | |
#[inline(always)] | |
fn lock<RTIC_INTERNAL_R>( | |
&mut self, | |
f: impl FnOnce(&mut LayerState) -> RTIC_INTERNAL_R, | |
) -> RTIC_INTERNAL_R { | |
#[doc = r" Priority ceiling"] | |
const CEILING: u8 = 14u8; | |
unsafe { | |
rtic::export::lock( | |
__rtic_internal_shared_resource_layer_state.get_mut() as *mut _, | |
CEILING, | |
kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS, | |
f, | |
) | |
} | |
} | |
} | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic4"] | |
static __rtic_internal_shared_resource_led_lock_mask: rtic::RacyCell< | |
core::mem::MaybeUninit<[kiibohd_atsam4s::issi_spi::LedMask; LED_MASK_SIZE]>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
impl<'a> rtic::Mutex for shared_resources::led_lock_mask_that_needs_to_be_locked<'a> { | |
type T = [kiibohd_atsam4s::issi_spi::LedMask; LED_MASK_SIZE]; | |
#[inline(always)] | |
fn lock<RTIC_INTERNAL_R>( | |
&mut self, | |
f: impl FnOnce(&mut [kiibohd_atsam4s::issi_spi::LedMask; LED_MASK_SIZE]) -> RTIC_INTERNAL_R, | |
) -> RTIC_INTERNAL_R { | |
#[doc = r" Priority ceiling"] | |
const CEILING: u8 = 8u8; | |
unsafe { | |
rtic::export::lock( | |
__rtic_internal_shared_resource_led_lock_mask.get_mut() as *mut _, | |
CEILING, | |
kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS, | |
f, | |
) | |
} | |
} | |
} | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic5"] | |
static __rtic_internal_shared_resource_led_test: rtic::RacyCell< | |
core::mem::MaybeUninit<kiibohd_atsam4s::LedTest>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
impl<'a> rtic::Mutex for shared_resources::led_test_that_needs_to_be_locked<'a> { | |
type T = kiibohd_atsam4s::LedTest; | |
#[inline(always)] | |
fn lock<RTIC_INTERNAL_R>( | |
&mut self, | |
f: impl FnOnce(&mut kiibohd_atsam4s::LedTest) -> RTIC_INTERNAL_R, | |
) -> RTIC_INTERNAL_R { | |
#[doc = r" Priority ceiling"] | |
const CEILING: u8 = 8u8; | |
unsafe { | |
rtic::export::lock( | |
__rtic_internal_shared_resource_led_test.get_mut() as *mut _, | |
CEILING, | |
kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS, | |
f, | |
) | |
} | |
} | |
} | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic6"] | |
static __rtic_internal_shared_resource_manu_test_data: rtic::RacyCell< | |
core::mem::MaybeUninit<heapless::Vec<u8, { kiibohd_hid_io::MESSAGE_LEN - 4 }>>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
impl<'a> rtic::Mutex for shared_resources::manu_test_data_that_needs_to_be_locked<'a> { | |
type T = heapless::Vec<u8, { kiibohd_hid_io::MESSAGE_LEN - 4 }>; | |
#[inline(always)] | |
fn lock<RTIC_INTERNAL_R>( | |
&mut self, | |
f: impl FnOnce( | |
&mut heapless::Vec<u8, { kiibohd_hid_io::MESSAGE_LEN - 4 }>, | |
) -> RTIC_INTERNAL_R, | |
) -> RTIC_INTERNAL_R { | |
#[doc = r" Priority ceiling"] | |
const CEILING: u8 = 14u8; | |
unsafe { | |
rtic::export::lock( | |
__rtic_internal_shared_resource_manu_test_data.get_mut() as *mut _, | |
CEILING, | |
kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS, | |
f, | |
) | |
} | |
} | |
} | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic7"] | |
static __rtic_internal_shared_resource_matrix: rtic::RacyCell<core::mem::MaybeUninit<Matrix>> = | |
rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
impl<'a> rtic::Mutex for shared_resources::matrix_that_needs_to_be_locked<'a> { | |
type T = Matrix; | |
#[inline(always)] | |
fn lock<RTIC_INTERNAL_R>( | |
&mut self, | |
f: impl FnOnce(&mut Matrix) -> RTIC_INTERNAL_R, | |
) -> RTIC_INTERNAL_R { | |
#[doc = r" Priority ceiling"] | |
const CEILING: u8 = 14u8; | |
unsafe { | |
rtic::export::lock( | |
__rtic_internal_shared_resource_matrix.get_mut() as *mut _, | |
CEILING, | |
kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS, | |
f, | |
) | |
} | |
} | |
} | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic8"] | |
static __rtic_internal_shared_resource_spi: rtic::RacyCell< | |
core::mem::MaybeUninit<Option<kiibohd_atsam4s::issi_spi::SpiParkedDma>>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
impl<'a> rtic::Mutex for shared_resources::spi_that_needs_to_be_locked<'a> { | |
type T = Option<kiibohd_atsam4s::issi_spi::SpiParkedDma>; | |
#[inline(always)] | |
fn lock<RTIC_INTERNAL_R>( | |
&mut self, | |
f: impl FnOnce(&mut Option<kiibohd_atsam4s::issi_spi::SpiParkedDma>) -> RTIC_INTERNAL_R, | |
) -> RTIC_INTERNAL_R { | |
#[doc = r" Priority ceiling"] | |
const CEILING: u8 = 12u8; | |
unsafe { | |
rtic::export::lock( | |
__rtic_internal_shared_resource_spi.get_mut() as *mut _, | |
CEILING, | |
kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS, | |
f, | |
) | |
} | |
} | |
} | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic9"] | |
static __rtic_internal_shared_resource_spi_rxtx: rtic::RacyCell< | |
core::mem::MaybeUninit<Option<kiibohd_atsam4s::issi_spi::SpiTransferRxTx>>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
impl<'a> rtic::Mutex for shared_resources::spi_rxtx_that_needs_to_be_locked<'a> { | |
type T = Option<kiibohd_atsam4s::issi_spi::SpiTransferRxTx>; | |
#[inline(always)] | |
fn lock<RTIC_INTERNAL_R>( | |
&mut self, | |
f: impl FnOnce(&mut Option<kiibohd_atsam4s::issi_spi::SpiTransferRxTx>) -> RTIC_INTERNAL_R, | |
) -> RTIC_INTERNAL_R { | |
#[doc = r" Priority ceiling"] | |
const CEILING: u8 = 12u8; | |
unsafe { | |
rtic::export::lock( | |
__rtic_internal_shared_resource_spi_rxtx.get_mut() as *mut _, | |
CEILING, | |
kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS, | |
f, | |
) | |
} | |
} | |
} | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic10"] | |
static __rtic_internal_shared_resource_tcc0: rtic::RacyCell< | |
core::mem::MaybeUninit<TimerCounterChannel<TC0, Tc0Clock<Enabled>, 0, TCC0_FREQ>>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
impl<'a> rtic::Mutex for shared_resources::tcc0_that_needs_to_be_locked<'a> { | |
type T = TimerCounterChannel<TC0, Tc0Clock<Enabled>, 0, TCC0_FREQ>; | |
#[inline(always)] | |
fn lock<RTIC_INTERNAL_R>( | |
&mut self, | |
f: impl FnOnce( | |
&mut TimerCounterChannel<TC0, Tc0Clock<Enabled>, 0, TCC0_FREQ>, | |
) -> RTIC_INTERNAL_R, | |
) -> RTIC_INTERNAL_R { | |
#[doc = r" Priority ceiling"] | |
const CEILING: u8 = 14u8; | |
unsafe { | |
rtic::export::lock( | |
__rtic_internal_shared_resource_tcc0.get_mut() as *mut _, | |
CEILING, | |
kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS, | |
f, | |
) | |
} | |
} | |
} | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic11"] | |
static __rtic_internal_shared_resource_usb_dev: rtic::RacyCell< | |
core::mem::MaybeUninit<kiibohd_atsam4s::UsbDevice>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
impl<'a> rtic::Mutex for shared_resources::usb_dev_that_needs_to_be_locked<'a> { | |
type T = kiibohd_atsam4s::UsbDevice; | |
#[inline(always)] | |
fn lock<RTIC_INTERNAL_R>( | |
&mut self, | |
f: impl FnOnce(&mut kiibohd_atsam4s::UsbDevice) -> RTIC_INTERNAL_R, | |
) -> RTIC_INTERNAL_R { | |
#[doc = r" Priority ceiling"] | |
const CEILING: u8 = 14u8; | |
unsafe { | |
rtic::export::lock( | |
__rtic_internal_shared_resource_usb_dev.get_mut() as *mut _, | |
CEILING, | |
kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS, | |
f, | |
) | |
} | |
} | |
} | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic12"] | |
static __rtic_internal_shared_resource_usb_hid: rtic::RacyCell< | |
core::mem::MaybeUninit<kiibohd_atsam4s::HidInterface>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
impl<'a> rtic::Mutex for shared_resources::usb_hid_that_needs_to_be_locked<'a> { | |
type T = kiibohd_atsam4s::HidInterface; | |
#[inline(always)] | |
fn lock<RTIC_INTERNAL_R>( | |
&mut self, | |
f: impl FnOnce(&mut kiibohd_atsam4s::HidInterface) -> RTIC_INTERNAL_R, | |
) -> RTIC_INTERNAL_R { | |
#[doc = r" Priority ceiling"] | |
const CEILING: u8 = 14u8; | |
unsafe { | |
rtic::export::lock( | |
__rtic_internal_shared_resource_usb_hid.get_mut() as *mut _, | |
CEILING, | |
kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS, | |
f, | |
) | |
} | |
} | |
} | |
mod shared_resources { | |
#[doc(hidden)] | |
#[allow(non_camel_case_types)] | |
pub struct adc_that_needs_to_be_locked<'a> { | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
} | |
impl<'a> adc_that_needs_to_be_locked<'a> { | |
#[inline(always)] | |
pub unsafe fn new() -> Self { | |
adc_that_needs_to_be_locked { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
} | |
} | |
} | |
#[doc(hidden)] | |
#[allow(non_camel_case_types)] | |
pub struct hidio_intf_that_needs_to_be_locked<'a> { | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
} | |
impl<'a> hidio_intf_that_needs_to_be_locked<'a> { | |
#[inline(always)] | |
pub unsafe fn new() -> Self { | |
hidio_intf_that_needs_to_be_locked { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
} | |
} | |
} | |
#[doc(hidden)] | |
#[allow(non_camel_case_types)] | |
pub struct issi_that_needs_to_be_locked<'a> { | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
} | |
impl<'a> issi_that_needs_to_be_locked<'a> { | |
#[inline(always)] | |
pub unsafe fn new() -> Self { | |
issi_that_needs_to_be_locked { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
} | |
} | |
} | |
#[doc(hidden)] | |
#[allow(non_camel_case_types)] | |
pub struct layer_state_that_needs_to_be_locked<'a> { | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
} | |
impl<'a> layer_state_that_needs_to_be_locked<'a> { | |
#[inline(always)] | |
pub unsafe fn new() -> Self { | |
layer_state_that_needs_to_be_locked { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
} | |
} | |
} | |
#[doc(hidden)] | |
#[allow(non_camel_case_types)] | |
pub struct led_lock_mask_that_needs_to_be_locked<'a> { | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
} | |
impl<'a> led_lock_mask_that_needs_to_be_locked<'a> { | |
#[inline(always)] | |
pub unsafe fn new() -> Self { | |
led_lock_mask_that_needs_to_be_locked { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
} | |
} | |
} | |
#[doc(hidden)] | |
#[allow(non_camel_case_types)] | |
pub struct led_test_that_needs_to_be_locked<'a> { | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
} | |
impl<'a> led_test_that_needs_to_be_locked<'a> { | |
#[inline(always)] | |
pub unsafe fn new() -> Self { | |
led_test_that_needs_to_be_locked { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
} | |
} | |
} | |
#[doc(hidden)] | |
#[allow(non_camel_case_types)] | |
pub struct manu_test_data_that_needs_to_be_locked<'a> { | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
} | |
impl<'a> manu_test_data_that_needs_to_be_locked<'a> { | |
#[inline(always)] | |
pub unsafe fn new() -> Self { | |
manu_test_data_that_needs_to_be_locked { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
} | |
} | |
} | |
#[doc(hidden)] | |
#[allow(non_camel_case_types)] | |
pub struct matrix_that_needs_to_be_locked<'a> { | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
} | |
impl<'a> matrix_that_needs_to_be_locked<'a> { | |
#[inline(always)] | |
pub unsafe fn new() -> Self { | |
matrix_that_needs_to_be_locked { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
} | |
} | |
} | |
#[doc(hidden)] | |
#[allow(non_camel_case_types)] | |
pub struct spi_that_needs_to_be_locked<'a> { | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
} | |
impl<'a> spi_that_needs_to_be_locked<'a> { | |
#[inline(always)] | |
pub unsafe fn new() -> Self { | |
spi_that_needs_to_be_locked { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
} | |
} | |
} | |
#[doc(hidden)] | |
#[allow(non_camel_case_types)] | |
pub struct spi_rxtx_that_needs_to_be_locked<'a> { | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
} | |
impl<'a> spi_rxtx_that_needs_to_be_locked<'a> { | |
#[inline(always)] | |
pub unsafe fn new() -> Self { | |
spi_rxtx_that_needs_to_be_locked { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
} | |
} | |
} | |
#[doc(hidden)] | |
#[allow(non_camel_case_types)] | |
pub struct tcc0_that_needs_to_be_locked<'a> { | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
} | |
impl<'a> tcc0_that_needs_to_be_locked<'a> { | |
#[inline(always)] | |
pub unsafe fn new() -> Self { | |
tcc0_that_needs_to_be_locked { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
} | |
} | |
} | |
#[doc(hidden)] | |
#[allow(non_camel_case_types)] | |
pub struct usb_dev_that_needs_to_be_locked<'a> { | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
} | |
impl<'a> usb_dev_that_needs_to_be_locked<'a> { | |
#[inline(always)] | |
pub unsafe fn new() -> Self { | |
usb_dev_that_needs_to_be_locked { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
} | |
} | |
} | |
#[doc(hidden)] | |
#[allow(non_camel_case_types)] | |
pub struct usb_hid_that_needs_to_be_locked<'a> { | |
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>, | |
} | |
impl<'a> usb_hid_that_needs_to_be_locked<'a> { | |
#[inline(always)] | |
pub unsafe fn new() -> Self { | |
usb_hid_that_needs_to_be_locked { | |
__rtic_internal_p: ::core::marker::PhantomData, | |
} | |
} | |
} | |
} | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic13"] | |
static __rtic_internal_local_resource_ctrl_producer: rtic::RacyCell< | |
core::mem::MaybeUninit<Producer<'static, kiibohd_usb::CtrlState, CTRL_QUEUE_SIZE>>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic14"] | |
static __rtic_internal_local_resource_kbd_led_consumer: rtic::RacyCell< | |
core::mem::MaybeUninit<Consumer<'static, kiibohd_usb::LedState, KBD_LED_QUEUE_SIZE>>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic15"] | |
static __rtic_internal_local_resource_kbd_producer: rtic::RacyCell< | |
core::mem::MaybeUninit<Producer<'static, kiibohd_usb::KeyState, KBD_QUEUE_SIZE>>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic16"] | |
static __rtic_internal_local_resource_led_indicators: rtic::RacyCell< | |
core::mem::MaybeUninit<kiibohd_atsam4s::IndicatorLeds<LED_MASK_SIZE>>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic17"] | |
static __rtic_internal_local_resource_mouse_producer: rtic::RacyCell< | |
core::mem::MaybeUninit<Producer<'static, kiibohd_usb::MouseState, MOUSE_QUEUE_SIZE>>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic18"] | |
static __rtic_internal_local_resource_rtt: rtic::RacyCell< | |
core::mem::MaybeUninit<kiibohd_atsam4s::RealTimeTimer>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic19"] | |
static __rtic_internal_local_resource_sense_pins: rtic::RacyCell< | |
core::mem::MaybeUninit<kiibohd_atsam4s::hall_effect::SensePins>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic20"] | |
static __rtic_internal_local_resource_tcc1: rtic::RacyCell< | |
core::mem::MaybeUninit<TimerCounterChannel<TC0, Tc1Clock<Enabled>, 1, TCC1_FREQ>>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic21"] | |
static __rtic_internal_local_resource_usb_state: rtic::RacyCell< | |
core::mem::MaybeUninit<UsbDeviceState>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic22"] | |
static __rtic_internal_local_resource_usb_state_consumer: rtic::RacyCell< | |
core::mem::MaybeUninit<Consumer<'static, kiibohd_atsam4s::UsbState, USB_STATE_QUEUE_SIZE>>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic23"] | |
static __rtic_internal_local_resource_usb_state_producer: rtic::RacyCell< | |
core::mem::MaybeUninit<Producer<'static, kiibohd_atsam4s::UsbState, USB_STATE_QUEUE_SIZE>>, | |
> = rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
#[link_section = ".uninit.rtic24"] | |
static __rtic_internal_local_resource_wdt: rtic::RacyCell<core::mem::MaybeUninit<Watchdog>> = | |
rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
static __rtic_internal_local_init_adc_buf: rtic::RacyCell<[u16; ADC_BUF_SIZE]> = | |
rtic::RacyCell::new([0; ADC_BUF_SIZE]); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
static __rtic_internal_local_init_ctrl_queue: rtic::RacyCell< | |
Queue<kiibohd_usb::CtrlState, CTRL_QUEUE_SIZE>, | |
> = rtic::RacyCell::new(Queue::new()); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
static __rtic_internal_local_init_kbd_queue: rtic::RacyCell< | |
Queue<kiibohd_usb::KeyState, KBD_QUEUE_SIZE>, | |
> = rtic::RacyCell::new(Queue::new()); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
static __rtic_internal_local_init_kbd_led_queue: rtic::RacyCell< | |
Queue<kiibohd_usb::LedState, KBD_LED_QUEUE_SIZE>, | |
> = rtic::RacyCell::new(Queue::new()); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
static __rtic_internal_local_init_mouse_queue: rtic::RacyCell< | |
Queue<kiibohd_usb::MouseState, MOUSE_QUEUE_SIZE>, | |
> = rtic::RacyCell::new(Queue::new()); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
static __rtic_internal_local_init_usb_state_queue: rtic::RacyCell< | |
Queue<UsbState, USB_STATE_QUEUE_SIZE>, | |
> = rtic::RacyCell::new(Queue::new()); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
static __rtic_internal_local_init_serial_number: rtic::RacyCell<String<126>> = | |
rtic::RacyCell::new(String::new()); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
static __rtic_internal_local_init_spi_tx_buf: rtic::RacyCell<[u32; SPI_TX_BUF_SIZE]> = | |
rtic::RacyCell::new([0; SPI_TX_BUF_SIZE]); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
static __rtic_internal_local_init_spi_rx_buf: rtic::RacyCell<[u32; SPI_RX_BUF_SIZE]> = | |
rtic::RacyCell::new([0; SPI_RX_BUF_SIZE]); | |
#[allow(non_camel_case_types)] | |
#[allow(non_upper_case_globals)] | |
#[doc(hidden)] | |
static __rtic_internal_local_init_usb_bus: rtic::RacyCell<Option<UsbBusAllocator<UdpBus>>> = | |
rtic::RacyCell::new(None); | |
#[allow(non_camel_case_types)] | |
type __rtic_internal_led_frame_process_F = impl core::future::Future; | |
#[allow(non_upper_case_globals)] | |
static __rtic_internal_led_frame_process_EXEC: rtic::export::executor::AsyncTaskExecutor< | |
__rtic_internal_led_frame_process_F, | |
> = rtic::export::executor::AsyncTaskExecutor::new(); | |
#[allow(non_camel_case_types)] | |
type __rtic_internal_led_test_F = impl core::future::Future; | |
#[allow(non_upper_case_globals)] | |
static __rtic_internal_led_test_EXEC: rtic::export::executor::AsyncTaskExecutor< | |
__rtic_internal_led_test_F, | |
> = rtic::export::executor::AsyncTaskExecutor::new(); | |
#[allow(non_camel_case_types)] | |
type __rtic_internal_macro_process_F = impl core::future::Future; | |
#[allow(non_upper_case_globals)] | |
static __rtic_internal_macro_process_EXEC: rtic::export::executor::AsyncTaskExecutor< | |
__rtic_internal_macro_process_F, | |
> = rtic::export::executor::AsyncTaskExecutor::new(); | |
#[allow(non_camel_case_types)] | |
type __rtic_internal_usb_process_F = impl core::future::Future; | |
#[allow(non_upper_case_globals)] | |
static __rtic_internal_usb_process_EXEC: rtic::export::executor::AsyncTaskExecutor< | |
__rtic_internal_usb_process_F, | |
> = rtic::export::executor::AsyncTaskExecutor::new(); | |
#[allow(non_snake_case)] | |
#[doc = "Interrupt handler to dispatch async tasks at priority 7"] | |
#[no_mangle] | |
unsafe fn PWM() { | |
#[doc = r" The priority of this interrupt handler"] | |
const PRIORITY: u8 = 7u8; | |
rtic::export::run(PRIORITY, || { | |
__rtic_internal_led_test_EXEC.poll(|| { | |
__rtic_internal_led_test_EXEC.set_pending(); | |
rtic::export::pend(kiibohd_atsam4s::hal::pac::interrupt::PWM); | |
}); | |
}); | |
} | |
#[allow(non_snake_case)] | |
#[doc = "Interrupt handler to dispatch async tasks at priority 8"] | |
#[no_mangle] | |
unsafe fn ACC() { | |
#[doc = r" The priority of this interrupt handler"] | |
const PRIORITY: u8 = 8u8; | |
rtic::export::run(PRIORITY, || { | |
__rtic_internal_led_frame_process_EXEC.poll(|| { | |
__rtic_internal_led_frame_process_EXEC.set_pending(); | |
rtic::export::pend(kiibohd_atsam4s::hal::pac::interrupt::ACC); | |
}); | |
}); | |
} | |
#[allow(non_snake_case)] | |
#[doc = "Interrupt handler to dispatch async tasks at priority 10"] | |
#[no_mangle] | |
unsafe fn TWI0() { | |
#[doc = r" The priority of this interrupt handler"] | |
const PRIORITY: u8 = 10u8; | |
rtic::export::run(PRIORITY, || { | |
__rtic_internal_macro_process_EXEC.poll(|| { | |
__rtic_internal_macro_process_EXEC.set_pending(); | |
rtic::export::pend(kiibohd_atsam4s::hal::pac::interrupt::TWI0); | |
}); | |
}); | |
} | |
#[allow(non_snake_case)] | |
#[doc = "Interrupt handler to dispatch async tasks at priority 11"] | |
#[no_mangle] | |
unsafe fn TWI1() { | |
#[doc = r" The priority of this interrupt handler"] | |
const PRIORITY: u8 = 11u8; | |
rtic::export::run(PRIORITY, || { | |
__rtic_internal_usb_process_EXEC.poll(|| { | |
__rtic_internal_usb_process_EXEC.set_pending(); | |
rtic::export::pend(kiibohd_atsam4s::hal::pac::interrupt::TWI1); | |
}); | |
}); | |
} | |
#[doc(hidden)] | |
#[no_mangle] | |
unsafe extern "C" fn main() -> ! { | |
rtic::export::assert_send::<Option<kiibohd_atsam4s::hall_effect::AdcTransfer<ADC_BUF_SIZE>>>( | |
); | |
rtic::export::assert_send::<kiibohd_atsam4s::HidioCommandInterface>(); | |
rtic::export::assert_send::< | |
kiibohd_atsam4s::issi_spi::Is31fl3743bAtsam4Dma< | |
ISSI_DRIVER_CHIPS, | |
ISSI_DRIVER_QUEUE_SIZE, | |
>, | |
>(); | |
rtic::export::assert_send::<LayerState>(); | |
rtic::export::assert_send::<[kiibohd_atsam4s::issi_spi::LedMask; LED_MASK_SIZE]>(); | |
rtic::export::assert_send::<kiibohd_atsam4s::LedTest>(); | |
rtic::export::assert_send::<heapless::Vec<u8, { kiibohd_hid_io::MESSAGE_LEN - 4 }>>(); | |
rtic::export::assert_send::<Matrix>(); | |
rtic::export::assert_send::<Option<kiibohd_atsam4s::issi_spi::SpiParkedDma>>(); | |
rtic::export::assert_send::<Option<kiibohd_atsam4s::issi_spi::SpiTransferRxTx>>(); | |
rtic::export::assert_send::<TimerCounterChannel<TC0, Tc0Clock<Enabled>, 0, TCC0_FREQ>>(); | |
rtic::export::assert_send::<kiibohd_atsam4s::UsbDevice>(); | |
rtic::export::assert_send::<kiibohd_atsam4s::HidInterface>(); | |
rtic::export::interrupt::disable(); | |
let mut core: rtic::export::Peripherals = rtic::export::Peripherals::steal().into(); | |
let _ = you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::UART1; | |
let _ = you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::USART0; | |
let _ = you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::USART1; | |
let _ = you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::SSC; | |
let _ = you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::PWM; | |
let _ = you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::ACC; | |
let _ = you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::TWI0; | |
let _ = you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::TWI1; | |
const _: () = if (1 << kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS) < 7u8 as usize { | |
:: core :: panic! | |
("Maximum priority used by interrupt vector 'PWM' is more than supported by hardware"); | |
}; | |
core.NVIC.set_priority( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::PWM, | |
rtic::export::cortex_logical2hw(7u8, kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS), | |
); | |
rtic::export::NVIC::unmask( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::PWM, | |
); | |
const _: () = if (1 << kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS) < 8u8 as usize { | |
:: core :: panic! | |
("Maximum priority used by interrupt vector 'ACC' is more than supported by hardware"); | |
}; | |
core.NVIC.set_priority( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::ACC, | |
rtic::export::cortex_logical2hw(8u8, kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS), | |
); | |
rtic::export::NVIC::unmask( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::ACC, | |
); | |
const _: () = if (1 << kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS) < 10u8 as usize { | |
:: core :: panic! | |
("Maximum priority used by interrupt vector 'TWI0' is more than supported by hardware"); | |
}; | |
core.NVIC.set_priority( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::TWI0, | |
rtic::export::cortex_logical2hw(10u8, kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS), | |
); | |
rtic::export::NVIC::unmask( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::TWI0, | |
); | |
const _: () = if (1 << kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS) < 11u8 as usize { | |
:: core :: panic! | |
("Maximum priority used by interrupt vector 'TWI1' is more than supported by hardware"); | |
}; | |
core.NVIC.set_priority( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::TWI1, | |
rtic::export::cortex_logical2hw(11u8, kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS), | |
); | |
rtic::export::NVIC::unmask( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::TWI1, | |
); | |
const _: () = if (1 << kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS) < 13u8 as usize { | |
:: core :: panic! | |
("Maximum priority used by interrupt vector 'TC0' is more than supported by hardware"); | |
}; | |
core.NVIC.set_priority( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::TC0, | |
rtic::export::cortex_logical2hw(13u8, kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS), | |
); | |
rtic::export::NVIC::unmask( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::TC0, | |
); | |
const _: () = if (1 << kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS) < 13u8 as usize { | |
:: core :: panic! | |
("Maximum priority used by interrupt vector 'TC1' is more than supported by hardware"); | |
}; | |
core.NVIC.set_priority( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::TC1, | |
rtic::export::cortex_logical2hw(13u8, kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS), | |
); | |
rtic::export::NVIC::unmask( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::TC1, | |
); | |
const _: () = if (1 << kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS) < 1u8 as usize { | |
:: core :: panic! | |
("Maximum priority used by interrupt vector 'RTT' is more than supported by hardware"); | |
}; | |
core.NVIC.set_priority( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::RTT, | |
rtic::export::cortex_logical2hw(1u8, kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS), | |
); | |
rtic::export::NVIC::unmask( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::RTT, | |
); | |
const _: () = if (1 << kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS) < 14u8 as usize { | |
:: core :: panic! | |
("Maximum priority used by interrupt vector 'ADC' is more than supported by hardware"); | |
}; | |
core.NVIC.set_priority( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::ADC, | |
rtic::export::cortex_logical2hw(14u8, kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS), | |
); | |
rtic::export::NVIC::unmask( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::ADC, | |
); | |
const _: () = if (1 << kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS) < 12u8 as usize { | |
:: core :: panic! | |
("Maximum priority used by interrupt vector 'SPI' is more than supported by hardware"); | |
}; | |
core.NVIC.set_priority( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::SPI, | |
rtic::export::cortex_logical2hw(12u8, kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS), | |
); | |
rtic::export::NVIC::unmask( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::SPI, | |
); | |
const _: () = if (1 << kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS) < 14u8 as usize { | |
:: core :: panic! | |
("Maximum priority used by interrupt vector 'UDP' is more than supported by hardware"); | |
}; | |
core.NVIC.set_priority( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::UDP, | |
rtic::export::cortex_logical2hw(14u8, kiibohd_atsam4s::hal::pac::NVIC_PRIO_BITS), | |
); | |
rtic::export::NVIC::unmask( | |
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::UDP, | |
); | |
#[inline(never)] | |
fn __rtic_init_resources<F>(f: F) | |
where | |
F: FnOnce(), | |
{ | |
f(); | |
} | |
__rtic_init_resources(|| { | |
let (shared_resources, local_resources) = init(init::Context::new(core.into())); | |
__rtic_internal_shared_resource_adc | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(shared_resources.adc)); | |
__rtic_internal_shared_resource_hidio_intf | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(shared_resources.hidio_intf)); | |
__rtic_internal_shared_resource_issi | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(shared_resources.issi)); | |
__rtic_internal_shared_resource_layer_state | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(shared_resources.layer_state)); | |
__rtic_internal_shared_resource_led_lock_mask | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(shared_resources.led_lock_mask)); | |
__rtic_internal_shared_resource_led_test | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(shared_resources.led_test)); | |
__rtic_internal_shared_resource_manu_test_data | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(shared_resources.manu_test_data)); | |
__rtic_internal_shared_resource_matrix | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(shared_resources.matrix)); | |
__rtic_internal_shared_resource_spi | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(shared_resources.spi)); | |
__rtic_internal_shared_resource_spi_rxtx | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(shared_resources.spi_rxtx)); | |
__rtic_internal_shared_resource_tcc0 | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(shared_resources.tcc0)); | |
__rtic_internal_shared_resource_usb_dev | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(shared_resources.usb_dev)); | |
__rtic_internal_shared_resource_usb_hid | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(shared_resources.usb_hid)); | |
__rtic_internal_local_resource_ctrl_producer | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(local_resources.ctrl_producer)); | |
__rtic_internal_local_resource_kbd_led_consumer | |
.get_mut() | |
.write(core::mem::MaybeUninit::new( | |
local_resources.kbd_led_consumer, | |
)); | |
__rtic_internal_local_resource_kbd_producer | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(local_resources.kbd_producer)); | |
__rtic_internal_local_resource_led_indicators | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(local_resources.led_indicators)); | |
__rtic_internal_local_resource_mouse_producer | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(local_resources.mouse_producer)); | |
__rtic_internal_local_resource_rtt | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(local_resources.rtt)); | |
__rtic_internal_local_resource_sense_pins | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(local_resources.sense_pins)); | |
__rtic_internal_local_resource_tcc1 | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(local_resources.tcc1)); | |
__rtic_internal_local_resource_usb_state | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(local_resources.usb_state)); | |
__rtic_internal_local_resource_usb_state_consumer | |
.get_mut() | |
.write(core::mem::MaybeUninit::new( | |
local_resources.usb_state_consumer, | |
)); | |
__rtic_internal_local_resource_usb_state_producer | |
.get_mut() | |
.write(core::mem::MaybeUninit::new( | |
local_resources.usb_state_producer, | |
)); | |
__rtic_internal_local_resource_wdt | |
.get_mut() | |
.write(core::mem::MaybeUninit::new(local_resources.wdt)); | |
rtic::export::interrupt::enable(); | |
}); | |
loop { | |
rtic::export::nop() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment