Browse Source
Despite the L1 being a low power device, my initial focus is on making it basically compatible with existing devices. To that end, provide clock setup helper routines that configure it for maximum performance, allowing some similar clock speeds to F1 devices to help with testing. This requires adding the power chipset routines to set the voltage range. Clock setup style is similar to the F4 code, which seems nicer than the overflow of different routines used on the F1 code. NOTE: Both the F4 existing pwr code, and this code don't actually include the f1 core power code, even though it should be compatiblepull/67/head
Karl Palsson
12 years ago
4 changed files with 192 additions and 15 deletions
@ -0,0 +1,37 @@ |
|||
/*
|
|||
* This file is part of the libopencm3 project. |
|||
* |
|||
* Copyright (C) 2012 Karl Palsson <karlp@tweak.net.au> |
|||
* |
|||
* This library is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU Lesser General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public License |
|||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
#include <libopencm3/stm32/l1/pwr.h> |
|||
|
|||
void pwr_set_vos_scale(vos_scale_t scale) |
|||
{ |
|||
PWR_CR &= ~(PWR_CR_VOS_MASK); |
|||
switch (scale) { |
|||
case RANGE1: |
|||
PWR_CR |= PWR_CR_VOS_RANGE1; |
|||
break; |
|||
case RANGE2: |
|||
PWR_CR |= PWR_CR_VOS_RANGE2; |
|||
break; |
|||
case RANGE3: |
|||
PWR_CR |= PWR_CR_VOS_RANGE3; |
|||
break; |
|||
} |
|||
} |
|||
|
Loading…
Reference in new issue