Skip to content

Commit

Permalink
[board] Rename systemClock -> SystemClock
Browse files Browse the repository at this point in the history
  • Loading branch information
salkinium committed Mar 5, 2019
1 parent bf0a52c commit 825c402
Show file tree
Hide file tree
Showing 117 changed files with 235 additions and 258 deletions.
4 changes: 2 additions & 2 deletions docs/src/guide/cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ using Uart = Uart0;
// connect both pins with a pullup on the Rx
Uart::connect<GpioOutputD1::Tx, GpioInputD0::Rx>(Gpio::InputType::PullUp);
// initialize to 115.2kBaud from the BSP clock configuration
Uart::initialize<Board::systemClock, 115200_Bd>();
Uart::initialize<Board::SystemClock, 115200_Bd>();
Uart::write('H'); // Ohai there
Uart::write('i');
Expand All @@ -59,7 +59,7 @@ modm::IODeviceWrapper<Uart> device;
modm::IOStream stream(device);

Uart::connect<GpioOutputD1::Tx>();
Uart::initialize<Board::systemClock, 115200_Bd>();
Uart::initialize<Board::SystemClock, 115200_Bd>();

// similar to std::ostream but without formatting features
stream << 42 << " is a nice number!" << modm::endl;
Expand Down
6 changes: 3 additions & 3 deletions docs/src/how-modm-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ for keeping code size in check on very resource constrained targets, like the AV

```cpp
Uart4::connect<GpioA0::Tx, GpioA1::Rx>(Gpio::InputType::PullUp); // pull-up in RX pin
Uart4::initialize<Board::systemClock, 115'200_Bd>(); // Within 1% default tolerance
Uart4::initialize<Board::systemClock, 115'200_Bd> Tolerance::Exact>();
Uart4::initialize<Board::SystemClock, 115'200_Bd>(); // Within 1% default tolerance
Uart4::initialize<Board::SystemClock, 115'200_Bd> Tolerance::Exact>();
// error: The closest available baudrate exceeds the tolerance of the requested baudrate!
```

Expand Down Expand Up @@ -320,7 +320,7 @@ using GpioExpander = modm::Mcp23x17< Transport >;
GpioExpander expander;
// Connect and initialize the peripherals
SpiMaster1::connect<GpioA0::Sck, GpioA1::Mosi, GpioA2::Miso>();
SpiMaster1::initialize<Board::systemClock, 1MHz>();
SpiMaster1::initialize<Board::SystemClock, 1MHz>();
expander.initialize();
// Bind the expander pins to a simpler name
using Pin0 = GpioExpander::P0< expander >;
Expand Down
2 changes: 1 addition & 1 deletion examples/arduino_uno/basic/analog_read_serial/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ main()
// Initialize the analog to digital converter
// With the AVR running at 16Mhz and a prescaler of 128 the
// ADC is running at 125kHz.
Adc::initialize<Board::systemClock, 125_kHz>();
Adc::initialize<Board::SystemClock, 125_kHz>();
Adc::setReference(Adc::Reference::InternalVcc);

while (1)
Expand Down
2 changes: 1 addition & 1 deletion examples/arduino_uno/basic/read_analog_voltage/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ main()
// Initialize the analog to digital converter
// With the AVR running at 16Mhz and a prescaler of 128 the
// ADC is running at 125kHz.
Adc::initialize<Board::systemClock, 125_kHz>();
Adc::initialize<Board::SystemClock, 125_kHz>();
Adc::setReference(Adc::Reference::InternalVcc);

while (1)
Expand Down
3 changes: 1 addition & 2 deletions examples/avr/1-wire/ds18b20/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ using OneWireMaster = BitBangOneWireMaster<OneWirePin>;
int
main()
{
using systemClock = SystemClock;
Uart0::connect<GpioD1::Txd, GpioD0::Rxd>();
Uart0::initialize<systemClock, 9600_Bd>();
Uart0::initialize<SystemClock, 9600_Bd>();

// Enable interrupts, this is needed for every buffered UART
enableInterrupts();
Expand Down
5 changes: 2 additions & 3 deletions examples/avr/adc/basic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@

using namespace modm::platform;
using namespace modm::literals;
using systemClock = SystemClock;

int
main()
{
// Create a new UART object and configure it to a baudrate of 115200
Uart0::connect<GpioOutputD1::Txd, GpioInputD0::Rxd>();
Uart0::initialize<systemClock, 115200_Bd>();
Uart0::initialize<SystemClock, 115200_Bd>();

// Enable interrupts, this is needed for every buffered UART
enableInterrupts();
Expand All @@ -37,7 +36,7 @@ main()
// Initialize the analog to digital converter
// With the AVR running at 14.7456Mhz and a prescaler of 128 the
// ADC is running at 115kHz.
Adc::initialize<systemClock, 115_kHz>();
Adc::initialize<SystemClock, 115_kHz>();
Adc::setReference(Adc::Reference::InternalVcc);

// read the value of channel 0 (=> ADC0 => PA0) and wait until
Expand Down
5 changes: 2 additions & 3 deletions examples/avr/adc/oversample/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ using namespace modm::platform;
using namespace modm::literals;

// Create a new UART object
using systemClock = SystemClock;

#include <modm/io/iostream.hpp>
// Create a IOStream for complex formatting tasks
Expand All @@ -39,12 +38,12 @@ int
main()
{
Uart0::connect<GpioOutputD1::Txd, GpioInputD0::Rxd>();
Uart0::initialize<systemClock, 115200_Bd>();
Uart0::initialize<SystemClock, 115200_Bd>();

// Initialize the analog to digital converter
// With the AVR running at 14.7456Mhz and a prescaler of 128 the
// ADC is running at 115kHz.
Adc::initialize<systemClock, 115_kHz>();
Adc::initialize<SystemClock, 115_kHz>();
Adc::setReference(Adc::Reference::InternalVcc);
Adc::enableInterrupt();

Expand Down
3 changes: 1 addition & 2 deletions examples/avr/can/mcp2515/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

using namespace modm::platform;
using namespace modm::literals;
using systemClock = SystemClock;

typedef GpioOutputB4 Cs;
typedef GpioInputB2 Int;
Expand Down Expand Up @@ -51,7 +50,7 @@ main()
// Initialize SPI interface and the other pins
// needed by the MCP2515
SPI::connect<Sclk::Sck, Mosi::Mosi, Miso::Miso>();
SPI::initialize<systemClock, 921.6_kHz>();
SPI::initialize<SystemClock, 921.6_kHz>();
Cs::setOutput();
Int::setInput(Gpio::InputType::PullUp);

Expand Down
5 changes: 2 additions & 3 deletions examples/avr/can/mcp2515_uart/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

using namespace modm::platform;
using namespace modm::literals;
using systemClock = SystemClock;

typedef GpioOutputB0 LedGreen;
typedef GpioOutputB1 LedRed;
Expand Down Expand Up @@ -70,7 +69,7 @@ main()
OCR2A = 230;

Uart0::connect<GpioD1::Txd, GpioD0::Rxd>();
Uart0::initialize<systemClock, 115200_Bd>();
Uart0::initialize<SystemClock, 115200_Bd>();

// Create a IOStream for complex formatting tasks
modm::IODeviceWrapper< Uart0, modm::IOBuffer::BlockIfFull > device;
Expand All @@ -84,7 +83,7 @@ main()
// Initialize SPI interface and the other pins
// needed by the MCP2515
SPI::connect<Sclk::BitBang, Mosi::BitBang, Miso::BitBang>();
SPI::initialize<systemClock, 1_MHz>();
SPI::initialize<SystemClock, 1_MHz>();
Cs::setOutput();
Int::setInput(Gpio::InputType::PullUp);

Expand Down
3 changes: 1 addition & 2 deletions examples/avr/display/dogm128/benchmark/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
using namespace modm::platform;
using namespace modm::literals;

using systemClock = SystemClock;

namespace led
{
Expand Down Expand Up @@ -65,7 +64,7 @@ setup()
led::B::setOutput();

lcd::SPI::connect<lcd::Sck::BitBang, lcd::Mosi::BitBang>();
lcd::SPI::initialize<systemClock, 2_MHz>();
lcd::SPI::initialize<SystemClock, 2_MHz>();

// timer initialization
// compare-match-interrupt every 1 ms at 14.7456 MHz
Expand Down
3 changes: 1 addition & 2 deletions examples/avr/display/dogm128/caged_ball/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
using namespace modm::platform;
using namespace modm::literals;

using systemClock = SystemClock;

namespace led
{
Expand Down Expand Up @@ -56,7 +55,7 @@ main()
led::B::setOutput();

lcd::SPI::connect<lcd::Scl::BitBang, lcd::Mosi::BitBang>();
lcd::SPI::initialize<systemClock, 2_MHz>();
lcd::SPI::initialize<SystemClock, 2_MHz>();

display.initialize();

Expand Down
3 changes: 1 addition & 2 deletions examples/avr/display/dogm128/draw/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
using namespace modm::platform;
using namespace modm::literals;

using systemClock = SystemClock;

namespace led
{
Expand Down Expand Up @@ -56,7 +55,7 @@ main()
led::B::setOutput();

lcd::SPI::connect<lcd::Scl::BitBang, lcd::Mosi::BitBang>();
lcd::SPI::initialize<systemClock, 2_MHz>();
lcd::SPI::initialize<SystemClock, 2_MHz>();

display.initialize();

Expand Down
3 changes: 1 addition & 2 deletions examples/avr/display/dogm128/image/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
using namespace modm::platform;
using namespace modm::literals;

using systemClock = SystemClock;

namespace led
{
Expand Down Expand Up @@ -212,7 +211,7 @@ main()
led::B::setOutput();

lcd::SPI::connect<lcd::Sck::BitBang, lcd::Mosi::BitBang>();
lcd::SPI::initialize<systemClock, 2_MHz>();
lcd::SPI::initialize<SystemClock, 2_MHz>();

display.initialize();

Expand Down
3 changes: 1 addition & 2 deletions examples/avr/display/dogm128/text/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
using namespace modm::platform;
using namespace modm::literals;

using systemClock = SystemClock;

// LCD Backlight
namespace led
Expand Down Expand Up @@ -58,7 +57,7 @@ main()
led::B::setOutput();

SPI::connect< lcd::Scl::BitBang, lcd::Mosi::BitBang, lcd::Miso::BitBang >();
SPI::initialize<systemClock, 2_MHz>();
SPI::initialize<SystemClock, 2_MHz>();

display.initialize();

Expand Down
7 changes: 3 additions & 4 deletions examples/avr/display/dogm128/touch/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

using namespace modm::platform;
using namespace modm::literals;
using systemClock = SystemClock;

namespace touch
{
Expand Down Expand Up @@ -64,7 +63,7 @@ int
main()
{
Uart0::connect<GpioOutputD1::Txd, GpioInputD0::Rxd>();
Uart0::initialize<systemClock, 115200_Bd>();
Uart0::initialize<SystemClock, 115200_Bd>();

// Enable interrupts, this is needed for every buffered UART
enableInterrupts();
Expand All @@ -84,7 +83,7 @@ main()
led::B::setOutput();

lcd::SPI::connect<lcd::Scl::BitBang, lcd::Mosi::BitBang>();
lcd::SPI::initialize<systemClock, 2_MHz>();
lcd::SPI::initialize<SystemClock, 2_MHz>();

display.initialize();

Expand All @@ -97,7 +96,7 @@ main()

display.update();

Adc::initialize<systemClock, 115_kHz>();
Adc::initialize<SystemClock, 115_kHz>();
Adc::setReference(Adc::Reference::Internal2V56);

touch::Bottom::setInput();
Expand Down
3 changes: 1 addition & 2 deletions examples/avr/display/dogm132/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

using namespace modm::platform;
using namespace modm::literals;
using systemClock = SystemClock;

typedef GpioOutputD2 Cs;
typedef GpioOutputB6 Mosi;
Expand All @@ -41,7 +40,7 @@ main()
Backlight::set();

SPI::connect<Sck::BitBang, Mosi::BitBang>();
SPI::initialize<systemClock, 1_MHz>();
SPI::initialize<SystemClock, 1_MHz>();

display.initialize();
display.setFont(modm::font::Assertion);
Expand Down
3 changes: 1 addition & 2 deletions examples/avr/display/dogm163/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

using namespace modm::platform;
using namespace modm::literals;
using systemClock = SystemClock;

// Graphic LCD
namespace lcd
Expand All @@ -38,7 +37,7 @@ int
main()
{
SPI::connect<lcd::Scl::BitBang, lcd::Mosi::BitBang, lcd::Miso::BitBang>();
SPI::initialize<systemClock, 1_MHz>();
SPI::initialize<SystemClock, 1_MHz>();
lcd::Cs::setOutput();
lcd::Rs::setOutput();

Expand Down
3 changes: 1 addition & 2 deletions examples/avr/display/siemens_s65/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
using namespace modm::platform;
using namespace modm::literals;

using systemClock = SystemClock;

typedef GpioOutputA0 Mosi;
typedef GpioOutputA1 Sck;
Expand All @@ -35,7 +34,7 @@ int
main()
{
SPI::connect<Sck::BitBang, Mosi::BitBang>();
SPI::initialize<systemClock, 1_MHz>();
SPI::initialize<SystemClock, 1_MHz>();

Backlight::setOutput();
Backlight::set();
Expand Down
3 changes: 1 addition & 2 deletions examples/avr/logger/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

using namespace modm::platform;
using namespace modm::literals;
using systemClock = SystemClock;

// Create a new UART object and configure it to a baudrate of 115200
modm::IODeviceWrapper< Uart0, modm::IOBuffer::BlockIfFull > loggerDevice;
Expand All @@ -35,7 +34,7 @@ int
main()
{
Uart0::connect<GpioD1::Txd, GpioD0::Rxd>();
Uart0::initialize<systemClock, 115200_Bd>();
Uart0::initialize<SystemClock, 115200_Bd>();

// Enable interrupts, this is needed for every buffered UART
enableInterrupts();
Expand Down
3 changes: 1 addition & 2 deletions examples/avr/pwm/pca9685/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@

using namespace modm::platform;
using namespace modm::literals;
using systemClock = SystemClock;

int
main()
{
// Set-up the I2C device as master and configure it to a baudrate of 100.000
I2cMaster::initialize<systemClock, 100_kHz>();
I2cMaster::initialize<SystemClock, 100_kHz>();

// Enable interrupts
enableInterrupts();
Expand Down
3 changes: 1 addition & 2 deletions examples/avr/sab/slave/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

using namespace modm::platform;
using namespace modm::literals;
using systemClock = SystemClock;

// ----------------------------------------------------------------------------
// wrapper class for the A/D converter
Expand All @@ -32,7 +31,7 @@ class AnalogDigital : public modm::sab::Callable
AnalogDigital()
{
// initialize the analog to digital converter
Adc::initialize<systemClock, 115_kHz>();
Adc::initialize<SystemClock, 115_kHz>();
Adc::setReference(Adc::Reference::InternalVcc);
}

Expand Down
3 changes: 1 addition & 2 deletions examples/avr/uart/basic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@

using namespace modm::literals;
using namespace modm::platform;
using systemClock = SystemClock;

int
main()
{
Uart0::connect<GpioOutputD1::Txd, GpioInputD0::Rxd>();
Uart0::initialize<systemClock, 115200_Bd>();
Uart0::initialize<SystemClock, 115200_Bd>();

// Enable interrupts, this is needed for every buffered UART
enableInterrupts();
Expand Down
Loading

0 comments on commit 825c402

Please sign in to comment.