Skip to content

Commit

Permalink
Adjusting to changes in driver
Browse files Browse the repository at this point in the history
  • Loading branch information
playfulFence committed Jan 5, 2024
1 parent 87815e4 commit f57554a
Show file tree
Hide file tree
Showing 56 changed files with 1,635 additions and 1,785 deletions.
12 changes: 3 additions & 9 deletions esp-hal-common/src/aes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ pub struct Aes256;
/// State matrix endianness
#[cfg(any(esp32, esp32s2))]
pub enum Endianness {
BigEndian = 1,
BigEndian = 1,
LittleEndian = 0,
}

Expand All @@ -248,14 +248,8 @@ pub mod dma {
use crate::{
aes::Mode,
dma::{
AesPeripheral,
Channel,
ChannelTypes,
DmaError,
DmaPeripheral,
DmaTransferRxTx,
RxPrivate,
TxPrivate,
AesPeripheral, Channel, ChannelTypes, DmaError, DmaPeripheral, DmaTransferRxTx,
RxPrivate, TxPrivate,
},
};

Expand Down
7 changes: 1 addition & 6 deletions esp-hal-common/src/analog/adc/cal_basic.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
use core::marker::PhantomData;

use crate::adc::{
AdcCalEfuse,
AdcCalScheme,
AdcCalSource,
AdcConfig,
Attenuation,
CalibrationAccess,
AdcCalEfuse, AdcCalScheme, AdcCalSource, AdcConfig, Attenuation, CalibrationAccess,
};

/// Basic ADC calibration scheme
Expand Down
7 changes: 1 addition & 6 deletions esp-hal-common/src/analog/adc/cal_curve.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
use core::marker::PhantomData;

use crate::adc::{
AdcCalEfuse,
AdcCalLine,
AdcCalScheme,
AdcHasLineCal,
Attenuation,
CalibrationAccess,
AdcCalEfuse, AdcCalLine, AdcCalScheme, AdcHasLineCal, Attenuation, CalibrationAccess,
};

const COEFF_MUL: i64 = 1 << 52;
Expand Down
8 changes: 1 addition & 7 deletions esp-hal-common/src/analog/adc/cal_line.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
use core::marker::PhantomData;

use crate::adc::{
AdcCalBasic,
AdcCalEfuse,
AdcCalScheme,
AdcCalSource,
AdcConfig,
Attenuation,
CalibrationAccess,
AdcCalBasic, AdcCalEfuse, AdcCalScheme, AdcCalSource, AdcConfig, Attenuation, CalibrationAccess,
};

/// Marker trait for ADC units which support line fitting
Expand Down
8 changes: 4 additions & 4 deletions esp-hal-common/src/analog/adc/esp32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ use crate::{
/// The sampling/readout resolution of the ADC
#[derive(PartialEq, Eq, Clone, Copy)]
pub enum Resolution {
Resolution9Bit = 0b00,
Resolution9Bit = 0b00,
Resolution10Bit = 0b01,
Resolution11Bit = 0b10,
Resolution12Bit = 0b11,
}

#[derive(PartialEq, Eq, Clone, Copy)]
pub enum Attenuation {
Attenuation0dB = 0b00,
Attenuation0dB = 0b00,
Attenuation2p5dB = 0b01,
Attenuation6dB = 0b10,
Attenuation11dB = 0b11,
Attenuation6dB = 0b10,
Attenuation11dB = 0b11,
}

pub struct AdcPin<PIN, ADCI> {
Expand Down
6 changes: 3 additions & 3 deletions esp-hal-common/src/analog/adc/riscv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ pub enum Resolution {
#[derive(PartialEq, Eq, Clone, Copy)]
pub enum Attenuation {
/// 0 dB attenuation, measurement range: 0 - 800 mV
Attenuation0dB = 0b00,
Attenuation0dB = 0b00,
/// 2.5 dB attenuation, measurement range: 0 - 1100 mV
#[cfg(not(esp32c2))]
Attenuation2p5dB = 0b01,
/// 6 dB attenuation, measurement range: 0 - 1350 mV
#[cfg(not(esp32c2))]
Attenuation6dB = 0b10,
Attenuation6dB = 0b10,
/// 11 dB attenuation, measurement range: 0 - 2600 mV
Attenuation11dB = 0b11,
Attenuation11dB = 0b11,
}

impl Attenuation {
Expand Down
6 changes: 3 additions & 3 deletions esp-hal-common/src/analog/adc/xtensa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ pub enum Resolution {
#[derive(PartialEq, Eq, Clone, Copy)]
pub enum Attenuation {
/// 0 dB attenuation, measurement range: 0 - 800 mV
Attenuation0dB = 0b00,
Attenuation0dB = 0b00,
/// 2.5 dB attenuation, measurement range: 0 - 1100 mV
Attenuation2p5dB = 0b01,
/// 6 dB attenuation, measurement range: 0 - 1350 mV
Attenuation6dB = 0b10,
Attenuation6dB = 0b10,
/// 11 dB attenuation, measurement range: 0 - 2600 mV
Attenuation11dB = 0b11,
Attenuation11dB = 0b11,
}

impl Attenuation {
Expand Down
3 changes: 1 addition & 2 deletions esp-hal-common/src/clock/clocks_ll/esp32c2.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::{
clock::{ApbClock, Clock, CpuClock, PllClock, XtalClock},
regi2c_write,
regi2c_write_mask,
regi2c_write, regi2c_write_mask,
};

extern "C" {
Expand Down
3 changes: 1 addition & 2 deletions esp-hal-common/src/clock/clocks_ll/esp32c3.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::{
clock::{ApbClock, Clock, CpuClock, PllClock, XtalClock},
regi2c_write,
regi2c_write_mask,
regi2c_write, regi2c_write_mask,
};

extern "C" {
Expand Down
42 changes: 17 additions & 25 deletions esp-hal-common/src/dma/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,25 +190,25 @@ pub enum DmaPriority {
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum DmaPeripheral {
Spi2 = 0,
Spi2 = 0,
#[cfg(any(pdma, esp32s3))]
Spi3 = 1,
Spi3 = 1,
#[cfg(any(esp32c3, esp32c6, esp32h2, esp32s3))]
Uhci0 = 2,
Uhci0 = 2,
#[cfg(any(esp32, esp32s2, esp32c3, esp32c6, esp32h2, esp32s3))]
I2s0 = 3,
I2s0 = 3,
#[cfg(any(esp32, esp32s3))]
I2s1 = 4,
I2s1 = 4,
#[cfg(esp32s3)]
LcdCam = 5,
#[cfg(not(esp32c2))]
Aes = 6,
Aes = 6,
#[cfg(gdma)]
Sha = 7,
Sha = 7,
#[cfg(any(esp32c3, esp32c6, esp32h2, esp32s3))]
Adc = 8,
Adc = 8,
#[cfg(esp32s3)]
Rmt = 9,
Rmt = 9,
#[cfg(parl_io)]
ParlIo = 9,
}
Expand Down Expand Up @@ -1307,8 +1307,7 @@ pub(crate) mod asynch {
#[interrupt]
fn DMA_CH0() {
use crate::dma::gdma::{
Channel0 as Channel,
Channel0RxImpl as ChannelRxImpl,
Channel0 as Channel, Channel0RxImpl as ChannelRxImpl,
Channel0TxImpl as ChannelTxImpl,
};

Expand Down Expand Up @@ -1339,8 +1338,7 @@ pub(crate) mod asynch {
#[interrupt]
fn DMA_CH0() {
use crate::dma::gdma::{
Channel0 as Channel,
Channel0RxImpl as ChannelRxImpl,
Channel0 as Channel, Channel0RxImpl as ChannelRxImpl,
Channel0TxImpl as ChannelTxImpl,
};

Expand Down Expand Up @@ -1372,8 +1370,7 @@ pub(crate) mod asynch {
#[interrupt]
fn DMA_CH1() {
use crate::dma::gdma::{
Channel1 as Channel,
Channel1RxImpl as ChannelRxImpl,
Channel1 as Channel, Channel1RxImpl as ChannelRxImpl,
Channel1TxImpl as ChannelTxImpl,
};

Expand Down Expand Up @@ -1405,8 +1402,7 @@ pub(crate) mod asynch {
#[interrupt]
fn DMA_CH2() {
use crate::dma::gdma::{
Channel2 as Channel,
Channel2RxImpl as ChannelRxImpl,
Channel2 as Channel, Channel2RxImpl as ChannelRxImpl,
Channel2TxImpl as ChannelTxImpl,
};

Expand Down Expand Up @@ -1691,8 +1687,7 @@ pub(crate) mod asynch {
#[interrupt]
fn SPI2_DMA() {
use crate::dma::pdma::{
Spi2DmaChannel as Channel,
Spi2DmaChannelRxImpl as ChannelRxImpl,
Spi2DmaChannel as Channel, Spi2DmaChannelRxImpl as ChannelRxImpl,
Spi2DmaChannelTxImpl as ChannelTxImpl,
};

Expand Down Expand Up @@ -1724,8 +1719,7 @@ pub(crate) mod asynch {
#[interrupt]
fn SPI3_DMA() {
use crate::dma::pdma::{
Spi3DmaChannel as Channel,
Spi3DmaChannelRxImpl as ChannelRxImpl,
Spi3DmaChannel as Channel, Spi3DmaChannelRxImpl as ChannelRxImpl,
Spi3DmaChannelTxImpl as ChannelTxImpl,
};

Expand Down Expand Up @@ -1757,8 +1751,7 @@ pub(crate) mod asynch {
#[interrupt]
fn I2S0() {
use crate::dma::pdma::{
I2s0DmaChannel as Channel,
I2s0DmaChannelRxImpl as ChannelRxImpl,
I2s0DmaChannel as Channel, I2s0DmaChannelRxImpl as ChannelRxImpl,
I2s0DmaChannelTxImpl as ChannelTxImpl,
};

Expand Down Expand Up @@ -1791,8 +1784,7 @@ pub(crate) mod asynch {
#[interrupt]
fn I2S1() {
use crate::dma::pdma::{
I2s1DmaChannel as Channel,
I2s1DmaChannelRxImpl as ChannelRxImpl,
I2s1DmaChannel as Channel, I2s1DmaChannelRxImpl as ChannelRxImpl,
I2s1DmaChannelTxImpl as ChannelTxImpl,
};

Expand Down
22 changes: 11 additions & 11 deletions esp-hal-common/src/ecc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,24 @@ pub enum EllipticCurve {

#[derive(Clone)]
pub enum WorkMode {
PointMultiMode = 0,
PointMultiMode = 0,
#[cfg(esp32c2)]
DivisionMode = 1,
PointVerif = 2,
PointVerifMulti = 3,
JacobianPointMulti = 4,
DivisionMode = 1,
PointVerif = 2,
PointVerifMulti = 3,
JacobianPointMulti = 4,
#[cfg(esp32h2)]
PointAdd = 5,
JacobianPointVerif = 6,
PointAdd = 5,
JacobianPointVerif = 6,
PointVerifJacobianMulti = 7,
#[cfg(esp32h2)]
ModAdd = 8,
ModAdd = 8,
#[cfg(esp32h2)]
ModSub = 9,
ModSub = 9,
#[cfg(esp32h2)]
ModMulti = 10,
ModMulti = 10,
#[cfg(esp32h2)]
ModDiv = 11,
ModDiv = 11,
}

impl<'d> Ecc<'d> {
Expand Down
12 changes: 6 additions & 6 deletions esp-hal-common/src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ pub const NO_PIN: Option<NoPinType> = None;

#[derive(Copy, Clone)]
pub enum Event {
RisingEdge = 1,
RisingEdge = 1,
FallingEdge = 2,
AnyEdge = 3,
LowLevel = 4,
HighLevel = 5,
AnyEdge = 3,
LowLevel = 4,
HighLevel = 5,
}

pub struct Unknown {}
Expand Down Expand Up @@ -133,7 +133,7 @@ pub struct AF1;
pub struct AF2;

pub enum DriveStrength {
I5mA = 0,
I5mA = 0,
I10mA = 1,
I20mA = 2,
I40mA = 3,
Expand All @@ -151,7 +151,7 @@ pub enum AlternateFunction {

#[derive(PartialEq)]
pub enum RtcFunction {
Rtc = 0,
Rtc = 0,
Digital = 1,
}

Expand Down
6 changes: 3 additions & 3 deletions esp-hal-common/src/hmac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ pub enum Error {
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum HmacPurpose {
/// HMAC is used to re-enable JTAG after soft-disabling it.
ToJtag = 6,
ToJtag = 6,
/// HMAC is provided to the digital signature peripheral to decrypt the
/// private key.
ToDs = 7,
ToDs = 7,
/// Let the user provide a message and read the result.
ToUser = 8,
ToUser = 8,
/// HMAC is used for both the digital signature or JTAG.
ToDsOrJtag = 5,
}
Expand Down
14 changes: 7 additions & 7 deletions esp-hal-common/src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl From<Command> for u16 {

enum OperationType {
Write = 0,
Read = 1,
Read = 1,
}

#[derive(Eq, PartialEq, Copy, Clone)]
Expand All @@ -169,17 +169,17 @@ enum Ack {
#[cfg(any(esp32c2, esp32c3, esp32c6, esp32h2, esp32s3))]
enum Opcode {
RStart = 6,
Write = 1,
Read = 3,
Stop = 2,
Write = 1,
Read = 3,
Stop = 2,
}

#[cfg(any(esp32, esp32s2))]
enum Opcode {
RStart = 0,
Write = 1,
Read = 2,
Stop = 3,
Write = 1,
Read = 2,
Stop = 3,
}

/// I2C peripheral container (I2C)
Expand Down
Loading

0 comments on commit f57554a

Please sign in to comment.