Skip to content

Commit f45eec9

Browse files
authored
Merge pull request #2 from allexoll/main
published 0.1.0
2 parents 15cbf3c + 6e4f86d commit f45eec9

File tree

5 files changed

+25
-16
lines changed

5 files changed

+25
-16
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ Cargo.lock
88

99
# These are backup files generated by rustfmt
1010
**/*.rs.bk
11+
12+
/.vscode

Cargo.toml

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ authors = ["Alexis Marquet <[email protected]>"]
44
name = "lpc546xx-hal"
55
categories = ["embedded", "hardware-support", "no-std"]
66
description = "Peripheral access API for LPC546xx series microcontrollers"
7-
documentation = "https::/docs.rs/crate/lpc546-hal"
7+
documentation = "https://docs.rs/crate/lpc546xx-hal"
88

99
keywords = ["arm", "cortex-m", "lpc546xx", "hal"]
1010
license = "0BSD"
@@ -13,6 +13,10 @@ repository = "https://github.com/lpc-rs/lpc546xx-hal"
1313
version = "0.1.0"
1414

1515

16+
[package.metadata.docs.rs]
17+
features = ["mcu-LPC54628J512ET180", "rt"]
18+
targets = ["thumbv7em-none-eabihf"]
19+
1620
[workspace]
1721
members = ["self-tests"]
1822

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# lpc546xx-hal
1+
> PR welcome!
2+
3+
# lpc546xx-hal [![crates.io](https://img.shields.io/crates/v/lpc546xx-hal.svg)](https://crates.io/crates/lpc546xx-hal) [![Documentation](https://docs.rs/lpc546xx-hal/badge.svg)](https://docs.rs/lpc546xx-hal)
24

35
Hardware Abstraction Layer crate for the lpc546xx family.
46

src/gpio.rs

+4-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! GeneralPurpose Input / Output
2-
//!
2+
//!
3+
//! Some GPIO are missing as of now because IOCON type `A` and type `I` are
4+
//! not yet implemented
35
46
use crate::syscon::Syscon;
57
use core::marker::PhantomData;
@@ -25,7 +27,7 @@ pub struct Floating;
2527
/// pulled down input (type state)
2628
pub struct PullDown;
2729

28-
// Pulled up input (type state)
30+
/// Pulled up input (type state)
2931
pub struct PullUp;
3032

3133
/// Open Drain input or output (type state)
@@ -146,18 +148,7 @@ pub enum IoType {
146148
TYPEI = 1,
147149
TYPEA = 2,
148150
}
149-
/*
150-
macro_rules! gpio {
151-
(
152-
$PX:ident, $Portn:expr,
153-
[
154-
$(
155-
$PX_X:ident: ($pioX_X:ident, $ioconpioX_Xreg:ident, $Pinn:expr, $MODE:ty),
156-
)+
157-
]
158-
) => {
159151

160-
*/
161152
macro_rules! gpio {
162153
($GPIO:ident,
163154
[

src/syscon.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//! System configuration
2+
//!
3+
//!
4+
//!
15
use crate::pac::*;
26
use embedded_time::rate::{Extensions, Hertz};
37

@@ -50,6 +54,9 @@ impl Syscon {
5054
pub fn part_id(&self) -> u32 {
5155
self.rb.device_id0.read().partid().bits()
5256
}
57+
pub fn get_main_clock_freq(self) -> Hertz {
58+
self.clocks.main_clk
59+
}
5360
}
5461
/// The main API for the SYSCON peripheral
5562
impl Syscon {
@@ -81,7 +88,7 @@ impl Syscon {
8188
/// implemented nor used outside of LPC82x HAL. Any changes to this trait won't
8289
/// be considered breaking changes.
8390
///
84-
/// Compared to https://git.io/fjpf9 (in lpc-rs/lpc8xx-hal/lpc8xx-hal-common)
91+
/// Compared to <https://git.io/fjpf9> (in lpc-rs/lpc8xx-hal/lpc8xx-hal-common)
8592
/// we use a less minimal API in order to hide the fact that there are three
8693
/// different AHLBCKLCTRL?, which a HAL user shouldn't really need to know about.
8794
pub trait ClockControl {
@@ -300,6 +307,7 @@ impl SysconExt for SYSCON {
300307
/// Frozen clock frequencies
301308
///
302309
/// The existence of this value indicates that the clock configuration can no longer be changed
310+
#[allow(dead_code)]
303311
#[derive(Clone, Copy)]
304312
pub struct Clocks {
305313
source: MainClkSelA,
@@ -312,6 +320,8 @@ impl Clocks {
312320
&self.source
313321
}
314322
}
323+
324+
#[allow(dead_code)]
315325
pub struct Config {
316326
mainclksela: MainClkSelA,
317327
mainclkselb: MainClkSelB,

0 commit comments

Comments
 (0)