Skip to content

variant: WB: add STM32WB5MM-DK #1441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 9, 2021
Merged

Conversation

fpistm
Copy link
Member

@fpistm fpistm commented Jul 7, 2021

Board:

STM32WB5MM-DK

Test:

Examples:

Get STTS22H Temperature example
#include "STTS22HSensor.h"

TwoWire Wire3(PB11, PB13);

// Components
STTS22HSensor Temp(&Wire3);

void setup() {
  // Initialize serial for output
  Serial.begin(9600);
  // Initlialize Wire3 instance
  Wire3.begin();
  // Initlialize components
  Temp.begin();
  Temp.Enable();
}

void loop() {
  float temperature = 0.0;
  // Read temperature
  Temp.GetTemperature(&temperature);
  // Output data
  Serial.print("Temperature: ");
  Serial.println(temperature);
  delay(1000);
}
Get ISM330DHCX accelerometer and gyroscope example
#include "ISM330DHCXSensor.h"

TwoWire Wire3(PB11, PB13);

// Components
ISM330DHCXSensor AccGyr(&Wire3);

void setup() {
  // Initialize serial for output
  Serial.begin(9600);
  // Initlialize Wire3 instance
  Wire3.begin();

  // Initlialize components
  AccGyr.begin();
  AccGyr.ACC_Enable();
  AccGyr.GYRO_Enable();
}

void loop() {
  int32_t accelerometer[3];
  int32_t gyroscope[3];
  // Read accelerometer and gyroscope.
  AccGyr.ACC_GetAxes(accelerometer);
  AccGyr.GYRO_GetAxes(gyroscope);

  // Output data
  Serial.print("| Acc[mg]: ");
  Serial.print(accelerometer[0]);
  Serial.print(" ");
  Serial.print(accelerometer[1]);
  Serial.print(" ");
  Serial.print(accelerometer[2]);
  Serial.print(" ");
  Serial.print("| Gyro[mdps]: ");
  Serial.print(gyroscope[0]);
  Serial.print(" ");
  Serial.print(gyroscope[1]);
  Serial.print(" ");
  Serial.print(gyroscope[2]);
  Serial.println(" |");
  delay(500);
}
Get VL53L0CXV0DH distance example
#include <Wire.h>
#include <vl53l0x_class.h>

// Create components.
TwoWire Wire3(PB11, PB13);  //SDA=PB11 & SCL=PB10
VL53L0X sensor_vl53l0x(&Wire3, PNUM_NOT_DEFINED); //XSHUT connected to 3.3V

void setup() {
  // Initialize serial for output.
  Serial.begin(9600);

  // Initialize I2C bus.
  Wire3.begin();

  // Configure VL53L0X component.
  sensor_vl53l0x.begin();

  // Switch off VL53L0X component.
  sensor_vl53l0x.VL53L0X_Off();

  // Initialize VL53L0X component.
  if (sensor_vl53l0x.InitSensor(0x10))
  {
    Serial.println("Init sensor_vl53l0x failed...");
  }
}

void loop() {
  // Read Range.
  uint32_t distance;
  if (sensor_vl53l0x.GetDistance(&distance) == VL53L0X_ERROR_NONE)
  {
    // Output data.
    char report[64];
    snprintf(report, sizeof(report), "| Distance [mm]: %ld |", distance);
    Serial.println(report);
  }
  delay(100);
}

@fpistm fpistm added the new variant Add support of new bard label Jul 7, 2021
@fpistm fpistm added this to the 2.x.x milestone Jul 7, 2021
fpistm added 3 commits July 7, 2021 18:46
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
@fpistm fpistm force-pushed the STM32WB5MM-DK branch 2 times, most recently from 7b150b9 to 8105af6 Compare July 9, 2021 15:18
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
@fpistm fpistm merged commit 47097af into stm32duino:master Jul 9, 2021
@fpistm fpistm deleted the STM32WB5MM-DK branch July 9, 2021 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new variant Add support of new bard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants