Skip to content

Commit

Permalink
[delay] Refactor all deprecated usage of delay
Browse files Browse the repository at this point in the history
  • Loading branch information
salkinium committed Apr 6, 2020
1 parent 8f49d35 commit b010775
Show file tree
Hide file tree
Showing 135 changed files with 349 additions and 325 deletions.
4 changes: 2 additions & 2 deletions examples/arduino_uno/basic/blink/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ main()
while (true)
{
LedD13::set();
modm::delayMilliseconds(1000);
modm::delay(1s);
LedD13::reset();
modm::delayMilliseconds(1000);
modm::delay(1s);
}
}
9 changes: 5 additions & 4 deletions examples/avr/1-wire/ds18b20/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

using namespace modm::platform;
using namespace modm::literals;
using namespace std::chrono_literals;

using OneWirePin = GpioC2;
using OneWireMaster = BitBangOneWireMaster<OneWirePin>;
Expand All @@ -35,14 +36,14 @@ main()
modm::IOStream output(device);

output << "Welcome" << modm::endl;
modm::delayMilliseconds(100);
modm::delay(100ms);

OneWireMaster::connect<OneWirePin::BitBang>();
OneWireMaster::initialize<SystemClock>();

if (!OneWireMaster::touchReset()) {
output << "No devices found!" << modm::endl;
modm::delayMilliseconds(100);
modm::delay(100ms);
while (true) {
// wait forever
}
Expand All @@ -58,7 +59,7 @@ main()
output << rom[i];
}
output << modm::ascii << modm::endl;
modm::delayMilliseconds(100);
modm::delay(100ms);
}
output << "finished!" << modm::endl;

Expand All @@ -74,7 +75,7 @@ main()
int16_t temperature = ds18b20.readTemperature();

output << "Temperature: " << temperature << modm::endl;
modm::delayMilliseconds(100);
modm::delay(100ms);

ds18b20.startConversion();
}
Expand Down
3 changes: 2 additions & 1 deletion examples/avr/adc/basic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

using namespace modm::platform;
using namespace modm::literals;
using namespace std::chrono_literals;

int
main()
Expand Down Expand Up @@ -62,7 +63,7 @@ main()
// receiving the UART output on a PC. If you want to do further
// calculations with the results instead of sending it
// you do not need this.
modm::delayMilliseconds(300);
modm::delay(300ms);

// restart the conversion
Adc::setChannel(0);
Expand Down
3 changes: 2 additions & 1 deletion examples/avr/app_can2usb/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <modm/debug/logger.hpp>

using namespace modm::platform;
using namespace std::chrono_literals;

// LED1 Status
typedef GpioOutputD7 LedStatus;
Expand Down Expand Up @@ -110,7 +111,7 @@ main()

while (true)
{
modm::delayMilliseconds(100);
modm::delay(100ms);
LedStatus::toggle();
LedRxHigh::toggle();
LedRxLow::toggle();
Expand Down
6 changes: 3 additions & 3 deletions examples/avr/assert/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ modm_abandon(const modm::AssertionInfo &info)
Leds::setOutput();
while (true) {
Leds::write(1);
modm::delayMilliseconds(20);
modm::delay(20ms);
Leds::write(0);
modm::delayMilliseconds(180);
modm::delay(180ms);
}
}

Expand Down Expand Up @@ -87,6 +87,6 @@ int main()
while (true)
{
LedD13::toggle();
modm::delayMilliseconds(500);
modm::delay(500ms);
}
}
3 changes: 2 additions & 1 deletion examples/avr/display/dogm128/caged_ball/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

using namespace modm::platform;
using namespace modm::literals;
using namespace std::chrono_literals;


namespace led
Expand Down Expand Up @@ -82,6 +83,6 @@ main()
display.drawCircle(Point(x, y), radius);
display.update();

modm::delayMilliseconds(50);
modm::delay(50ms);
}
}
5 changes: 3 additions & 2 deletions examples/avr/display/dogm128/image/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

using namespace modm::platform;
using namespace modm::literals;
using namespace std::chrono_literals;


