Fixed with HAL.

Fork of ST_L152_32MHZ by Peter Drescher

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ST_L152_32MHZ.h Source File

ST_L152_32MHZ.h

00001 /* mbed library for the ST NUCLEO board L152RE 
00002  * to change the CPU clock to 32 MHz
00003  * A pll clock of 96 MHz is used to enable USB  
00004  *
00005  * Copyright (c) 2014 Peter Drescher - DC2PD
00006  * Released under the MIT License: http://mbed.org/license/mit
00007  *
00008  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00009  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00010  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00011  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00012  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00013  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00014  * THE SOFTWARE.
00015  */
00016  
00017  
00018 #ifndef MBED_ST_L152_32MHZ_H
00019 #define MBED_ST_L152_32MHZ_H
00020 
00021 /** Setup cpu speed to 32 MHz
00022  *
00023  * @code
00024  * #include "mbed.h"
00025  * #include "ST_L152_32MHZ.h"
00026  *
00027  * // place the init before other code to ensure right timing of other objects !
00028  * L152_init32 myinit(0);   // use the internal oscillator 
00029  * 
00030  */
00031 
00032 typedef enum { OK = 0 , PLL_ERR, EXT_ERR }ClockStatus;
00033 
00034 class L152_init32
00035 {
00036 public:
00037  /** Create a L152_init32 object to change the clock
00038    * @param external = 0 use internal oscillator
00039    * @param external = 1 use external 8 MHz crystal - you have to add some comonents to the pcb !
00040 */
00041 L152_init32(unsigned int external);
00042 ClockStatus Status;
00043 
00044 protected:
00045 // do the magic ;-)
00046 ClockStatus setup_clock_32MHZ(int external);
00047 };
00048 
00049 #endif
00050 
00051