# HG changeset patch # User cin # Date 1484262662 -10800 # Node ID a0b14b11ad9fdc7ed5533ecf434390d305a2f216 # Parent 32a3b17856973eeff92c4b42927c2f55c2fef0d4 working on dependencies between MCU devices such as GPIO, Pins and Timers diff -r 32a3b1785697 -r a0b14b11ad9f halpp/include/gpio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/halpp/include/gpio.h Fri Jan 13 02:11:02 2017 +0300 @@ -0,0 +1,15 @@ +#pragma once + +namespace halpp { + + template class TGpio { + public: + + + }; + + template class TGpioPin { + + }; + +} diff -r 32a3b1785697 -r a0b14b11ad9f halpp/include/pwm.h --- a/halpp/include/pwm.h Thu Jan 12 02:45:43 2017 +0300 +++ b/halpp/include/pwm.h Fri Jan 13 02:11:02 2017 +0300 @@ -2,28 +2,46 @@ namespace halpp { - template class TPwmChannel1Traits { + template class TTimerTraits { public: - typedef uint32_t pulse_t; + typedef unsigned int pulse_t; + }; - static void SetPeriod(TTim& tim, pulse_t value) { - tim.CCR1 = value; + typedef enum { + Normal, + Inverse + } PwmPolarity; + + template class TPwmChannelTraits { + typedef typename TTimerTraits::pulse_t pulse_t; + public: + static void SetPulse(TTim& tim, pulse_t value) { } }; + template + template class TPwmChannel { + typedef typename TTraits::pulse_t pulse_t; private: TTim& m_tim; - explicit TPwmChannel(const TPwmChannel& self); + // deny copy constructor + explicit TPwmChannel(const TPwmChannel& self); public: TPwmChannel(TTim& tim): m_tim(tim) { } - void SetPulse(TTraits::pulse_t value) { + void SetPulse(pulse_t value) { TTraits::SetPeriod(m_tim, value); } + + void Enable() { + } + + void Disable() { + } }; } diff -r 32a3b1785697 -r a0b14b11ad9f l476rg-hal-test/.cproject --- a/l476rg-hal-test/.cproject Thu Jan 12 02:45:43 2017 +0300 +++ b/l476rg-hal-test/.cproject Fri Jan 13 02:11:02 2017 +0300 @@ -38,7 +38,7 @@