diff --git a/examples/nucleo_g071rb/matrix/main.cpp b/examples/nucleo_g071rb/matrix/main.cpp new file mode 100644 index 0000000000..b91f620719 --- /dev/null +++ b/examples/nucleo_g071rb/matrix/main.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2019, Niklas Hauser + * + * This file is part of the modm project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include +#include +#include + +using namespace Board; + +using PinReset = GpioC8; +using PinSda = GpioA11; +using PinScl = GpioA12; + +using I2cInstance = BitBangI2cMaster; +static modm::Is31fl3733 driver(modm::is31fl3733::addr()); + +// ---------------------------------------------------------------------------- +int +main() +{ + Board::initialize(); + LedD13::setOutput(modm::Gpio::Low); + + MODM_LOG_ERROR << "error" << modm::endl; + + // Reset the I2C interface of the chip + PinReset::setOutput(modm::Gpio::High); + modm::delay(20ms); + PinReset::setOutput(modm::Gpio::Low); + + I2cInstance::initialize(); + I2cInstance::connect(); + + RF_CALL_BLOCKING(driver.reset()); + RF_CALL_BLOCKING(driver.clearSoftwareShutdown()); + RF_CALL_BLOCKING(driver.setGlobalCurrent(1)); + + driver.enableAll(); + RF_CALL_BLOCKING(driver.writeOnOff()); + + uint8_t pwm{0}; + while (true) + { + for (uint8_t y=0, pi=pwm; y<16; y++) { + for (uint8_t x=0; x<12; x++) { + driver.setPwm(x, y, pi++); + } + } + RF_CALL_BLOCKING(driver.writePwm()); + modm::delay(10ms); + pwm++; + } + + return 0; +} diff --git a/examples/nucleo_g071rb/matrix/project.xml b/examples/nucleo_g071rb/matrix/project.xml new file mode 100644 index 0000000000..3893ddf9d3 --- /dev/null +++ b/examples/nucleo_g071rb/matrix/project.xml @@ -0,0 +1,12 @@ + + modm:nucleo-g071rb + + + + + modm:platform:gpio + modm:platform:i2c.bitbang + modm:driver:is31fl3733 + modm:build:scons + +