actual last commit til after christmas. rust + macros + workspaces = disaster... Moved igloo util into its own workspace member (subcrate?) rust building and dependencies are kinda a disaster.
parent
912812a37a
commit
ff5a3535db
@ -1 +0,0 @@
|
||||
penguin@gpenguin.2954:1640039390
|
@ -1,41 +0,0 @@
|
||||
use crate::IglooStatus::{self, *};
|
||||
use crate::IglooType::{self, *};
|
||||
use crate::IglooDebugSeverity::{self, *};
|
||||
pub static TRACE_LEVEL: IglooDebugSeverity = TRACE;
|
||||
|
||||
macro_rules! igloo_debug
|
||||
{
|
||||
($severity:expr, $status:expr) =>
|
||||
{
|
||||
if cfg!(debug_assertions)
|
||||
{
|
||||
if $severity as u8 <= TRACE_LEVEL.clone() as u8
|
||||
{
|
||||
println!("[{:?}]: Line {:?} in {:?} | {:?}",
|
||||
$severity,
|
||||
line!(),
|
||||
file!(),
|
||||
$status);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
($severity:expr, $status:expr, $($message:tt)*) =>
|
||||
{
|
||||
if cfg!(debug_assertions)
|
||||
{
|
||||
if $severity as u8 <= TRACE_LEVEL.clone() as u8
|
||||
{
|
||||
println!("[{:?}]: Line {:?} in {} | {} -- STATUS: {:?}",
|
||||
$severity,
|
||||
line!(),
|
||||
file!(),
|
||||
format_args!($($message)*),
|
||||
$status
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
pub(crate) use igloo_debug;
|
@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "igloo_util"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
@ -0,0 +1,101 @@
|
||||
#![allow(non_snake_case)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = 2 + 2;
|
||||
assert_eq!(result, 4);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(PartialEq)]
|
||||
/// * IT_NEW: Create a new igloo project
|
||||
/// * IT_RUN: build the project if needed, then run the project, defaults to default target set in your project's profile
|
||||
/// * IT_PUSH: build the project if needed, then upload your binary to your target
|
||||
/// * IT_PULL: extracts binary from mcu (if possible) and saves it
|
||||
/// * IT_HELP: gets help
|
||||
/// * IT_BUILD: builds the project for all targets unless otherwise specified
|
||||
/// * IT_ERASE: erases the flash for the specified target
|
||||
/// * IT_INFO: Gets information about igloo and your project.
|
||||
/// * IT_NULL: Default type... used for debugging and development. More on this later
|
||||
/// * IT_DEBUG: this state is useful for debugging project failures. Only to be used in debug build of igloo. More on this later
|
||||
pub enum IglooType
|
||||
{
|
||||
IT_NEW = 0,
|
||||
IT_RUN,
|
||||
IT_PUSH,
|
||||
IT_PULL,
|
||||
IT_HELP,
|
||||
IT_BUILD,
|
||||
IT_ERASE,
|
||||
IT_INFO,
|
||||
IT_TARGET,
|
||||
IT_NULL,
|
||||
IT_DEBUG,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub enum IglooDebugSeverity
|
||||
{
|
||||
ERROR = 0,
|
||||
WARNING = 1,
|
||||
LOG = 2,
|
||||
TRACE = 3,
|
||||
INFO = 4,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(PartialEq)]
|
||||
pub enum IglooStatus
|
||||
{
|
||||
IS_GOOD = 0x00,
|
||||
IS_BAD = 0x01,
|
||||
IS_UNKNOWN = 0x02,
|
||||
IS_FAILED_TO_LOAD_MTM = 0x03,
|
||||
IS_NEW_CALLED_IN_EXISTING_PRJ = 0x04,
|
||||
IS_NEW_DIR_ALREADY_EXISTS = 0x05,
|
||||
IS_FAILED_TO_CREATE_PRJ_CFG_FILE = 0x06,
|
||||
IS_FAILED_TO_CREATE_DIR = 0x07,
|
||||
IS_NONE = 0xFF,
|
||||
}
|
||||
|
||||
pub static TRACE_LEVEL: IglooDebugSeverity = IglooDebugSeverity::TRACE;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! igloo_debug
|
||||
{
|
||||
($severity:expr, $status:expr) =>
|
||||
{
|
||||
if cfg!(debug_assertions)
|
||||
{
|
||||
if $severity as u8 <= TRACE_LEVEL.clone() as u8
|
||||
{
|
||||
println!("[{:?}]: Line {:?} in {:?} | {:?}",
|
||||
$severity,
|
||||
line!(),
|
||||
file!(),
|
||||
$status);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
($severity:expr, $status:expr, $($message:tt)*) =>
|
||||
{
|
||||
if cfg!(debug_assertions)
|
||||
{
|
||||
if $severity as u8 <= TRACE_LEVEL.clone() as u8
|
||||
{
|
||||
println!("[{:?}]: Line {:?} in {} | {} -- STATUS: {:?}",
|
||||
$severity,
|
||||
line!(),
|
||||
file!(),
|
||||
format_args!($($message)*),
|
||||
$status
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue