this is avaiable project
Fork of LoRaMacLib by
board/board.cpp@5:50aab2960e8c, 2015-09-23 (annotated)
- Committer:
- Alliance
- Date:
- Wed Sep 23 08:11:26 2015 +0000
- Revision:
- 5:50aab2960e8c
- Parent:
- 4:c1d2d1319c8f
Demo version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GregCr | 0:9be122c18509 | 1 | /* |
GregCr | 0:9be122c18509 | 2 | / _____) _ | | |
GregCr | 0:9be122c18509 | 3 | ( (____ _____ ____ _| |_ _____ ____| |__ |
GregCr | 0:9be122c18509 | 4 | \____ \| ___ | (_ _) ___ |/ ___) _ \ |
GregCr | 0:9be122c18509 | 5 | _____) ) ____| | | || |_| ____( (___| | | | |
GregCr | 0:9be122c18509 | 6 | (______/|_____)_|_|_| \__)_____)\____)_| |_| |
GregCr | 0:9be122c18509 | 7 | (C)2013 Semtech |
GregCr | 0:9be122c18509 | 8 | |
GregCr | 0:9be122c18509 | 9 | Description: Target board general functions implementation |
GregCr | 0:9be122c18509 | 10 | |
GregCr | 0:9be122c18509 | 11 | License: Revised BSD License, see LICENSE.TXT file include in the project |
GregCr | 0:9be122c18509 | 12 | |
GregCr | 0:9be122c18509 | 13 | Maintainer: Miguel Luis and Gregory Cristian |
GregCr | 0:9be122c18509 | 14 | */ |
GregCr | 0:9be122c18509 | 15 | #include "mbed.h" |
GregCr | 0:9be122c18509 | 16 | #include "board.h" |
GregCr | 0:9be122c18509 | 17 | #include "NVIC_set_all_priorities.h" |
GregCr | 0:9be122c18509 | 18 | |
GregCr | 0:9be122c18509 | 19 | /*! |
GregCr | 0:9be122c18509 | 20 | * Initializes the unused GPIO to a know status |
GregCr | 0:9be122c18509 | 21 | */ |
GregCr | 0:9be122c18509 | 22 | static void BoardUnusedIoInit( void ); |
GregCr | 0:9be122c18509 | 23 | |
GregCr | 0:9be122c18509 | 24 | /*! |
GregCr | 0:9be122c18509 | 25 | * Flag to indicate if the MCU is Initialized |
GregCr | 0:9be122c18509 | 26 | */ |
GregCr | 0:9be122c18509 | 27 | static bool McuInitialized = false; |
GregCr | 0:9be122c18509 | 28 | |
GregCr | 0:9be122c18509 | 29 | |
GregCr | 0:9be122c18509 | 30 | |
GregCr | 0:9be122c18509 | 31 | void BoardInitPeriph( void ) |
GregCr | 0:9be122c18509 | 32 | { |
GregCr | 0:9be122c18509 | 33 | |
GregCr | 0:9be122c18509 | 34 | } |
GregCr | 0:9be122c18509 | 35 | |
GregCr | 0:9be122c18509 | 36 | void BoardInitMcu( void ) |
GregCr | 0:9be122c18509 | 37 | { |
Alliance | 5:50aab2960e8c | 38 | NVIC_set_all_irq_priorities( 4 ); |
GregCr | 0:9be122c18509 | 39 | |
GregCr | 0:9be122c18509 | 40 | // Disable Systick |
Alliance | 5:50aab2960e8c | 41 | SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk; // Systick IRQ off |
Alliance | 5:50aab2960e8c | 42 | SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk; // Clear SysTick Exception pending flag |
GregCr | 0:9be122c18509 | 43 | |
GregCr | 0:9be122c18509 | 44 | TimerHwInit( ); |
GregCr | 0:9be122c18509 | 45 | } |
GregCr | 0:9be122c18509 | 46 | |
GregCr | 0:9be122c18509 | 47 | void BoardDeInitMcu( void ) |
GregCr | 0:9be122c18509 | 48 | { |
GregCr | 0:9be122c18509 | 49 | |
GregCr | 0:9be122c18509 | 50 | } |
GregCr | 0:9be122c18509 | 51 | |
GregCr | 0:9be122c18509 | 52 | void BoardGetUniqueId( uint8_t *id ) |
GregCr | 0:9be122c18509 | 53 | { |
GregCr | 0:9be122c18509 | 54 | id[0] = ( ( *( uint32_t* )ID1 )+ ( *( uint32_t* )ID3 ) ) >> 24; |
GregCr | 0:9be122c18509 | 55 | id[1] = ( ( *( uint32_t* )ID1 )+ ( *( uint32_t* )ID3 ) ) >> 16; |
GregCr | 0:9be122c18509 | 56 | id[2] = ( ( *( uint32_t* )ID1 )+ ( *( uint32_t* )ID3 ) ) >> 8; |
GregCr | 0:9be122c18509 | 57 | id[3] = ( ( *( uint32_t* )ID1 )+ ( *( uint32_t* )ID3 ) ); |
GregCr | 0:9be122c18509 | 58 | id[4] = ( ( *( uint32_t* )ID2 ) ) >> 24; |
GregCr | 0:9be122c18509 | 59 | id[5] = ( ( *( uint32_t* )ID2 ) ) >> 16; |
GregCr | 0:9be122c18509 | 60 | id[6] = ( ( *( uint32_t* )ID2 ) ) >> 8; |
GregCr | 0:9be122c18509 | 61 | id[7] = ( ( *( uint32_t* )ID2 ) ); |
GregCr | 0:9be122c18509 | 62 | } |
GregCr | 0:9be122c18509 | 63 | |
GregCr | 0:9be122c18509 | 64 | uint8_t BoardMeasureBatterieLevel( void ) |
GregCr | 0:9be122c18509 | 65 | { |
GregCr | 0:9be122c18509 | 66 | return 0xFE; |
GregCr | 0:9be122c18509 | 67 | } |
GregCr | 0:9be122c18509 | 68 | |
GregCr | 0:9be122c18509 | 69 | static void BoardUnusedIoInit( void ) |
GregCr | 0:9be122c18509 | 70 | { |
GregCr | 0:9be122c18509 | 71 | |
GregCr | 0:9be122c18509 | 72 | } |