# HG changeset patch # User cin # Date 1485128417 -10800 # Node ID ca42336826bd53c033598198874e348758ff1e00 # Parent 0d3eea2dd7ea1f2145bf2b924ebd3d19a46ce87d working on clock sources diff -r 0d3eea2dd7ea -r ca42336826bd f103c8/.settings/language.settings.xml --- a/f103c8/.settings/language.settings.xml Fri Jan 20 03:40:30 2017 +0300 +++ b/f103c8/.settings/language.settings.xml Mon Jan 23 02:40:17 2017 +0300 @@ -4,7 +4,7 @@ - + diff -r 0d3eea2dd7ea -r ca42336826bd halpp/.settings/language.settings.xml --- a/halpp/.settings/language.settings.xml Fri Jan 20 03:40:30 2017 +0300 +++ b/halpp/.settings/language.settings.xml Mon Jan 23 02:40:17 2017 +0300 @@ -4,7 +4,7 @@ - + @@ -14,7 +14,7 @@ - + diff -r 0d3eea2dd7ea -r ca42336826bd l476rg-hal-test/.settings/language.settings.xml --- a/l476rg-hal-test/.settings/language.settings.xml Fri Jan 20 03:40:30 2017 +0300 +++ b/l476rg-hal-test/.settings/language.settings.xml Mon Jan 23 02:40:17 2017 +0300 @@ -4,7 +4,7 @@ - + @@ -14,7 +14,7 @@ - + diff -r 0d3eea2dd7ea -r ca42336826bd l476rg-hal-test/src/main.cpp --- a/l476rg-hal-test/src/main.cpp Fri Jan 20 03:40:30 2017 +0300 +++ b/l476rg-hal-test/src/main.cpp Mon Jan 23 02:40:17 2017 +0300 @@ -49,7 +49,7 @@ public: typedef TCounter counter_t; - static void Init() { + static void init() { TDev::instance()->EGR = TIM_EGR_UG; } @@ -111,32 +111,38 @@ class AHB2Bus { public: - static void Enable(unsigned int flag) { + static void enable(unsigned int flag) { RCC->AHB2ENR |= flag; } + + static uint32_t clock() { + + } }; class APB1Bus { public: - static void Enable(unsigned int flag) { + static void enable(unsigned int flag) { RCC->APB1ENR1 |= flag; } }; class APB1Bus2 { - static void Enable(uint32_t flag) { + static void enable(uint32_t flag) { RCC->APB1ENR2 |= flag; } }; -template class TDevice { +template class TDevice { public: + typedef TBus bus_t; + static TRegs* instance() { return (TRegs*) BASE; } - static void Enable() { - TBus::Enable(ENF); + static void enable() { + TBus::enable(ENF); } static uint32_t frequency() { @@ -144,6 +150,75 @@ } }; +class OscMsi { +}; + +class OscHsi { +}; + +class OscHse { +}; + +class OscLsi { +}; + +class OscLse { +}; + +class Pll { +}; + +class Pclk1 { +public: + uint32_t clock() { + return APB1Bus::clock(); + } +}; + +class Rcc { +public: + typedef enum { + PClk1, + Apb1TimerClk, + PClk2, + Apb2TimerClk, + HClk, + SysClk, + HsiClk, + HseClk, + LsiClk, + LseClk, + MsiClk, + PllClk, + PllQClk, + PllPClk, + PllSai1P, + PllSai1Q, + PllSai1R, + PllSai2P, + PllSai2R + } ClockSource; + + template unit32_t clock(); +}; + +class SysClk { +public: + uint32_t clock() { + } +}; + +class UartClockMux { +public: + template void select_clock_source(); +}; + +template<> void UartClockMux::select_clock_source() { +} + +template<> void UartClockMux::select_clock_source() { +} + class Hardware { public: typedef TDevice GpioA; diff -r 0d3eea2dd7ea -r ca42336826bd l476rg/.settings/language.settings.xml --- a/l476rg/.settings/language.settings.xml Fri Jan 20 03:40:30 2017 +0300 +++ b/l476rg/.settings/language.settings.xml Mon Jan 23 02:40:17 2017 +0300 @@ -4,7 +4,7 @@ - +