Skip to content

Commit

Permalink
Use correct defmt-03 feature (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
avsaase authored May 16, 2024
1 parent 892d652 commit 712ef9c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct SpiInterface<SPI> {

/// Possible slave addresses
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub enum SlaveAddr {
/// Default slave address
Default,
Expand Down
28 changes: 14 additions & 14 deletions src/types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// All possible errors in this crate
#[derive(Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub enum Error<CommE> {
/// I²C / SPI communication error
Comm(CommE),
Expand All @@ -10,7 +10,7 @@ pub enum Error<CommE> {

/// Sensor power mode
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub struct SensorPowerMode {
/// Accelerometer power mode
pub accel: AccelerometerPowerMode,
Expand All @@ -22,7 +22,7 @@ pub struct SensorPowerMode {

/// Accelerometer power mode
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub enum AccelerometerPowerMode {
/// Normal mode
Normal,
Expand All @@ -34,7 +34,7 @@ pub enum AccelerometerPowerMode {

/// Accelerometer Range
#[derive(Debug, Clone, Copy, PartialEq, Default)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub enum AccelerometerRange {
/// +- 2G
#[default]
Expand All @@ -57,7 +57,7 @@ impl AccelerometerRange {

/// Gyroscope power mode
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub enum GyroscopePowerMode {
/// Normal mode
Normal,
Expand All @@ -69,7 +69,7 @@ pub enum GyroscopePowerMode {

/// Gyroscope range
#[derive(Debug, Clone, Copy, PartialEq, Default)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub enum GyroscopeRange {
/// 16.4 LSB/°/s <-> 61.0 m°/s / LSB
#[default]
Expand Down Expand Up @@ -98,7 +98,7 @@ impl GyroscopeRange {

/// Magnetometer power mode
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub enum MagnetometerPowerMode {
/// Normal mode
Normal,
Expand All @@ -110,7 +110,7 @@ pub enum MagnetometerPowerMode {

/// Sensor status flags
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub struct Status {
/// Accelerometer has data ready
pub accel_data_ready: bool,
Expand All @@ -130,7 +130,7 @@ pub struct Status {

/// Sensor data read selector
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub struct SensorSelector {
pub(crate) accel: bool,
pub(crate) gyro: bool,
Expand Down Expand Up @@ -194,7 +194,7 @@ impl Default for SensorSelector {

/// Sensor data read selector
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub struct Sensor3DData {
/// X axis data
pub x: i16,
Expand All @@ -206,7 +206,7 @@ pub struct Sensor3DData {

/// Magnetometer data
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub struct MagnetometerData {
/// Axes data
pub axes: Sensor3DData,
Expand All @@ -216,7 +216,7 @@ pub struct MagnetometerData {

/// Sensor data read
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub struct Data {
/// Accelerometer data (if selected)
pub accel: Option<Sensor3DData>,
Expand All @@ -230,7 +230,7 @@ pub struct Data {

/// Floating point 3D data
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub struct Sensor3DDataScaled {
/// X axis data
pub x: f32,
Expand All @@ -242,7 +242,7 @@ pub struct Sensor3DDataScaled {

/// Sensor data read
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub struct DataScaled {
/// Accelerometer data (if selected)
pub accel: Option<Sensor3DDataScaled>,
Expand Down

0 comments on commit 712ef9c

Please sign in to comment.