namespace led
Expand Down Expand Up @@ -218,7 +219,7 @@ main()
display.drawImage(modm::glcd::Point(0, 0), modm::accessor::asFlash(bootscreen));
display.update();

modm::delayMilliseconds(1500);
modm::delay(1.5s);

uint8_t units = 0;
uint8_t tens = 0;
Expand All @@ -237,6 +238,6 @@ main()
drawNumber(modm::glcd::Point(64, 0), units);
display.update();

modm::delayMilliseconds(200);
modm::delay(200ms);
}
}
5 changes: 3 additions & 2 deletions examples/avr/display/dogm128/text/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

using namespace modm::platform;
using namespace modm::literals;
using namespace std::chrono_literals;


// LCD Backlight
Expand Down Expand Up @@ -76,7 +77,7 @@ main()
display << 0 << 12 << 345 << 6789 << "!\"§$%&/()=?`´,;:-<>";
display.update();

modm::delayMilliseconds(2000);
modm::delay(2s);

display.clear();
display.setFont(modm::font::Assertion);
Expand All @@ -87,7 +88,7 @@ main()
display << "0123456789!\"§$%&/()=?`´,;:-<>";
display.update();

modm::delayMilliseconds(2000);
modm::delay(2s);

display.clear();
display.setFont(modm::font::ArcadeClassic);
Expand Down
5 changes: 3 additions & 2 deletions examples/avr/display/dogm128/touch/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

using namespace modm::platform;
using namespace modm::literals;
using namespace std::chrono_literals;

namespace touch
{
Expand Down Expand Up @@ -115,7 +116,7 @@ main()
touch::Left::setOutput();
touch::Right::set();
touch::Right::setOutput();
modm::delayMilliseconds(2);
modm::delay(2ms);

int16_t xAdc = Adc::readChannel(0);

Expand All @@ -128,7 +129,7 @@ main()
touch::Bottom::setOutput();
touch::Top::set();
touch::Top::setOutput();
modm::delayMilliseconds(2);
modm::delay(2ms);

int16_t yAdc = Adc::readChannel(1);

Expand Down
5 changes: 3 additions & 2 deletions examples/avr/display/hd44780/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <modm/driver/display/hd44780.hpp>

using namespace modm::platform;
using namespace std::chrono_literals;

// define the pins used by the LCD
namespace lcd
Expand Down Expand Up @@ -46,7 +47,7 @@ main()

// The LCD needs at least 50ms after power-up until it can be
// initialized. To make sure this is met we wait here
modm::delayMilliseconds(50);
modm::delay(50ms);

display.initialize();
display.setCursor(0, 0);
Expand All @@ -64,6 +65,6 @@ main()

counter++;

modm::delayMilliseconds(200);
modm::delay(200ms);
}
}
3 changes: 2 additions & 1 deletion examples/avr/gpio/blinking/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <modm/platform.hpp>

using namespace modm::platform;
using namespace std::chrono_literals;

typedef GpioOutputB0 Led;

Expand All @@ -25,7 +26,7 @@ main()
{
Led::toggle();

modm::delayMilliseconds(1000);
modm::delay(1s);
}
}

4 changes: 2 additions & 2 deletions examples/avr/ports/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ int main()
PinGroup4::setInput(); serialStream << modm::bin << PinGroup4::read() << modm::endl;
serialStream << modm::endl;

PinGroup::setOutput(modm::Gpio::High); modm::delayMilliseconds(1000);
PinGroup::setOutput(modm::Gpio::High); modm::delay(1s);

const auto fn_report = []() {
serialStream << modm::bin << PinGroup::read() << modm::endl; modm::delayMilliseconds(200);
serialStream << modm::bin << PinGroup::read() << modm::endl; modm::delay(200ms);
};

while (true)
Expand Down
3 changes: 2 additions & 1 deletion examples/avr/xpcc/receiver/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

using namespace modm::platform;
using namespace modm::literals;
using namespace std::chrono_literals;

// set new log level
#undef MODM_LOG_LEVEL
Expand Down Expand Up @@ -111,6 +112,6 @@ main()

