Skip to content

Instantly share code, notes, and snippets.

@MathiasKoch
Created June 24, 2020 08:31
Show Gist options
  • Save MathiasKoch/a1e1d27c6c3b9e8e85363a48ebb6c61c to your computer and use it in GitHub Desktop.
Save MathiasKoch/a1e1d27c6c3b9e8e85363a48ebb6c61c to your computer and use it in GitHub Desktop.
#![feature(prelude_import)]
#![no_main]
#![no_std]
#[prelude_import]
use core::prelude::v1::*;
#[macro_use]
extern crate core;
#[macro_use]
extern crate compiler_builtins;
use atat::{self, ClientBuilder, ComQueue, Queues, ResQueue, UrcQueue};
use chrono::{DateTime, Utc};
use cortex_m::{interrupt::Nr, peripheral::DWT};
use factbird_lib::{
bsp::{self, firmware_writer::FirmwareHandler, led::BaseColor, time::WallTime},
consts::MqttQueueLen,
logging,
ntp::SntpClient,
sensor::SensorInput,
};
use heapless::{
consts, pool,
pool::singleton::{Box, Pool},
spsc::Queue,
ArrayLength, Vec,
};
use mqttrust::{MqttClient, MqttEvent, MqttOptions, Notification, Request};
use rtic::{app, cyccnt::U32Ext, export::wfi};
use stm32l4xx_hal::{
dma::{self, DMAFrame, FrameReader},
interrupt::SPI2,
pac::{Interrupt, UART4},
prelude::*,
rtc::Rtc,
serial::{Rx, Tx},
};
use ublox_cellular::{
gprs::APNInfo,
prelude::*,
sockets::Ipv4Addr,
{Config as GSMConfig, GsmClient},
};
pub struct SerialDmaPool;
impl ::heapless::pool::singleton::Pool for SerialDmaPool {
type Data = DMAFrame<dma::consts::U32>;
fn ptr() -> &'static ::heapless::pool::Pool<DMAFrame<dma::consts::U32>> {
#[allow(non_upper_case_globals)]
static SerialDmaPool: ::heapless::pool::Pool<DMAFrame<dma::consts::U32>> =
::heapless::pool::Pool::new();
&SerialDmaPool
}
}
pub struct NvicUrcMatcher<I> {
interrupt: I,
}
impl<I> NvicUrcMatcher<I>
where
I: Nr + Copy,
{
pub fn new(interrupt: I) -> Self {
NvicUrcMatcher { interrupt }
}
}
impl<BufLen: ArrayLength<u8>, I: Nr + Copy> atat::UrcMatcher<BufLen> for NvicUrcMatcher<I> {
fn process(&mut self, buf: &mut Vec<u8, BufLen>) -> atat::UrcMatcherResult<BufLen> {
if let Some(line) = atat::get_line(buf, &[b'\r'], b'\r', b'\n', false, false) {
atat::UrcMatcherResult::Complete(line)
} else {
atat::UrcMatcherResult::Incomplete
}
}
}
type AtatRxBufLen = consts::U1024;
type GsmType =
GsmClient<atat::Client<Tx<UART4>, bsp::CellAtTimer, AtatRxBufLen>, bsp::CellPwr, bsp::CellDtr>;
#[allow(non_snake_case)]
fn init(
init::Locals {
MEMORY,
RES_QUEUE,
URC_QUEUE,
COM_QUEUE,
Q,
..
}: init::Locals,
mut ctx: init::Context,
) -> init::LateResources {
SerialDmaPool::grow(MEMORY);
ctx.core.DCB.enable_trace();
DWT::unlock();
ctx.core.DWT.enable_cycle_counter();
let bsp::BoardParts {
cell_serial,
cell_at_timer,
mqtt_ping_timer,
mqtt_timeout_timer,
ota_timer,
cell_pwr,
cell_dtr,
serial,
btn,
io_1,
led,
dma2_channels,
clocks,
rtc,
firmware_handler,
qspi,
..
} = bsp::FactbirdRevB::new(ctx.device);
let logger = cortex_m_log::log::Logger {
inner: logging::create(ctx.core.ITM, serial).unwrap(),
level: log::LevelFilter::Debug,
};
*ctx.resources.logger = Some(logger);
let log: &'static mut _ = ctx.resources.logger.as_mut().unwrap_or_else(|| {
::core::panicking::panic("Failed to get the static logger");
});
unsafe {
cortex_m_log::log::trick_init(&log).unwrap_or_else(|err| {
::core::panicking::panic_fmt(::core::fmt::Arguments::new_v1(
&["Failed to get initialize the logger "],
&match (&err,) {
(arg0,) => [::core::fmt::ArgumentV1::new(arg0, ::core::fmt::Debug::fmt)],
},
));
});
}
{
let lvl = ::log::Level::Info;
if lvl <= ::log::STATIC_MAX_LEVEL && lvl <= ::log::max_level() {
::log::__private_api_log(
::core::fmt::Arguments::new_v1(
&[],
&match () {
() => [],
},
),
lvl,
&(
"factbird_rs",
"factbird_rs",
"factbird-rs/src/main.rs",
171u32,
),
);
}
};
{
let lvl = ::log::Level::Info;
if lvl <= ::log::STATIC_MAX_LEVEL && lvl <= ::log::max_level() {
::log::__private_api_log(
::core::fmt::Arguments::new_v1(
&["Copyright Mathias Koch 2020"],
&match () {
() => [],
},
),
lvl,
&(
"factbird_rs",
"factbird_rs",
"factbird-rs/src/main.rs",
172u32,
),
);
}
};
{
let lvl = ::log::Level::Info;
if lvl <= ::log::STATIC_MAX_LEVEL && lvl <= ::log::max_level() {
::log::__private_api_log(
::core::fmt::Arguments::new_v1(
&["Clocks: "],
&match (&clocks,) {
(arg0,) => [::core::fmt::ArgumentV1::new(arg0, ::core::fmt::Debug::fmt)],
},
),
lvl,
&(
"factbird_rs",
"factbird_rs",
"factbird-rs/src/main.rs",
173u32,
),
);
}
};
let (cell_tx, cell_rx) = cell_serial.split();
let queues = Queues {
res_queue: RES_QUEUE.split(),
urc_queue: URC_QUEUE.split(),
com_queue: COM_QUEUE.split(),
};
let (cell_at, cell_ingress) = ClientBuilder::new(
cell_tx,
cell_at_timer,
atat::Config::new(atat::Mode::Timeout),
)
.build(queues);
let (mqtt_producer, mqtt_consumer) = Q.split();
let thing_name = "test_mini_1";
let broker = "a3f8k0ccx04zas.iot.eu-west-1.amazonaws.com";
let mqtt_event = MqttEvent::new(
mqtt_consumer,
mqtt_ping_timer,
MqttOptions::new(thing_name, broker.into(), 8883).set_clean_session(false),
);
{
let lvl = ::log::Level::Info;
if lvl <= ::log::STATIC_MAX_LEVEL && lvl <= ::log::max_level() {
::log::__private_api_log(
::core::fmt::Arguments::new_v1(
&[""],
&match (&(&broker as *const _),) {
(arg0,) => [::core::fmt::ArgumentV1::new(arg0, ::core::fmt::Debug::fmt)],
},
),
lvl,
&(
"factbird_rs",
"factbird_rs",
"factbird-rs/src/main.rs",
213u32,
),
);
}
};
let cell_client: GsmType = GsmClient::new(
cell_at,
GSMConfig::new(APNInfo::new("em"))
.with_flow_control()
.baud_rate(230_400_u32),
);
let mqtt_client = MqttClient::new(mqtt_producer, thing_name);
let mut dma_ch5 = dma2_channels.5;
dma_ch5.listen(dma::Event::TransferComplete);
let fr = if let Some(dma_buf) = SerialDmaPool::alloc() {
let dma_buf = dma_buf.init(DMAFrame::new());
cell_rx.frame_read(dma_ch5, dma_buf)
} else {
{
::core::panicking::panic("internal error: entered unreachable code")
}
};
ctx.spawn.main_task().unwrap();
ctx.spawn.atat_spin().unwrap();
ctx.spawn.trick_cnt().unwrap();
init::LateResources {
cell_rx,
cell_ingress,
cell_client,
mqtt_client,
mqtt_event,
frame_reader: fr,
led,
io_1,
btn,
rtc,
}
}
/// Idle thread
#[allow(non_snake_case)]
fn idle(ctx: idle::Context) -> ! {
use rtic::Mutex as _;
loop {
wfi();
}
}
/// This task handles the character match interrupt at required by the `FrameReader`
#[allow(non_snake_case)]
fn serial_isr(ctx: serial_isr::Context) {
use rtic::Mutex as _;
if ctx.resources.cell_rx.is_character_match(true) {
if let Some(dma_buf) = SerialDmaPool::alloc() {
let dma_buf = dma_buf.init(DMAFrame::new());
let buf = ctx
.resources
.frame_reader
.character_match_interrupt(dma_buf);
ctx.resources.cell_ingress.write(buf.read());
}
} else if ctx.resources.cell_rx.is_receiver_timeout(true) {
if let Some(dma_buf) = SerialDmaPool::alloc() {
let dma_buf = dma_buf.init(DMAFrame::new());
let buf = ctx
.resources
.frame_reader
.receiver_timeout_interrupt(dma_buf);
ctx.resources.cell_ingress.write(buf.read());
}
}
}
/// This task handles the RX transfer complete interrupt at required by the `FrameReader`
#[allow(non_snake_case)]
fn serial_rx_dma(ctx: serial_rx_dma::Context) {
use rtic::Mutex as _;
if let Some(dma_buf) = SerialDmaPool::alloc() {
let dma_buf = dma_buf.init(DMAFrame::new());
let buf = ctx
.resources
.frame_reader
.transfer_complete_interrupt(dma_buf);
ctx.resources.cell_ingress.write(buf.read());
}
}
#[allow(non_snake_case)]
fn button(ctx: button::Context) {
use rtic::Mutex as _;
if ctx.resources.btn.check_interrupt() {
if ctx.resources.led.get_color() == BaseColor::Red {
ctx.resources.led.set_color(BaseColor::Blue);
} else {
ctx.resources.led.set_color(BaseColor::Red);
}
ctx.resources.btn.clear_interrupt_pending_bit();
}
}
#[allow(non_snake_case)]
fn publish_mqtt(ctx: publish_mqtt::Context) {
use rtic::Mutex as _;
let mqtt_client = ctx.resources.mqtt_client;
let mut rtc = ctx.resources.rtc;
let mut io_1 = ctx.resources.io_1;
let timestamp = rtc.lock(|r| r.epoch_timestamp());
io_1.lock(|i| i.publish(mqtt_client, timestamp));
ctx.schedule
.publish_mqtt(ctx.scheduled + 1_600_000_000.cycles())
.unwrap();
}
#[allow(non_snake_case)]
fn sample_io(ctx: sample_io::Context) {
use rtic::Mutex as _;
let rtc = ctx.resources.rtc;
let mut io_1 = ctx.resources.io_1;
let timestamp = rtc.epoch_timestamp();
io_1.lock(|i| i.new_sample(timestamp));
ctx.schedule
.sample_io(ctx.scheduled + 400_000_000.cycles())
.unwrap();
}
#[allow(non_snake_case)]
fn main_task(ctx: main_task::Context) {
use rtic::Mutex as _;
let mut rtc = ctx.resources.rtc;
let mut mqtt_client = ctx.resources.mqtt_client;
let mqtt_event = ctx.resources.mqtt_event;
let cell_client = ctx.resources.cell_client;
cell_client.init(true).unwrap();
{
let lvl = ::log::Level::Info;
if lvl <= ::log::STATIC_MAX_LEVEL && lvl <= ::log::max_level() {
::log::__private_api_log(
::core::fmt::Arguments::new_v1(
&["INITTED!"],
&match () {
() => [],
},
),
lvl,
&(
"factbird_rs",
"factbird_rs",
"factbird-rs/src/main.rs",
314u32,
),
);
}
};
cell_client.begin().unwrap();
{
let lvl = ::log::Level::Info;
if lvl <= ::log::STATIC_MAX_LEVEL && lvl <= ::log::max_level() {
::log::__private_api_log(
::core::fmt::Arguments::new_v1(
&["BEGUN!"],
&match () {
() => [],
},
),
lvl,
&(
"factbird_rs",
"factbird_rs",
"factbird-rs/src/main.rs",
316u32,
),
);
}
};
cell_client.attach_gprs().unwrap();
{
let lvl = ::log::Level::Info;
if lvl <= ::log::STATIC_MAX_LEVEL && lvl <= ::log::max_level() {
::log::__private_api_log(
::core::fmt::Arguments::new_v1(
&["ATTACHED! "],
&match (&mqtt_event.options.broker(),) {
(arg0,) => [::core::fmt::ArgumentV1::new(arg0, ::core::fmt::Debug::fmt)],
},
),
lvl,
&(
"factbird_rs",
"factbird_rs",
"factbird-rs/src/main.rs",
319u32,
),
);
}
};
loop {
if mqtt_event.connect(&cell_client).is_err() {
continue;
}
}
}
#[allow(non_snake_case)]
fn atat_spin(mut ctx: atat_spin::Context) {
use rtic::Mutex as _;
ctx.resources.cell_ingress.lock(|mgr| mgr.digest());
ctx.schedule
.atat_spin(ctx.scheduled + 8_000_000.cycles())
.unwrap();
}
#[allow(non_snake_case)]
fn trick_cnt(ctx: trick_cnt::Context) {
use rtic::Mutex as _;
ctx.resources.io_1.handle_irq();
ctx.schedule
.trick_cnt(ctx.scheduled + 40_000_000.cycles())
.unwrap();
}
/// Resources initialized at runtime
#[allow(non_snake_case)]
pub struct initLateResources {
pub btn: bsp::Btn,
pub cell_client: GsmType,
pub cell_ingress: atat::IngressManager<AtatRxBufLen, NvicUrcMatcher<Interrupt>>,
pub cell_rx: Rx<UART4>,
pub frame_reader: FrameReader<Box<SerialDmaPool>, dma::dma2::C5, consts::U32>,
pub io_1: bsp::IO1,
pub led: bsp::RGB,
pub mqtt_client: MqttClient<'static, 'static, MqttQueueLen, factbird_lib::buffer::MqttPayload>,
pub mqtt_event: MqttEvent<
'static,
'static,
MqttQueueLen,
GsmType,
bsp::MqttPingTimer,
factbird_lib::buffer::MqttPayload,
>,
pub rtc: Rtc,
}
#[allow(non_snake_case)]
#[doc(hidden)]
pub struct initLocals {
MEMORY: &'static mut [u8; 128],
RES_QUEUE: &'static mut ResQueue<AtatRxBufLen, consts::U5>,
URC_QUEUE: &'static mut UrcQueue<AtatRxBufLen, consts::U10>,
COM_QUEUE: &'static mut ComQueue<consts::U3>,
Q: &'static mut Queue<Request<factbird_lib::buffer::MqttPayload>, MqttQueueLen>,
}
impl initLocals {
#[inline(always)]
unsafe fn new() -> Self {
static mut MEMORY: [u8; 128] = [0; 128];
static mut RES_QUEUE: ResQueue<AtatRxBufLen, consts::U5> = Queue(heapless::i::Queue::u8());
static mut URC_QUEUE: UrcQueue<AtatRxBufLen, consts::U10> = Queue(heapless::i::Queue::u8());
static mut COM_QUEUE: ComQueue<consts::U3> = Queue(heapless::i::Queue::u8());
static mut Q: Queue<Request<factbird_lib::buffer::MqttPayload>, MqttQueueLen> =
Queue(heapless::i::Queue::new());
initLocals {
MEMORY: &mut MEMORY,
RES_QUEUE: &mut RES_QUEUE,
URC_QUEUE: &mut URC_QUEUE,
COM_QUEUE: &mut COM_QUEUE,
Q: &mut Q,
}
}
}
#[allow(non_snake_case)]
///Resources `init` has access to
pub struct initResources {
pub logger: &'static mut Option<logging::LoggerType>,
}
#[allow(non_snake_case)]
///Initialization function
pub mod init {
#[doc(inline)]
pub use super::initLocals as Locals;
#[doc(inline)]
pub use super::initResources as Resources;
///Tasks that can be `spawn`-ed from this context
pub struct Spawn {
_not_send: core::marker::PhantomData<*mut ()>,
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::clone::Clone for Spawn {
#[inline]
fn clone(&self) -> Spawn {
{
let _: ::core::clone::AssertParamIsClone<core::marker::PhantomData<*mut ()>>;
*self
}
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::marker::Copy for Spawn {}
#[doc(inline)]
pub use super::initLateResources as LateResources;
/// Execution context
pub struct Context {
/// System start time = `Instant(0 /* cycles */)`
pub start: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
/// Core (Cortex-M) peripherals minus the SysTick
pub core: rtic::Peripherals,
/// Device peripherals
pub device: stm32l4xx_hal::pac::Peripherals,
/// Resources this task has access to
pub resources: Resources,
///Tasks that can be `spawn`-ed from this context
pub spawn: Spawn,
}
impl Context {
#[inline(always)]
pub unsafe fn new(core: rtic::Peripherals) -> Self {
Context {
start: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::zero(),
device: stm32l4xx_hal::pac::Peripherals::steal(),
core,
resources: Resources::new(),
spawn: Spawn {
_not_send: core::marker::PhantomData,
},
}
}
}
}
#[allow(non_snake_case)]
///Idle loop
pub mod idle {
/// Execution context
pub struct Context {}
impl Context {
#[inline(always)]
pub unsafe fn new(priority: &rtic::export::Priority) -> Self {
Context {}
}
}
}
mod resources {
use rtic::export::Priority;
#[allow(non_camel_case_types)]
pub struct cell_ingress<'a> {
priority: &'a Priority,
}
impl<'a> cell_ingress<'a> {
#[inline(always)]
pub unsafe fn new(priority: &'a Priority) -> Self {
cell_ingress { priority }
}
#[inline(always)]
pub unsafe fn priority(&self) -> &Priority {
self.priority
}
}
#[allow(non_camel_case_types)]
pub struct rtc<'a> {
priority: &'a Priority,
}
impl<'a> rtc<'a> {
#[inline(always)]
pub unsafe fn new(priority: &'a Priority) -> Self {
rtc { priority }
}
#[inline(always)]
pub unsafe fn priority(&self) -> &Priority {
self.priority
}
}
#[allow(non_camel_case_types)]
pub struct io_1<'a> {
priority: &'a Priority,
}
impl<'a> io_1<'a> {
#[inline(always)]
pub unsafe fn new(priority: &'a Priority) -> Self {
io_1 { priority }
}
#[inline(always)]
pub unsafe fn priority(&self) -> &Priority {
self.priority
}
}
}
#[allow(non_snake_case)]
///Resources `serial_isr` has access to
pub struct serial_isrResources<'a> {
pub cell_rx: &'a mut Rx<UART4>,
pub frame_reader: &'a mut FrameReader<Box<SerialDmaPool>, dma::dma2::C5, consts::U32>,
pub cell_ingress: &'a mut atat::IngressManager<AtatRxBufLen, NvicUrcMatcher<Interrupt>>,
}
#[allow(non_snake_case)]
///Hardware task
pub mod serial_isr {
#[doc(inline)]
pub use super::serial_isrResources as Resources;
/// Tasks that can be spawned from this context
pub struct Spawn<'a> {
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
priority: &'a rtic::export::Priority,
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl<'a> ::core::clone::Clone for Spawn<'a> {
#[inline]
fn clone(&self) -> Spawn<'a> {
{
let _: ::core::clone::AssertParamIsClone<
<rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
>;
let _: ::core::clone::AssertParamIsClone<&'a rtic::export::Priority>;
*self
}
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl<'a> ::core::marker::Copy for Spawn<'a> {}
impl<'a> Spawn<'a> {
#[doc(hidden)]
#[inline(always)]
pub unsafe fn priority(&self) -> &rtic::export::Priority {
self.priority
}
pub unsafe fn instant(&self) -> <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant {
self.instant
}
}
/// Execution context
pub struct Context<'a> {
/// Time at which this handler started executing
pub start: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
/// Resources this task has access to
pub resources: Resources<'a>,
///Tasks that can be `spawn`-ed from this context
pub spawn: Spawn<'a>,
}
impl<'a> Context<'a> {
#[inline(always)]
pub unsafe fn new(
priority: &'a rtic::export::Priority,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Self {
Context {
start: instant,
resources: Resources::new(priority),
spawn: Spawn { priority, instant },
}
}
}
}
#[allow(non_snake_case)]
///Resources `serial_rx_dma` has access to
pub struct serial_rx_dmaResources<'a> {
pub frame_reader: &'a mut FrameReader<Box<SerialDmaPool>, dma::dma2::C5, consts::U32>,
pub cell_ingress: &'a mut atat::IngressManager<AtatRxBufLen, NvicUrcMatcher<Interrupt>>,
}
#[allow(non_snake_case)]
///Hardware task
pub mod serial_rx_dma {
#[doc(inline)]
pub use super::serial_rx_dmaResources as Resources;
/// Tasks that can be spawned from this context
pub struct Spawn<'a> {
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
priority: &'a rtic::export::Priority,
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl<'a> ::core::clone::Clone for Spawn<'a> {
#[inline]
fn clone(&self) -> Spawn<'a> {
{
let _: ::core::clone::AssertParamIsClone<
<rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
>;
let _: ::core::clone::AssertParamIsClone<&'a rtic::export::Priority>;
*self
}
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl<'a> ::core::marker::Copy for Spawn<'a> {}
impl<'a> Spawn<'a> {
#[doc(hidden)]
#[inline(always)]
pub unsafe fn priority(&self) -> &rtic::export::Priority {
self.priority
}
pub unsafe fn instant(&self) -> <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant {
self.instant
}
}
/// Execution context
pub struct Context<'a> {
/// Time at which this handler started executing
pub start: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
/// Resources this task has access to
pub resources: Resources<'a>,
///Tasks that can be `spawn`-ed from this context
pub spawn: Spawn<'a>,
}
impl<'a> Context<'a> {
#[inline(always)]
pub unsafe fn new(
priority: &'a rtic::export::Priority,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Self {
Context {
start: instant,
resources: Resources::new(priority),
spawn: Spawn { priority, instant },
}
}
}
}
#[allow(non_snake_case)]
///Resources `button` has access to
pub struct buttonResources<'a> {
pub btn: &'a mut bsp::Btn,
pub led: &'a mut bsp::RGB,
}
#[allow(non_snake_case)]
///Hardware task
pub mod button {
#[doc(inline)]
pub use super::buttonResources as Resources;
/// Execution context
pub struct Context<'a> {
/// Time at which this handler started executing
pub start: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
/// Resources this task has access to
pub resources: Resources<'a>,
}
impl<'a> Context<'a> {
#[inline(always)]
pub unsafe fn new(
priority: &'a rtic::export::Priority,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Self {
Context {
start: instant,
resources: Resources::new(priority),
}
}
}
}
#[allow(non_snake_case)]
///Resources `publish_mqtt` has access to
pub struct publish_mqttResources<'a> {
pub mqtt_client:
&'a mut MqttClient<'static, 'static, MqttQueueLen, factbird_lib::buffer::MqttPayload>,
pub rtc: resources::rtc<'a>,
pub io_1: resources::io_1<'a>,
}
#[allow(non_snake_case)]
///Software task
pub mod publish_mqtt {
#[doc(inline)]
pub use super::publish_mqttResources as Resources;
///Tasks that can be `schedule`-d from this context
pub struct Schedule<'a> {
priority: &'a rtic::export::Priority,
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl<'a> ::core::clone::Clone for Schedule<'a> {
#[inline]
fn clone(&self) -> Schedule<'a> {
{
let _: ::core::clone::AssertParamIsClone<&'a rtic::export::Priority>;
*self
}
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl<'a> ::core::marker::Copy for Schedule<'a> {}
impl<'a> Schedule<'a> {
#[doc(hidden)]
#[inline(always)]
pub unsafe fn priority(&self) -> &rtic::export::Priority {
&self.priority
}
}
/// Execution context
pub struct Context<'a> {
/// The time at which this task was scheduled to run
pub scheduled: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
/// Resources this task has access to
pub resources: Resources<'a>,
///Tasks that can be `schedule`-d from this context
pub schedule: Schedule<'a>,
}
impl<'a> Context<'a> {
#[inline(always)]
pub unsafe fn new(
priority: &'a rtic::export::Priority,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Self {
Context {
scheduled: instant,
resources: Resources::new(priority),
schedule: Schedule { priority },
}
}
}
}
#[allow(non_snake_case)]
///Resources `sample_io` has access to
pub struct sample_ioResources<'a> {
pub io_1: resources::io_1<'a>,
pub rtc: &'a mut Rtc,
}
#[allow(non_snake_case)]
///Software task
pub mod sample_io {
#[doc(inline)]
pub use super::sample_ioResources as Resources;
///Tasks that can be `schedule`-d from this context
pub struct Schedule<'a> {
priority: &'a rtic::export::Priority,
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl<'a> ::core::clone::Clone for Schedule<'a> {
#[inline]
fn clone(&self) -> Schedule<'a> {
{
let _: ::core::clone::AssertParamIsClone<&'a rtic::export::Priority>;
*self
}
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl<'a> ::core::marker::Copy for Schedule<'a> {}
impl<'a> Schedule<'a> {
#[doc(hidden)]
#[inline(always)]
pub unsafe fn priority(&self) -> &rtic::export::Priority {
&self.priority
}
}
/// Execution context
pub struct Context<'a> {
/// The time at which this task was scheduled to run
pub scheduled: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
/// Resources this task has access to
pub resources: Resources<'a>,
///Tasks that can be `schedule`-d from this context
pub schedule: Schedule<'a>,
}
impl<'a> Context<'a> {
#[inline(always)]
pub unsafe fn new(
priority: &'a rtic::export::Priority,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Self {
Context {
scheduled: instant,
resources: Resources::new(priority),
schedule: Schedule { priority },
}
}
}
}
#[allow(non_snake_case)]
///Resources `main_task` has access to
pub struct main_taskResources<'a> {
pub cell_client: &'a mut GsmType,
pub rtc: resources::rtc<'a>,
pub mqtt_event: &'a mut MqttEvent<
'static,
'static,
MqttQueueLen,
GsmType,
bsp::MqttPingTimer,
factbird_lib::buffer::MqttPayload,
>,
pub mqtt_client:
&'a mut MqttClient<'static, 'static, MqttQueueLen, factbird_lib::buffer::MqttPayload>,
}
#[allow(non_snake_case)]
///Software task
pub mod main_task {
#[doc(inline)]
pub use super::main_taskResources as Resources;
/// Tasks that can be spawned from this context
pub struct Spawn<'a> {
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
priority: &'a rtic::export::Priority,
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl<'a> ::core::clone::Clone for Spawn<'a> {
#[inline]
fn clone(&self) -> Spawn<'a> {
{
let _: ::core::clone::AssertParamIsClone<
<rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
>;
let _: ::core::clone::AssertParamIsClone<&'a rtic::export::Priority>;
*self
}
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl<'a> ::core::marker::Copy for Spawn<'a> {}
impl<'a> Spawn<'a> {
#[doc(hidden)]
#[inline(always)]
pub unsafe fn priority(&self) -> &rtic::export::Priority {
self.priority
}
pub unsafe fn instant(&self) -> <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant {
self.instant
}
}
/// Execution context
pub struct Context<'a> {
/// The time at which this task was scheduled to run
pub scheduled: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
/// Resources this task has access to
pub resources: Resources<'a>,
///Tasks that can be `spawn`-ed from this context
pub spawn: Spawn<'a>,
}
impl<'a> Context<'a> {
#[inline(always)]
pub unsafe fn new(
priority: &'a rtic::export::Priority,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Self {
Context {
scheduled: instant,
resources: Resources::new(priority),
spawn: Spawn { priority, instant },
}
}
}
}
#[allow(non_snake_case)]
///Resources `atat_spin` has access to
pub struct atat_spinResources<'a> {
pub cell_ingress: resources::cell_ingress<'a>,
}
#[allow(non_snake_case)]
///Software task
pub mod atat_spin {
#[doc(inline)]
pub use super::atat_spinResources as Resources;
///Tasks that can be `schedule`-d from this context
pub struct Schedule<'a> {
priority: &'a rtic::export::Priority,
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl<'a> ::core::clone::Clone for Schedule<'a> {
#[inline]
fn clone(&self) -> Schedule<'a> {
{
let _: ::core::clone::AssertParamIsClone<&'a rtic::export::Priority>;
*self
}
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl<'a> ::core::marker::Copy for Schedule<'a> {}
impl<'a> Schedule<'a> {
#[doc(hidden)]
#[inline(always)]
pub unsafe fn priority(&self) -> &rtic::export::Priority {
&self.priority
}
}
/// Execution context
pub struct Context<'a> {
/// The time at which this task was scheduled to run
pub scheduled: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
/// Resources this task has access to
pub resources: Resources<'a>,
///Tasks that can be `schedule`-d from this context
pub schedule: Schedule<'a>,
}
impl<'a> Context<'a> {
#[inline(always)]
pub unsafe fn new(
priority: &'a rtic::export::Priority,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Self {
Context {
scheduled: instant,
resources: Resources::new(priority),
schedule: Schedule { priority },
}
}
}
}
#[allow(non_snake_case)]
///Resources `trick_cnt` has access to
pub struct trick_cntResources<'a> {
pub io_1: &'a mut bsp::IO1,
}
#[allow(non_snake_case)]
///Software task
pub mod trick_cnt {
#[doc(inline)]
pub use super::trick_cntResources as Resources;
///Tasks that can be `schedule`-d from this context
pub struct Schedule<'a> {
priority: &'a rtic::export::Priority,
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl<'a> ::core::clone::Clone for Schedule<'a> {
#[inline]
fn clone(&self) -> Schedule<'a> {
{
let _: ::core::clone::AssertParamIsClone<&'a rtic::export::Priority>;
*self
}
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl<'a> ::core::marker::Copy for Schedule<'a> {}
impl<'a> Schedule<'a> {
#[doc(hidden)]
#[inline(always)]
pub unsafe fn priority(&self) -> &rtic::export::Priority {
&self.priority
}
}
/// Execution context
pub struct Context<'a> {
/// The time at which this task was scheduled to run
pub scheduled: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
/// Resources this task has access to
pub resources: Resources<'a>,
///Tasks that can be `schedule`-d from this context
pub schedule: Schedule<'a>,
}
impl<'a> Context<'a> {
#[inline(always)]
pub unsafe fn new(
priority: &'a rtic::export::Priority,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Self {
Context {
scheduled: instant,
resources: Resources::new(priority),
schedule: Schedule { priority },
}
}
}
}
/// Implementation details
const APP: () = {
#[doc = r" Always include the device crate which contains the vector table"]
use stm32l4xx_hal::pac as _;
impl initResources {
#[inline(always)]
unsafe fn new() -> Self {
initResources {
logger: &mut logger,
}
}
}
#[allow(non_upper_case_globals)]
static mut logger: Option<logging::LoggerType> = None;
#[allow(non_upper_case_globals)]
#[link_section = ".uninit.rtic0"]
static mut cell_rx: core::mem::MaybeUninit<Rx<UART4>> = core::mem::MaybeUninit::uninit();
#[allow(non_upper_case_globals)]
#[link_section = ".uninit.rtic1"]
static mut frame_reader: core::mem::MaybeUninit<
FrameReader<Box<SerialDmaPool>, dma::dma2::C5, consts::U32>,
> = core::mem::MaybeUninit::uninit();
#[allow(non_upper_case_globals)]
#[link_section = ".uninit.rtic2"]
static mut cell_ingress: core::mem::MaybeUninit<
atat::IngressManager<AtatRxBufLen, NvicUrcMatcher<Interrupt>>,
> = core::mem::MaybeUninit::uninit();
impl<'a> rtic::Mutex for resources::cell_ingress<'a> {
type T = atat::IngressManager<AtatRxBufLen, NvicUrcMatcher<Interrupt>>;
#[inline(always)]
fn lock<R>(
&mut self,
f: impl FnOnce(&mut atat::IngressManager<AtatRxBufLen, NvicUrcMatcher<Interrupt>>) -> R,
) -> R {
#[doc = r" Priority ceiling"]
const CEILING: u8 = 3u8;
unsafe {
rtic::export::lock(
cell_ingress.as_mut_ptr(),
self.priority(),
CEILING,
stm32l4xx_hal::pac::NVIC_PRIO_BITS,
f,
)
}
}
}
#[allow(non_upper_case_globals)]
#[link_section = ".uninit.rtic3"]
static mut btn: core::mem::MaybeUninit<bsp::Btn> = core::mem::MaybeUninit::uninit();
#[allow(non_upper_case_globals)]
#[link_section = ".uninit.rtic4"]
static mut led: core::mem::MaybeUninit<bsp::RGB> = core::mem::MaybeUninit::uninit();
#[allow(non_upper_case_globals)]
#[link_section = ".uninit.rtic5"]
static mut mqtt_client: core::mem::MaybeUninit<
MqttClient<'static, 'static, MqttQueueLen, factbird_lib::buffer::MqttPayload>,
> = core::mem::MaybeUninit::uninit();
#[allow(non_upper_case_globals)]
#[link_section = ".uninit.rtic6"]
static mut rtc: core::mem::MaybeUninit<Rtc> = core::mem::MaybeUninit::uninit();
impl<'a> rtic::Mutex for resources::rtc<'a> {
type T = Rtc;
#[inline(always)]
fn lock<R>(&mut self, f: impl FnOnce(&mut Rtc) -> R) -> R {
#[doc = r" Priority ceiling"]
const CEILING: u8 = 2u8;
unsafe {
rtic::export::lock(
rtc.as_mut_ptr(),
self.priority(),
CEILING,
stm32l4xx_hal::pac::NVIC_PRIO_BITS,
f,
)
}
}
}
#[allow(non_upper_case_globals)]
#[link_section = ".uninit.rtic7"]
static mut io_1: core::mem::MaybeUninit<bsp::IO1> = core::mem::MaybeUninit::uninit();
impl<'a> rtic::Mutex for resources::io_1<'a> {
type T = bsp::IO1;
#[inline(always)]
fn lock<R>(&mut self, f: impl FnOnce(&mut bsp::IO1) -> R) -> R {
#[doc = r" Priority ceiling"]
const CEILING: u8 = 4u8;
unsafe {
rtic::export::lock(
io_1.as_mut_ptr(),
self.priority(),
CEILING,
stm32l4xx_hal::pac::NVIC_PRIO_BITS,
f,
)
}
}
}
#[allow(non_upper_case_globals)]
#[link_section = ".uninit.rtic8"]
static mut cell_client: core::mem::MaybeUninit<GsmType> = core::mem::MaybeUninit::uninit();
#[allow(non_upper_case_globals)]
#[link_section = ".uninit.rtic9"]
static mut mqtt_event: core::mem::MaybeUninit<
MqttEvent<
'static,
'static,
MqttQueueLen,
GsmType,
bsp::MqttPingTimer,
factbird_lib::buffer::MqttPayload,
>,
> = core::mem::MaybeUninit::uninit();
#[allow(non_snake_case)]
#[no_mangle]
unsafe fn UART4() {
const PRIORITY: u8 = 3u8;
let instant = <rtic::cyccnt::CYCCNT as rtic::Monotonic>::now();
rtic::export::run(PRIORITY, || {
crate::serial_isr(serial_isr::Context::new(
&rtic::export::Priority::new(PRIORITY),
instant,
))
});
}
impl<'a> serial_isrResources<'a> {
#[inline(always)]
unsafe fn new(priority: &'a rtic::export::Priority) -> Self {
serial_isrResources {
cell_rx: &mut *cell_rx.as_mut_ptr(),
frame_reader: &mut *frame_reader.as_mut_ptr(),
cell_ingress: &mut *cell_ingress.as_mut_ptr(),
}
}
}
#[allow(non_snake_case)]
#[no_mangle]
unsafe fn DMA2_CHANNEL5() {
const PRIORITY: u8 = 3u8;
let instant = <rtic::cyccnt::CYCCNT as rtic::Monotonic>::now();
rtic::export::run(PRIORITY, || {
crate::serial_rx_dma(serial_rx_dma::Context::new(
&rtic::export::Priority::new(PRIORITY),
instant,
))
});
}
impl<'a> serial_rx_dmaResources<'a> {
#[inline(always)]
unsafe fn new(priority: &'a rtic::export::Priority) -> Self {
serial_rx_dmaResources {
frame_reader: &mut *frame_reader.as_mut_ptr(),
cell_ingress: &mut *cell_ingress.as_mut_ptr(),
}
}
}
#[allow(non_snake_case)]
#[no_mangle]
unsafe fn EXTI15_10() {
const PRIORITY: u8 = 1u8;
let instant = <rtic::cyccnt::CYCCNT as rtic::Monotonic>::now();
rtic::export::run(PRIORITY, || {
crate::button(button::Context::new(
&rtic::export::Priority::new(PRIORITY),
instant,
))
});
}
impl<'a> buttonResources<'a> {
#[inline(always)]
unsafe fn new(priority: &'a rtic::export::Priority) -> Self {
buttonResources {
btn: &mut *btn.as_mut_ptr(),
led: &mut *led.as_mut_ptr(),
}
}
}
#[doc = r" Queue version of a free-list that keeps track of empty slots in"]
#[doc = r" the following buffers"]
static mut publish_mqtt_S0_FQ: rtic::export::SCFQ<rtic::export::consts::U1> =
rtic::export::Queue(unsafe { rtic::export::iQueue::u8_sc() });
struct publish_mqtt_S0_FQ<'a> {
priority: &'a rtic::export::Priority,
}
impl<'a> rtic::Mutex for publish_mqtt_S0_FQ<'a> {
type T = rtic::export::SCFQ<rtic::export::consts::U1>;
#[inline(always)]
fn lock<R>(
&mut self,
f: impl FnOnce(&mut rtic::export::SCFQ<rtic::export::consts::U1>) -> R,
) -> R {
#[doc = r" Priority ceiling"]
const CEILING: u8 = 1u8;
unsafe {
rtic::export::lock(
&mut publish_mqtt_S0_FQ,
self.priority,
CEILING,
stm32l4xx_hal::pac::NVIC_PRIO_BITS,
f,
)
}
}
}
#[link_section = ".uninit.rtic10"]
#[doc = r" Buffer that holds the instants associated to the inputs of a task"]
static mut publish_mqtt_S0_INSTANTS: [core::mem::MaybeUninit<
<rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
>; 1] = [core::mem::MaybeUninit::uninit()];
#[link_section = ".uninit.rtic11"]
#[doc = r" Buffer that holds the inputs of a task"]
static mut publish_mqtt_S0_INPUTS: [core::mem::MaybeUninit<()>; 1] =
[core::mem::MaybeUninit::uninit()];
impl<'a> publish_mqttResources<'a> {
#[inline(always)]
unsafe fn new(priority: &'a rtic::export::Priority) -> Self {
publish_mqttResources {
mqtt_client: &mut *mqtt_client.as_mut_ptr(),
rtc: resources::rtc::new(priority),
io_1: resources::io_1::new(priority),
}
}
}
#[doc = r" Queue version of a free-list that keeps track of empty slots in"]
#[doc = r" the following buffers"]
static mut sample_io_S0_FQ: rtic::export::SCFQ<rtic::export::consts::U1> =
rtic::export::Queue(unsafe { rtic::export::iQueue::u8_sc() });
struct sample_io_S0_FQ<'a> {
priority: &'a rtic::export::Priority,
}
impl<'a> rtic::Mutex for sample_io_S0_FQ<'a> {
type T = rtic::export::SCFQ<rtic::export::consts::U1>;
#[inline(always)]
fn lock<R>(
&mut self,
f: impl FnOnce(&mut rtic::export::SCFQ<rtic::export::consts::U1>) -> R,
) -> R {
#[doc = r" Priority ceiling"]
const CEILING: u8 = 2u8;
unsafe {
rtic::export::lock(
&mut sample_io_S0_FQ,
self.priority,
CEILING,
stm32l4xx_hal::pac::NVIC_PRIO_BITS,
f,
)
}
}
}
#[link_section = ".uninit.rtic12"]
#[doc = r" Buffer that holds the instants associated to the inputs of a task"]
static mut sample_io_S0_INSTANTS: [core::mem::MaybeUninit<
<rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
>; 1] = [core::mem::MaybeUninit::uninit()];
#[link_section = ".uninit.rtic13"]
#[doc = r" Buffer that holds the inputs of a task"]
static mut sample_io_S0_INPUTS: [core::mem::MaybeUninit<()>; 1] =
[core::mem::MaybeUninit::uninit()];
impl<'a> sample_ioResources<'a> {
#[inline(always)]
unsafe fn new(priority: &'a rtic::export::Priority) -> Self {
sample_ioResources {
io_1: resources::io_1::new(priority),
rtc: &mut *rtc.as_mut_ptr(),
}
}
}
#[doc = r" Queue version of a free-list that keeps track of empty slots in"]
#[doc = r" the following buffers"]
static mut main_task_S0_FQ: rtic::export::SCFQ<rtic::export::consts::U1> =
rtic::export::Queue(unsafe { rtic::export::iQueue::u8_sc() });
#[link_section = ".uninit.rtic14"]
#[doc = r" Buffer that holds the instants associated to the inputs of a task"]
static mut main_task_S0_INSTANTS: [core::mem::MaybeUninit<
<rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
>; 1] = [core::mem::MaybeUninit::uninit()];
#[link_section = ".uninit.rtic15"]
#[doc = r" Buffer that holds the inputs of a task"]
static mut main_task_S0_INPUTS: [core::mem::MaybeUninit<()>; 1] =
[core::mem::MaybeUninit::uninit()];
impl<'a> main_taskResources<'a> {
#[inline(always)]
unsafe fn new(priority: &'a rtic::export::Priority) -> Self {
main_taskResources {
cell_client: &mut *cell_client.as_mut_ptr(),
rtc: resources::rtc::new(priority),
mqtt_event: &mut *mqtt_event.as_mut_ptr(),
mqtt_client: &mut *mqtt_client.as_mut_ptr(),
}
}
}
#[doc = r" Queue version of a free-list that keeps track of empty slots in"]
#[doc = r" the following buffers"]
static mut atat_spin_S0_FQ: rtic::export::SCFQ<rtic::export::consts::U1> =
rtic::export::Queue(unsafe { rtic::export::iQueue::u8_sc() });
struct atat_spin_S0_FQ<'a> {
priority: &'a rtic::export::Priority,
}
impl<'a> rtic::Mutex for atat_spin_S0_FQ<'a> {
type T = rtic::export::SCFQ<rtic::export::consts::U1>;
#[inline(always)]
fn lock<R>(
&mut self,
f: impl FnOnce(&mut rtic::export::SCFQ<rtic::export::consts::U1>) -> R,
) -> R {
#[doc = r" Priority ceiling"]
const CEILING: u8 = 3u8;
unsafe {
rtic::export::lock(
&mut atat_spin_S0_FQ,
self.priority,
CEILING,
stm32l4xx_hal::pac::NVIC_PRIO_BITS,
f,
)
}
}
}
#[link_section = ".uninit.rtic16"]
#[doc = r" Buffer that holds the instants associated to the inputs of a task"]
static mut atat_spin_S0_INSTANTS: [core::mem::MaybeUninit<
<rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
>; 1] = [core::mem::MaybeUninit::uninit()];
#[link_section = ".uninit.rtic17"]
#[doc = r" Buffer that holds the inputs of a task"]
static mut atat_spin_S0_INPUTS: [core::mem::MaybeUninit<()>; 1] =
[core::mem::MaybeUninit::uninit()];
impl<'a> atat_spinResources<'a> {
#[inline(always)]
unsafe fn new(priority: &'a rtic::export::Priority) -> Self {
atat_spinResources {
cell_ingress: resources::cell_ingress::new(priority),
}
}
}
#[doc = r" Queue version of a free-list that keeps track of empty slots in"]
#[doc = r" the following buffers"]
static mut trick_cnt_S0_FQ: rtic::export::SCFQ<rtic::export::consts::U1> =
rtic::export::Queue(unsafe { rtic::export::iQueue::u8_sc() });
struct trick_cnt_S0_FQ<'a> {
priority: &'a rtic::export::Priority,
}
impl<'a> rtic::Mutex for trick_cnt_S0_FQ<'a> {
type T = rtic::export::SCFQ<rtic::export::consts::U1>;
#[inline(always)]
fn lock<R>(
&mut self,
f: impl FnOnce(&mut rtic::export::SCFQ<rtic::export::consts::U1>) -> R,
) -> R {
#[doc = r" Priority ceiling"]
const CEILING: u8 = 4u8;
unsafe {
rtic::export::lock(
&mut trick_cnt_S0_FQ,
self.priority,
CEILING,
stm32l4xx_hal::pac::NVIC_PRIO_BITS,
f,
)
}
}
}
#[link_section = ".uninit.rtic18"]
#[doc = r" Buffer that holds the instants associated to the inputs of a task"]
static mut trick_cnt_S0_INSTANTS: [core::mem::MaybeUninit<
<rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
>; 1] = [core::mem::MaybeUninit::uninit()];
#[link_section = ".uninit.rtic19"]
#[doc = r" Buffer that holds the inputs of a task"]
static mut trick_cnt_S0_INPUTS: [core::mem::MaybeUninit<()>; 1] =
[core::mem::MaybeUninit::uninit()];
impl<'a> trick_cntResources<'a> {
#[inline(always)]
unsafe fn new(priority: &'a rtic::export::Priority) -> Self {
trick_cntResources {
io_1: &mut *io_1.as_mut_ptr(),
}
}
}
#[allow(non_camel_case_types)]
#[doc = "Software tasks spawned from core #0 to be dispatched at priority level 1 by core #0"]
enum R0_P1_S0_T {
main_task,
publish_mqtt,
}
#[automatically_derived]
#[allow(unused_qualifications)]
#[allow(non_camel_case_types)]
impl ::core::clone::Clone for R0_P1_S0_T {
#[inline]
fn clone(&self) -> R0_P1_S0_T {
{
*self
}
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
#[allow(non_camel_case_types)]
impl ::core::marker::Copy for R0_P1_S0_T {}
#[doc = "Queue of tasks sent by core #0 ready to be dispatched by core #0 at priority level 1"]
static mut R0_P1_S0_RQ: rtic::export::SCRQ<R0_P1_S0_T, rtic::export::consts::U2> =
rtic::export::Queue(unsafe { rtic::export::iQueue::u8_sc() });
struct R0_P1_S0_RQ<'a> {
priority: &'a rtic::export::Priority,
}
impl<'a> rtic::Mutex for R0_P1_S0_RQ<'a> {
type T = rtic::export::SCRQ<R0_P1_S0_T, rtic::export::consts::U2>;
#[inline(always)]
fn lock<R>(
&mut self,
f: impl FnOnce(&mut rtic::export::SCRQ<R0_P1_S0_T, rtic::export::consts::U2>) -> R,
) -> R {
#[doc = r" Priority ceiling"]
const CEILING: u8 = 4u8;
unsafe {
rtic::export::lock(
&mut R0_P1_S0_RQ,
self.priority,
CEILING,
stm32l4xx_hal::pac::NVIC_PRIO_BITS,
f,
)
}
}
}
#[allow(non_snake_case)]
#[doc = "Interrupt handler used by core #0 to dispatch tasks at priority 1"]
#[no_mangle]
unsafe fn LCD() {
#[doc = r" The priority of this interrupt handler"]
const PRIORITY: u8 = 1u8;
rtic::export::run(PRIORITY, || {
while let Some((task, index)) = R0_P1_S0_RQ.split().1.dequeue() {
match task {
R0_P1_S0_T::main_task => {
let () = main_task_S0_INPUTS
.get_unchecked(usize::from(index))
.as_ptr()
.read();
let instant = main_task_S0_INSTANTS
.get_unchecked(usize::from(index))
.as_ptr()
.read();
main_task_S0_FQ.split().0.enqueue_unchecked(index);
let priority = &rtic::export::Priority::new(PRIORITY);
crate::main_task(main_task::Context::new(priority, instant))
}
R0_P1_S0_T::publish_mqtt => {
let () = publish_mqtt_S0_INPUTS
.get_unchecked(usize::from(index))
.as_ptr()
.read();
let instant = publish_mqtt_S0_INSTANTS
.get_unchecked(usize::from(index))
.as_ptr()
.read();
publish_mqtt_S0_FQ.split().0.enqueue_unchecked(index);
let priority = &rtic::export::Priority::new(PRIORITY);
crate::publish_mqtt(publish_mqtt::Context::new(priority, instant))
}
}
}
});
}
#[allow(non_camel_case_types)]
#[doc = "Software tasks spawned from core #0 to be dispatched at priority level 2 by core #0"]
enum R0_P2_S0_T {
atat_spin,
sample_io,
}
#[automatically_derived]
#[allow(unused_qualifications)]
#[allow(non_camel_case_types)]
impl ::core::clone::Clone for R0_P2_S0_T {
#[inline]
fn clone(&self) -> R0_P2_S0_T {
{
*self
}
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
#[allow(non_camel_case_types)]
impl ::core::marker::Copy for R0_P2_S0_T {}
#[doc = "Queue of tasks sent by core #0 ready to be dispatched by core #0 at priority level 2"]
static mut R0_P2_S0_RQ: rtic::export::SCRQ<R0_P2_S0_T, rtic::export::consts::U2> =
rtic::export::Queue(unsafe { rtic::export::iQueue::u8_sc() });
struct R0_P2_S0_RQ<'a> {
priority: &'a rtic::export::Priority,
}
impl<'a> rtic::Mutex for R0_P2_S0_RQ<'a> {
type T = rtic::export::SCRQ<R0_P2_S0_T, rtic::export::consts::U2>;
#[inline(always)]
fn lock<R>(
&mut self,
f: impl FnOnce(&mut rtic::export::SCRQ<R0_P2_S0_T, rtic::export::consts::U2>) -> R,
) -> R {
#[doc = r" Priority ceiling"]
const CEILING: u8 = 4u8;
unsafe {
rtic::export::lock(
&mut R0_P2_S0_RQ,
self.priority,
CEILING,
stm32l4xx_hal::pac::NVIC_PRIO_BITS,
f,
)
}
}
}
#[allow(non_snake_case)]
#[doc = "Interrupt handler used by core #0 to dispatch tasks at priority 2"]
#[no_mangle]
unsafe fn SPI1() {
#[doc = r" The priority of this interrupt handler"]
const PRIORITY: u8 = 2u8;
rtic::export::run(PRIORITY, || {
while let Some((task, index)) = R0_P2_S0_RQ.split().1.dequeue() {
match task {
R0_P2_S0_T::atat_spin => {
let () = atat_spin_S0_INPUTS
.get_unchecked(usize::from(index))
.as_ptr()
.read();
let instant = atat_spin_S0_INSTANTS
.get_unchecked(usize::from(index))
.as_ptr()
.read();
atat_spin_S0_FQ.split().0.enqueue_unchecked(index);
let priority = &rtic::export::Priority::new(PRIORITY);
crate::atat_spin(atat_spin::Context::new(priority, instant))
}
R0_P2_S0_T::sample_io => {
let () = sample_io_S0_INPUTS
.get_unchecked(usize::from(index))
.as_ptr()
.read();
let instant = sample_io_S0_INSTANTS
.get_unchecked(usize::from(index))
.as_ptr()
.read();
sample_io_S0_FQ.split().0.enqueue_unchecked(index);
let priority = &rtic::export::Priority::new(PRIORITY);
crate::sample_io(sample_io::Context::new(priority, instant))
}
}
}
});
}
#[allow(non_camel_case_types)]
#[doc = "Software tasks spawned from core #0 to be dispatched at priority level 4 by core #0"]
enum R0_P4_S0_T {
trick_cnt,
}
#[automatically_derived]
#[allow(unused_qualifications)]
#[allow(non_camel_case_types)]
impl ::core::clone::Clone for R0_P4_S0_T {
#[inline]
fn clone(&self) -> R0_P4_S0_T {
{
*self
}
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
#[allow(non_camel_case_types)]
impl ::core::marker::Copy for R0_P4_S0_T {}
#[doc = "Queue of tasks sent by core #0 ready to be dispatched by core #0 at priority level 4"]
static mut R0_P4_S0_RQ: rtic::export::SCRQ<R0_P4_S0_T, rtic::export::consts::U1> =
rtic::export::Queue(unsafe { rtic::export::iQueue::u8_sc() });
struct R0_P4_S0_RQ<'a> {
priority: &'a rtic::export::Priority,
}
impl<'a> rtic::Mutex for R0_P4_S0_RQ<'a> {
type T = rtic::export::SCRQ<R0_P4_S0_T, rtic::export::consts::U1>;
#[inline(always)]
fn lock<R>(
&mut self,
f: impl FnOnce(&mut rtic::export::SCRQ<R0_P4_S0_T, rtic::export::consts::U1>) -> R,
) -> R {
#[doc = r" Priority ceiling"]
const CEILING: u8 = 4u8;
unsafe {
rtic::export::lock(
&mut R0_P4_S0_RQ,
self.priority,
CEILING,
stm32l4xx_hal::pac::NVIC_PRIO_BITS,
f,
)
}
}
}
#[allow(non_snake_case)]
#[doc = "Interrupt handler used by core #0 to dispatch tasks at priority 4"]
#[no_mangle]
unsafe fn UART5() {
#[doc = r" The priority of this interrupt handler"]
const PRIORITY: u8 = 4u8;
rtic::export::run(PRIORITY, || {
while let Some((task, index)) = R0_P4_S0_RQ.split().1.dequeue() {
match task {
R0_P4_S0_T::trick_cnt => {
let () = trick_cnt_S0_INPUTS
.get_unchecked(usize::from(index))
.as_ptr()
.read();
let instant = trick_cnt_S0_INSTANTS
.get_unchecked(usize::from(index))
.as_ptr()
.read();
trick_cnt_S0_FQ.split().0.enqueue_unchecked(index);
let priority = &rtic::export::Priority::new(PRIORITY);
crate::trick_cnt(trick_cnt::Context::new(priority, instant))
}
}
}
});
}
impl init::Spawn {
fn main_task(&self) -> Result<(), ()> {
let instant = unsafe { <rtic::cyccnt::CYCCNT as rtic::Monotonic>::zero() };
unsafe {
use rtic::Mutex as _;
let input = ();
if let Some(index) = main_task_S0_FQ.dequeue() {
main_task_S0_INPUTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(input);
main_task_S0_INSTANTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(instant);
R0_P1_S0_RQ.enqueue_unchecked((R0_P1_S0_T::main_task, index));
rtic::pend(stm32l4xx_hal::pac::Interrupt::LCD);
Ok(())
} else {
Err(input)
}
}
}
fn atat_spin(&self) -> Result<(), ()> {
let instant = unsafe { <rtic::cyccnt::CYCCNT as rtic::Monotonic>::zero() };
unsafe {
use rtic::Mutex as _;
let input = ();
if let Some(index) = atat_spin_S0_FQ.dequeue() {
atat_spin_S0_INPUTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(input);
atat_spin_S0_INSTANTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(instant);
R0_P2_S0_RQ.enqueue_unchecked((R0_P2_S0_T::atat_spin, index));
rtic::pend(stm32l4xx_hal::pac::Interrupt::SPI1);
Ok(())
} else {
Err(input)
}
}
}
fn trick_cnt(&self) -> Result<(), ()> {
let instant = unsafe { <rtic::cyccnt::CYCCNT as rtic::Monotonic>::zero() };
unsafe {
use rtic::Mutex as _;
let input = ();
if let Some(index) = trick_cnt_S0_FQ.dequeue() {
trick_cnt_S0_INPUTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(input);
trick_cnt_S0_INSTANTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(instant);
R0_P4_S0_RQ.enqueue_unchecked((R0_P4_S0_T::trick_cnt, index));
rtic::pend(stm32l4xx_hal::pac::Interrupt::UART5);
Ok(())
} else {
Err(input)
}
}
}
}
unsafe fn spawn_atat_spin_S0(
priority: &rtic::export::Priority,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Result<(), ()> {
unsafe {
use rtic::Mutex as _;
let input = ();
if let Some(index) = (atat_spin_S0_FQ { priority }.lock(|fq| fq.split().1.dequeue())) {
atat_spin_S0_INPUTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(input);
atat_spin_S0_INSTANTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(instant);
(R0_P2_S0_RQ { priority }.lock(|rq| {
rq.split()
.0
.enqueue_unchecked((R0_P2_S0_T::atat_spin, index))
}));
rtic::pend(stm32l4xx_hal::pac::Interrupt::SPI1);
Ok(())
} else {
Err(input)
}
}
}
impl<'a> serial_isr::Spawn<'a> {
#[inline(always)]
fn atat_spin(&self) -> Result<(), ()> {
unsafe {
let instant = self.instant();
spawn_atat_spin_S0(self.priority(), instant)
}
}
}
impl<'a> serial_rx_dma::Spawn<'a> {
#[inline(always)]
fn atat_spin(&self) -> Result<(), ()> {
unsafe {
let instant = self.instant();
spawn_atat_spin_S0(self.priority(), instant)
}
}
}
unsafe fn spawn_sample_io_S0(
priority: &rtic::export::Priority,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Result<(), ()> {
unsafe {
use rtic::Mutex as _;
let input = ();
if let Some(index) = (sample_io_S0_FQ { priority }.lock(|fq| fq.split().1.dequeue())) {
sample_io_S0_INPUTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(input);
sample_io_S0_INSTANTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(instant);
(R0_P2_S0_RQ { priority }.lock(|rq| {
rq.split()
.0
.enqueue_unchecked((R0_P2_S0_T::sample_io, index))
}));
rtic::pend(stm32l4xx_hal::pac::Interrupt::SPI1);
Ok(())
} else {
Err(input)
}
}
}
unsafe fn spawn_publish_mqtt_S0(
priority: &rtic::export::Priority,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Result<(), ()> {
unsafe {
use rtic::Mutex as _;
let input = ();
if let Some(index) = (publish_mqtt_S0_FQ { priority }.lock(|fq| fq.split().1.dequeue()))
{
publish_mqtt_S0_INPUTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(input);
publish_mqtt_S0_INSTANTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(instant);
(R0_P1_S0_RQ { priority }.lock(|rq| {
rq.split()
.0
.enqueue_unchecked((R0_P1_S0_T::publish_mqtt, index))
}));
rtic::pend(stm32l4xx_hal::pac::Interrupt::LCD);
Ok(())
} else {
Err(input)
}
}
}
impl<'a> main_task::Spawn<'a> {
#[inline(always)]
fn sample_io(&self) -> Result<(), ()> {
unsafe {
let instant = self.instant();
spawn_sample_io_S0(self.priority(), instant)
}
}
#[inline(always)]
fn publish_mqtt(&self) -> Result<(), ()> {
unsafe {
let instant = self.instant();
spawn_publish_mqtt_S0(self.priority(), instant)
}
}
}
#[doc = "Tasks that can be scheduled from core #0"]
#[allow(non_camel_case_types)]
enum T0 {
atat_spin,
publish_mqtt,
sample_io,
trick_cnt,
}
#[automatically_derived]
#[allow(unused_qualifications)]
#[allow(non_camel_case_types)]
impl ::core::clone::Clone for T0 {
#[inline]
fn clone(&self) -> T0 {
{
*self
}
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
#[allow(non_camel_case_types)]
impl ::core::marker::Copy for T0 {}
#[doc = "Core #0 timer queue"]
static mut TQ0: rtic::export::TimerQueue<rtic::cyccnt::CYCCNT, T0, rtic::export::consts::U4> =
rtic::export::TimerQueue(rtic::export::BinaryHeap(rtic::export::iBinaryHeap::new()));
struct TQ0<'a> {
priority: &'a rtic::export::Priority,
}
impl<'a> rtic::Mutex for TQ0<'a> {
type T = rtic::export::TimerQueue<rtic::cyccnt::CYCCNT, T0, rtic::export::consts::U4>;
#[inline(always)]
fn lock<R>(
&mut self,
f: impl FnOnce(
&mut rtic::export::TimerQueue<rtic::cyccnt::CYCCNT, T0, rtic::export::consts::U4>,
) -> R,
) -> R {
#[doc = r" Priority ceiling"]
const CEILING: u8 = 4u8;
unsafe {
rtic::export::lock(
&mut TQ0,
self.priority,
CEILING,
stm32l4xx_hal::pac::NVIC_PRIO_BITS,
f,
)
}
}
}
#[no_mangle]
unsafe fn SysTick() {
use rtic::Mutex as _;
#[doc = r" The priority of this handler"]
const PRIORITY: u8 = 4u8;
rtic::export::run(PRIORITY, || {
while let Some((task, index)) = (TQ0 {
priority: &rtic::export::Priority::new(PRIORITY),
})
.lock(
#[inline(always)]
|tq| tq.dequeue(),
) {
match task {
T0::atat_spin => {
(R0_P2_S0_RQ {
priority: &rtic::export::Priority::new(PRIORITY),
})
.lock(|rq| {
rq.split()
.0
.enqueue_unchecked((R0_P2_S0_T::atat_spin, index))
});
rtic::pend(stm32l4xx_hal::pac::Interrupt::SPI1);
}
T0::publish_mqtt => {
(R0_P1_S0_RQ {
priority: &rtic::export::Priority::new(PRIORITY),
})
.lock(|rq| {
rq.split()
.0
.enqueue_unchecked((R0_P1_S0_T::publish_mqtt, index))
});
rtic::pend(stm32l4xx_hal::pac::Interrupt::LCD);
}
T0::sample_io => {
(R0_P2_S0_RQ {
priority: &rtic::export::Priority::new(PRIORITY),
})
.lock(|rq| {
rq.split()
.0
.enqueue_unchecked((R0_P2_S0_T::sample_io, index))
});
rtic::pend(stm32l4xx_hal::pac::Interrupt::SPI1);
}
T0::trick_cnt => {
(R0_P4_S0_RQ {
priority: &rtic::export::Priority::new(PRIORITY),
})
.lock(|rq| {
rq.split()
.0
.enqueue_unchecked((R0_P4_S0_T::trick_cnt, index))
});
rtic::pend(stm32l4xx_hal::pac::Interrupt::UART5);
}
}
}
});
}
unsafe fn schedule_publish_mqtt_S0(
priority: &rtic::export::Priority,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Result<(), ()> {
unsafe {
use rtic::Mutex as _;
let input = ();
if let Some(index) = (publish_mqtt_S0_FQ { priority }).lock(|fq| fq.split().1.dequeue())
{
publish_mqtt_S0_INPUTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(input);
publish_mqtt_S0_INSTANTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(instant);
let nr = rtic::export::NotReady {
instant,
index,
task: T0::publish_mqtt,
};
(TQ0 { priority }).lock(|tq| tq.enqueue_unchecked(nr));
Ok(())
} else {
Err(input)
}
}
}
impl<'a> publish_mqtt::Schedule<'a> {
#[inline(always)]
fn publish_mqtt(
&self,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Result<(), ()> {
unsafe { schedule_publish_mqtt_S0(self.priority(), instant) }
}
}
unsafe fn schedule_sample_io_S0(
priority: &rtic::export::Priority,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Result<(), ()> {
unsafe {
use rtic::Mutex as _;
let input = ();
if let Some(index) = (sample_io_S0_FQ { priority }).lock(|fq| fq.split().1.dequeue()) {
sample_io_S0_INPUTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(input);
sample_io_S0_INSTANTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(instant);
let nr = rtic::export::NotReady {
instant,
index,
task: T0::sample_io,
};
(TQ0 { priority }).lock(|tq| tq.enqueue_unchecked(nr));
Ok(())
} else {
Err(input)
}
}
}
impl<'a> sample_io::Schedule<'a> {
#[inline(always)]
fn sample_io(
&self,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Result<(), ()> {
unsafe { schedule_sample_io_S0(self.priority(), instant) }
}
}
unsafe fn schedule_atat_spin_S0(
priority: &rtic::export::Priority,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Result<(), ()> {
unsafe {
use rtic::Mutex as _;
let input = ();
if let Some(index) = (atat_spin_S0_FQ { priority }).lock(|fq| fq.split().1.dequeue()) {
atat_spin_S0_INPUTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(input);
atat_spin_S0_INSTANTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(instant);
let nr = rtic::export::NotReady {
instant,
index,
task: T0::atat_spin,
};
(TQ0 { priority }).lock(|tq| tq.enqueue_unchecked(nr));
Ok(())
} else {
Err(input)
}
}
}
impl<'a> atat_spin::Schedule<'a> {
#[inline(always)]
fn atat_spin(
&self,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Result<(), ()> {
unsafe { schedule_atat_spin_S0(self.priority(), instant) }
}
}
unsafe fn schedule_trick_cnt_S0(
priority: &rtic::export::Priority,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Result<(), ()> {
unsafe {
use rtic::Mutex as _;
let input = ();
if let Some(index) = (trick_cnt_S0_FQ { priority }).lock(|fq| fq.split().1.dequeue()) {
trick_cnt_S0_INPUTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(input);
trick_cnt_S0_INSTANTS
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(instant);
let nr = rtic::export::NotReady {
instant,
index,
task: T0::trick_cnt,
};
(TQ0 { priority }).lock(|tq| tq.enqueue_unchecked(nr));
Ok(())
} else {
Err(input)
}
}
}
impl<'a> trick_cnt::Schedule<'a> {
#[inline(always)]
fn trick_cnt(
&self,
instant: <rtic::cyccnt::CYCCNT as rtic::Monotonic>::Instant,
) -> Result<(), ()> {
unsafe { schedule_trick_cnt_S0(self.priority(), instant) }
}
}
#[no_mangle]
unsafe extern "C" fn main() -> ! {
let _TODO: () = ();
rtic::export::assert_send::<Rx<UART4>>();
rtic::export::assert_send::<atat::IngressManager<AtatRxBufLen, NvicUrcMatcher<Interrupt>>>(
);
rtic::export::assert_send::<FrameReader<Box<SerialDmaPool>, dma::dma2::C5, consts::U32>>();
rtic::export::assert_send::<GsmType>();
rtic::export::assert_send::<
MqttClient<'static, 'static, MqttQueueLen, factbird_lib::buffer::MqttPayload>,
>();
rtic::export::assert_send::<
MqttEvent<
'static,
'static,
MqttQueueLen,
GsmType,
bsp::MqttPingTimer,
factbird_lib::buffer::MqttPayload,
>,
>();
rtic::export::assert_send::<bsp::IO1>();
rtic::export::assert_send::<bsp::RGB>();
rtic::export::assert_send::<bsp::Btn>();
rtic::export::assert_send::<Rtc>();
rtic::export::interrupt::disable();
(0..1u8).for_each(|i| main_task_S0_FQ.enqueue_unchecked(i));
(0..1u8).for_each(|i| atat_spin_S0_FQ.enqueue_unchecked(i));
(0..1u8).for_each(|i| trick_cnt_S0_FQ.enqueue_unchecked(i));
(0..1u8).for_each(|i| sample_io_S0_FQ.enqueue_unchecked(i));
(0..1u8).for_each(|i| publish_mqtt_S0_FQ.enqueue_unchecked(i));
let mut core: rtic::export::Peripherals = core::mem::transmute(());
let _ = [(); ((1 << stm32l4xx_hal::pac::NVIC_PRIO_BITS) - 1u8 as usize)];
core.NVIC.set_priority(
stm32l4xx_hal::pac::Interrupt::LCD,
rtic::export::logical2hw(1u8, stm32l4xx_hal::pac::NVIC_PRIO_BITS),
);
rtic::export::NVIC::unmask(stm32l4xx_hal::pac::Interrupt::LCD);
let _ = [(); ((1 << stm32l4xx_hal::pac::NVIC_PRIO_BITS) - 2u8 as usize)];
core.NVIC.set_priority(
stm32l4xx_hal::pac::Interrupt::SPI1,
rtic::export::logical2hw(2u8, stm32l4xx_hal::pac::NVIC_PRIO_BITS),
);
rtic::export::NVIC::unmask(stm32l4xx_hal::pac::Interrupt::SPI1);
let _ = [(); ((1 << stm32l4xx_hal::pac::NVIC_PRIO_BITS) - 4u8 as usize)];
core.NVIC.set_priority(
stm32l4xx_hal::pac::Interrupt::UART5,
rtic::export::logical2hw(4u8, stm32l4xx_hal::pac::NVIC_PRIO_BITS),
);
rtic::export::NVIC::unmask(stm32l4xx_hal::pac::Interrupt::UART5);
let _ = [(); ((1 << stm32l4xx_hal::pac::NVIC_PRIO_BITS) - 3u8 as usize)];
core.NVIC.set_priority(
stm32l4xx_hal::pac::Interrupt::UART4,
rtic::export::logical2hw(3u8, stm32l4xx_hal::pac::NVIC_PRIO_BITS),
);
rtic::export::NVIC::unmask(stm32l4xx_hal::pac::Interrupt::UART4);
let _ = [(); ((1 << stm32l4xx_hal::pac::NVIC_PRIO_BITS) - 3u8 as usize)];
core.NVIC.set_priority(
stm32l4xx_hal::pac::Interrupt::DMA2_CHANNEL5,
rtic::export::logical2hw(3u8, stm32l4xx_hal::pac::NVIC_PRIO_BITS),
);
rtic::export::NVIC::unmask(stm32l4xx_hal::pac::Interrupt::DMA2_CHANNEL5);
let _ = [(); ((1 << stm32l4xx_hal::pac::NVIC_PRIO_BITS) - 1u8 as usize)];
core.NVIC.set_priority(
stm32l4xx_hal::pac::Interrupt::EXTI15_10,
rtic::export::logical2hw(1u8, stm32l4xx_hal::pac::NVIC_PRIO_BITS),
);
rtic::export::NVIC::unmask(stm32l4xx_hal::pac::Interrupt::EXTI15_10);
let _ = [(); ((1 << stm32l4xx_hal::pac::NVIC_PRIO_BITS) - 4u8 as usize)];
core.SCB.set_priority(
rtic::export::SystemHandler::SysTick,
rtic::export::logical2hw(4u8, stm32l4xx_hal::pac::NVIC_PRIO_BITS),
);
core.SYST
.set_clock_source(rtic::export::SystClkSource::Core);
core.SYST.enable_counter();
core.DCB.enable_trace();
let late = crate::init(init::Locals::new(), init::Context::new(core.into()));
btn.as_mut_ptr().write(late.btn);
cell_client.as_mut_ptr().write(late.cell_client);
cell_ingress.as_mut_ptr().write(late.cell_ingress);
cell_rx.as_mut_ptr().write(late.cell_rx);
frame_reader.as_mut_ptr().write(late.frame_reader);
io_1.as_mut_ptr().write(late.io_1);
led.as_mut_ptr().write(late.led);
mqtt_client.as_mut_ptr().write(late.mqtt_client);
mqtt_event.as_mut_ptr().write(late.mqtt_event);
rtc.as_mut_ptr().write(late.rtc);
<rtic::cyccnt::CYCCNT as rtic::Monotonic>::reset();
rtic::export::interrupt::enable();
crate::idle(idle::Context::new(&rtic::export::Priority::new(0)))
}
};
#[panic_handler]
fn panic(info: &core::panic::PanicInfo) -> ! {
{
let lvl = ::log::Level::Error;
if lvl <= ::log::STATIC_MAX_LEVEL && lvl <= ::log::max_level() {
::log::__private_api_log(
::core::fmt::Arguments::new_v1(
&["Panic: "],
&match (&info,) {
(arg0,) => [::core::fmt::ArgumentV1::new(
arg0,
::core::fmt::Display::fmt,
)],
},
),
lvl,
&(
"factbird_rs",
"factbird_rs",
"factbird-rs/src/main.rs",
556u32,
),
);
}
};
loop {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment