# HG changeset patch # User cin # Date 1484690879 -10800 # Node ID 3d9705e842f8e75f55599347149dfbb228ea7775 # Parent 0c59e7a7782a294d286d99c70b47012dceb70a4b working on rcc and bus diff -r 0c59e7a7782a -r 3d9705e842f8 f103c8/.settings/language.settings.xml --- a/f103c8/.settings/language.settings.xml Mon Jan 16 11:04:47 2017 +0300 +++ b/f103c8/.settings/language.settings.xml Wed Jan 18 01:07:59 2017 +0300 @@ -4,7 +4,7 @@ - + diff -r 0c59e7a7782a -r 3d9705e842f8 f103c8/f103c8.elf.launch --- a/f103c8/f103c8.elf.launch Mon Jan 16 11:04:47 2017 +0300 +++ b/f103c8/f103c8.elf.launch Wed Jan 18 01:07:59 2017 +0300 @@ -1,46 +1,53 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0c59e7a7782a -r 3d9705e842f8 halpp/.settings/language.settings.xml --- a/halpp/.settings/language.settings.xml Mon Jan 16 11:04:47 2017 +0300 +++ b/halpp/.settings/language.settings.xml Wed Jan 18 01:07:59 2017 +0300 @@ -4,7 +4,7 @@ - + @@ -14,7 +14,7 @@ - + diff -r 0c59e7a7782a -r 3d9705e842f8 halpp/include/gpio.h --- a/halpp/include/gpio.h Mon Jan 16 11:04:47 2017 +0300 +++ b/halpp/include/gpio.h Wed Jan 18 01:07:59 2017 +0300 @@ -25,43 +25,34 @@ GpioOpenDrain = 1 } GpioOutputType; - template class TGpio { - TDev& m_dev; - - explicit TGpio(const TGpio& ref); + template class TGpioTraits { + explicit TGpioTraits(const TGpioTraits&); + TGpioTraits(); public: - TGpio(TDev& dev) : m_dev(dev) { - + static void SetPinSpeed(unsigned short pin, GpioSpeed speed) { + TDev::instance().OSPEEDR = (TDev::instance().OSPEED & (~(3U << (pin * 2)))) | (speed << (pin * 2)); } - void SetPinSpeed(unsigned short pin, GpioSpeed speed) { - m_dev.OSPEEDR = (m_dev.OSPEED & (~(3U << (pin * 2)))) | (speed << (pin * 2)); + static void SetPinMode(unsigned short pin, GpioMode mode) { + TDev::instance().MODER = (TDev::instance().MODER & (~(3U << (pin * 2)))) | (mode << (pin * 2)); } - void SetPinMode(unsigned short pin, GpioMode mode) { - m_dev.MODER = (m_dev.MODER & (~(3U << (pin * 2)))) | (mode << (pin * 2)); - } - - void SetPinPullMode(unsigned short pin, GpioPullMode mode) { - m_dev.PUPDR = (m_dev.PUPDR & (~(3U << (pin * 2)))) | (mode << (pin * 2)); + static void SetPinPullMode(unsigned short pin, GpioPullMode mode) { + TDev::instance().PUPDR = (TDev::instance().PUPDR & (~(3U << (pin * 2)))) | (mode << (pin * 2)); } - void SetPinOutputType(unsigned short pin, GpioOutputType type) { - m_dev.OTYPER = (m_dev.OTYPER & (~(1U << pin))) | (type << pin); + static void SetPinOutputType(unsigned short pin, GpioOutputType type) { + TDev::instance().OTYPER = (TDev::instance().OTYPER & (~(1U << pin))) | (type << pin); } - void TooglePin(unsigned short pin) { - m_dev.ODR ^= 1U << pin; + static void TooglePin(unsigned short pin) { + TDev::instance().ODR ^= 1U << pin; } - void WritePin(unsigned short pin, unsigned short value) { - m_dev.ODR = (m_dev.ODR & (~(1U << pin))) | ((value & 1U) << pin); + static void WritePin(unsigned short pin, unsigned short value) { + TDev::instance().ODR = (TDev::instance().ODR & (~(1U << pin))) | ((value & 1U) << pin); } }; - template class TGpioPin { - - }; - } diff -r 0c59e7a7782a -r 3d9705e842f8 l476rg-hal-test/.cproject --- a/l476rg-hal-test/.cproject Mon Jan 16 11:04:47 2017 +0300 +++ b/l476rg-hal-test/.cproject Wed Jan 18 01:07:59 2017 +0300 @@ -131,20 +131,20 @@ -