component::receiver.update();

modm::delayMicroseconds(100);
modm::delay(100us);
}
}
3 changes: 2 additions & 1 deletion examples/avr/xpcc/sender/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

using namespace modm::platform;
using namespace modm::literals;
using namespace std::chrono_literals;

// set new log level
#undef MODM_LOG_LEVEL
Expand Down Expand Up @@ -111,6 +112,6 @@ main()

component::sender.update();

modm::delayMicroseconds(100);
modm::delay(100us);
}
}
2 changes: 1 addition & 1 deletion examples/generic/blinky/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ int main()
while (true)
{
Board::Leds::toggle();
modm::delayMilliseconds(Board::Button::read() ? 250 : 500);
modm::delay(Board::Button::read() ? 250ms : 500ms);
#ifdef MODM_BOARD_HAS_LOGGER
static uint32_t counter(0);
MODM_LOG_INFO << "Loop counter: " << (counter++) << modm::endl;
Expand Down
3 changes: 2 additions & 1 deletion examples/linux/xpcc/basic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// ----------------------------------------------------------------------------

#include <modm/platform.hpp>
using namespace std::chrono_literals;

#include <modm/communication/xpcc.hpp>
// #include <modm/communication/xpcc/backend/tipc.hpp>
Expand Down Expand Up @@ -65,6 +66,6 @@ main()
component::receiver.update();
component::sender.update();

modm::delayMicroseconds(100);
modm::delay(100us);
}
}
2 changes: 1 addition & 1 deletion examples/nucleo_f042k6/adc/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ main()
while (true)
{
LedD13::toggle();
modm::delayMilliseconds(100);
modm::delay(100ms);

MODM_LOG_INFO << "mV=" << (Vref * Adc::getValue() / 4095ul) << modm::endl;

Expand Down
2 changes: 1 addition & 1 deletion examples/nucleo_f042k6/blink/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ main()
while (true)
{
LedD13::toggle();
modm::delayMilliseconds(Button::read() ? 100 : 500);
modm::delay(Button::read() ? 100ms : 500ms);

MODM_LOG_INFO << "loop: " << counter++ << modm::endl;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/nucleo_f103rb/hard_fault/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void modm_hardfault_entry()
// Put hardware in safe mode here
Board::Leds::set();
// But do not wait forever
modm::delayMilliseconds(100);
modm::delay(100ms);
// Do not depend on interrupts in this function (buffered UART etc!)
}

Expand Down Expand Up @@ -79,7 +79,7 @@ main()

function2(23, 43);

modm::delayMilliseconds(250);
modm::delay(250ms);
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/nucleo_f103rb/undefined_irq/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ int main()
NVIC_SetPendingIRQ(IRQn_Type(int(EXTI0_IRQn) + ii));
ii = (ii + 1) % 5;
// wait one second for debounce
modm::delayMilliseconds(500);
modm::delay(500ms);
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/nucleo_f303k8/blink/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ main()
while (true)
{
LedD13::toggle();
modm::delayMilliseconds(Button::read() ? 100 : 500);
modm::delay(Button::read() ? 100ms : 500ms);

MODM_LOG_INFO << "loop: " << counter++ << modm::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/nucleo_f401re/blink/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ main()
while (true)
{
LedD13::toggle();
modm::delayMilliseconds(Button::read() ? 100 : 500);
modm::delay(Button::read() ? 100ms : 500ms);

MODM_LOG_INFO << "loop: " << counter++ << modm::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/nucleo_f411re/blink/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ main()
while (true)
{
LedD13::toggle();
modm::delayMilliseconds(Button::read() ? 100 : 500);
modm::delay(Button::read() ? 100ms : 500ms);

MODM_LOG_INFO << "loop: " << counter++ << modm::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/nucleo_f411re/radio/nrf24-phy-test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int main()
MODM_LOG_INFO << "Testing PHY2" << modm::endl;
test<Nrf2Phy>();

modm::delayMilliseconds(1000);
modm::delay(1s);
}

return 0;
Expand Down
Loading

0 comments on commit b010775

Please sign in to comment.