Skip to content

Commit

Permalink
Ensure all structs are consistently CamelCased
Browse files Browse the repository at this point in the history
  • Loading branch information
MabezDev committed Apr 18, 2024
1 parent be06c57 commit 53dc6be
Show file tree
Hide file tree
Showing 80 changed files with 219 additions and 272 deletions.
2 changes: 1 addition & 1 deletion esp-hal-smartled/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! ## Example
//!
//! ```rust,ignore
//! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
//! let rmt = Rmt::new(peripherals.RMT, 80.MHz(), &clocks).unwrap();
//!
//! let rmt_buffer = smartLedBuffer!(1);
Expand Down
10 changes: 5 additions & 5 deletions esp-hal/src/analog/adc/esp32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ impl RegisterAccess for ADC2 {
}

/// Analog-to-Digital Converter peripheral driver.
pub struct ADC<'d, ADC> {
pub struct Adc<'d, ADC> {
_adc: PeripheralRef<'d, ADC>,
attenuations: [Option<Attenuation>; NUM_ATTENS],
active_channel: Option<u8>,
}

impl<'d, ADCI> ADC<'d, ADCI>
impl<'d, ADCI> Adc<'d, ADCI>
where
ADCI: RegisterAccess,
{
Expand Down Expand Up @@ -270,7 +270,7 @@ where
.sar_read_ctrl2()
.modify(|_, w| w.sar2_data_inv().set_bit());

ADC {
Adc {
_adc: adc_instance.into_ref(),
attenuations: config.attenuations,
active_channel: None,
Expand Down Expand Up @@ -323,7 +323,7 @@ where
}
}

impl<'d, ADC1> ADC<'d, ADC1> {
impl<'d, ADC1> Adc<'d, ADC1> {
pub fn enable_hall_sensor() {
// Connect hall sensor
unsafe { &*RTC_IO::ptr() }
Expand All @@ -341,7 +341,7 @@ impl<'d, ADC1> ADC<'d, ADC1> {

#[cfg(feature = "embedded-hal-02")]
impl<'d, ADCI, PIN> embedded_hal_02::adc::OneShot<ADCI, u16, super::AdcPin<PIN, ADCI>>
for ADC<'d, ADCI>
for Adc<'d, ADCI>
where
PIN: embedded_hal_02::adc::Channel<ADCI, ID = u8> + super::AdcChannel,
ADCI: RegisterAccess,
Expand Down
8 changes: 4 additions & 4 deletions esp-hal/src/analog/adc/riscv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,13 +397,13 @@ impl super::CalibrationAccess for crate::peripherals::ADC2 {
}

/// Analog-to-Digital Converter peripheral driver.
pub struct ADC<'d, ADCI> {
pub struct Adc<'d, ADCI> {
_adc: PeripheralRef<'d, ADCI>,
attenuations: [Option<Attenuation>; NUM_ATTENS],
active_channel: Option<u8>,
}

impl<'d, ADCI> ADC<'d, ADCI>
impl<'d, ADCI> Adc<'d, ADCI>
where
ADCI: RegisterAccess + 'd,
{
Expand All @@ -426,7 +426,7 @@ where
.bits(0b11)
});

ADC {
Adc {
_adc: adc_instance.into_ref(),
attenuations: config.attenuations,
active_channel: None,
Expand Down Expand Up @@ -540,7 +540,7 @@ impl super::AdcCalEfuse for crate::peripherals::ADC2 {

#[cfg(feature = "embedded-hal-02")]
impl<'d, ADCI, PIN, CS> embedded_hal_02::adc::OneShot<ADCI, u16, super::AdcPin<PIN, ADCI, CS>>
for ADC<'d, ADCI>
for Adc<'d, ADCI>
where
PIN: embedded_hal_02::adc::Channel<ADCI, ID = u8> + super::AdcChannel,
ADCI: RegisterAccess,
Expand Down
8 changes: 4 additions & 4 deletions esp-hal/src/analog/adc/xtensa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,13 @@ impl super::CalibrationAccess for crate::peripherals::ADC2 {
}

/// Analog-to-Digital Converter peripheral driver.
pub struct ADC<'d, ADC> {
pub struct Adc<'d, ADC> {
_adc: PeripheralRef<'d, ADC>,
active_channel: Option<u8>,
last_init_code: u16,
}

impl<'d, ADCI> ADC<'d, ADCI>
impl<'d, ADCI> Adc<'d, ADCI>
where
ADCI: RegisterAccess,
{
Expand Down Expand Up @@ -481,7 +481,7 @@ where
.sar_amp_ctrl2()
.modify(|_, w| unsafe { w.sar_amp_wait3().bits(1) });

ADC {
Adc {
_adc: adc_instance.into_ref(),
active_channel: None,
last_init_code: 0,
Expand Down Expand Up @@ -605,7 +605,7 @@ impl super::AdcCalEfuse for crate::peripherals::ADC2 {

#[cfg(feature = "embedded-hal-02")]
impl<'d, ADCI, PIN, CS> embedded_hal_02::adc::OneShot<ADCI, u16, AdcPin<PIN, ADCI, CS>>
for ADC<'d, ADCI>
for Adc<'d, ADCI>
where
PIN: embedded_hal_02::adc::Channel<ADCI, ID = u8> + AdcChannel,
ADCI: RegisterAccess,
Expand Down
14 changes: 7 additions & 7 deletions esp-hal/src/analog/dac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
//! ## Example
//!
//! ```no_run
//! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
//! let gpio25 = io.pins.gpio25.into_analog();
//! let gpio26 = io.pins.gpio26.into_analog();
//!
//! let mut dac1 = DAC1::new(peripherals.DAC1, gpio25);
//! let mut dac2 = DAC2::new(peripherals.DAC2, gpio26);
//! let mut dac1 = Dac1::new(peripherals.DAC1, gpio25);
//! let mut dac2 = Dac2::new(peripherals.DAC2, gpio26);
//!
//! let mut delay = Delay::new(&clocks);
//!
Expand Down Expand Up @@ -53,11 +53,11 @@ cfg_if::cfg_if! {
}

/// Digital-to-Analog Converter (DAC) Channel 1
pub struct DAC1<'d> {
pub struct Dac1<'d> {
_inner: PeripheralRef<'d, peripherals::DAC1>,
}

impl<'d> DAC1<'d> {
impl<'d> Dac1<'d> {
/// Constructs a new DAC instance.
pub fn new(dac: impl Peripheral<P = peripherals::DAC1> + 'd, _pin: Dac1Gpio) -> Self {
crate::into_ref!(dac);
Expand Down Expand Up @@ -90,11 +90,11 @@ impl<'d> DAC1<'d> {
}

/// Digital-to-Analog Converter (DAC) Channel 2
pub struct DAC2<'d> {
pub struct Dac2<'d> {
_inner: PeripheralRef<'d, peripherals::DAC2>,
}

impl<'d> DAC2<'d> {
impl<'d> Dac2<'d> {
/// Constructs a new DAC instance.
pub fn new(dac: impl Peripheral<P = peripherals::DAC2> + 'd, _pin: Dac2Gpio) -> Self {
crate::into_ref!(dac);
Expand Down
2 changes: 1 addition & 1 deletion esp-hal/src/embassy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
//! #[cfg(feature = "embassy-time-timg0")]
//! embassy::init(&clocks, timer_group0.timer0);
//!
//! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
//! // GPIO 9 as input
//! let input = io.pins.gpio9.into_pull_down_input();
//!
Expand Down
2 changes: 1 addition & 1 deletion esp-hal/src/etm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
//!
//! ## Example
//! ```no_run
//! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
//! let mut led = io.pins.gpio1.into_push_pull_output();
//! let button = io.pins.gpio9.into_pull_down_input();
//!
Expand Down
6 changes: 3 additions & 3 deletions esp-hal/src/gpio/lp_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//!
//! # Example
//! ```no_run
//! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
//! // configure GPIO 1 as LP output pin
//! let lp_pin = io.pins.gpio1.into_low_power().into_push_pull_output();
//! ```
Expand Down Expand Up @@ -180,7 +180,7 @@ macro_rules! lp_gpio {
}
}

impl<MODE> $crate::gpio::RTCPin for GpioPin<MODE, $gpionum> {
impl<MODE> $crate::gpio::RtcPin for GpioPin<MODE, $gpionum> {
unsafe fn apply_wakeup(&mut self, wakeup: bool, level: u8) {
let lp_io = &*$crate::peripherals::LP_IO::ptr();
lp_io.[< pin $gpionum >]().modify(|_, w| {
Expand Down Expand Up @@ -232,7 +232,7 @@ macro_rules! lp_gpio {
}
}

impl<MODE> $crate::gpio::RTCPinWithResistors for GpioPin<MODE, $gpionum> {
impl<MODE> $crate::gpio::RtcPinWithResistors for GpioPin<MODE, $gpionum> {
fn rtcio_pullup(&mut self, enable: bool) {
let lp_io = unsafe { &*$crate::peripherals::LP_IO::ptr() };
lp_io.[< gpio $gpionum >]().modify(|_, w| w.fun_wpu().bit(enable));
Expand Down
Loading

0 comments on commit 53dc6be

Please sign in to comment.