Skip to content

Commit

Permalink
refactor: remove the types module
Browse files Browse the repository at this point in the history
  • Loading branch information
cyril-marpaud committed Feb 16, 2024
1 parent a07879f commit 38cbd5b
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/types/chip.rs → src/chip.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub mod family;
pub mod target;

use crate::types::error::{Error, InvalidChip};
use crate::error::{Error, InvalidChip};
use std::str::FromStr;

pub(crate) struct Chip {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[derive(Clone, Debug)]
pub(crate) struct MemRegion {
pub struct MemRegion {
pub flash_origin: usize,
pub flash_length: usize,

Expand All @@ -8,38 +8,38 @@ pub(crate) struct MemRegion {
}

impl MemRegion {
pub(crate) const NRF52805: Self = Self {
pub const NRF52805: Self = Self {
flash_origin: 0,
flash_length: 192,
ram_origin: 0x2 << 28,
ram_length: 24,
};
pub(crate) const NRF52810: Self = Self::NRF52805;
pub(crate) const NRF52811: Self = Self::NRF52805;
pub const NRF52810: Self = Self::NRF52805;
pub const NRF52811: Self = Self::NRF52805;

pub(crate) const NRF52820: Self = Self {
pub const NRF52820: Self = Self {
flash_origin: 0,
flash_length: 256,
ram_origin: 0x2 << 28,
ram_length: 32,
};

pub(crate) const NRF52832_XXAA: Self = Self {
pub const NRF52832_XXAA: Self = Self {
flash_origin: 0,
flash_length: 512,
ram_origin: 0x2 << 28,
ram_length: 64,
};
pub(crate) const NRF52832_XXAB: Self = Self::NRF52820;
pub const NRF52832_XXAB: Self = Self::NRF52820;

pub(crate) const NRF52833: Self = Self {
pub const NRF52833: Self = Self {
flash_origin: 0,
flash_length: 512,
ram_origin: 0x2 << 28,
ram_length: 128,
};

pub(crate) const NRF52840: Self = Self {
pub const NRF52840: Self = Self {
flash_origin: 0,
flash_length: 1024,
ram_origin: 0x2 << 28,
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/init.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::types::{
use crate::{
chip::{
family::{mem_region::MemRegion, Family},
target::Target,
Chip,
},
error::{Error, InvalidChip},
init_args::{panic_handler::PanicHandler, soft_device::Softdevice, InitArgs},
parser::init_args::{panic_handler::PanicHandler, soft_device::Softdevice, InitArgs},
};
use indicatif::ProgressBar;
use inflector::cases::snakecase::to_snake_case;
Expand Down
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
pub mod chip;
pub mod error;
mod init;
mod types;
pub mod parser;

use clap::Parser;
use init::Init;
use types::parser::{Cargo, EmbassyCommand};
use parser::{Cargo, EmbassyCommand};

fn main() {
let Cargo::Embassy(embassy) = Cargo::parse();
Expand Down
4 changes: 3 additions & 1 deletion src/types/parser.rs → src/parser.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use crate::types::init_args::InitArgs;
pub mod init_args;

use clap::{Args, Parser, Subcommand};
use init_args::InitArgs;

#[derive(Parser)]
#[command(name = "cargo")]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions src/types.rs

This file was deleted.

0 comments on commit 38cbd5b

Please sign in to comment.