KETCube
|
This file contains the KETCube MCU implementations. More...
#include "debug.h"
#include "ketCube_mcu.h"
#include "ketCube_resetMan.h"
#include "ketCube_coreCfg.h"
#include "timeServer.h"
#include "stm32l0xx_hal_pwr.h"
#include "ketCube_gpio.h"
#include "ketCube_spi.h"
#include "ketCube_uart.h"
#include "ketCube_radio.h"
Macros | |
#define | BACKUP_PRIMASK() uint32_t primask_bit= __get_PRIMASK() |
#define | DISABLE_IRQ() __disable_irq() |
#define | ENABLE_IRQ() __enable_irq() |
#define | RESTORE_PRIMASK() __set_PRIMASK(primask_bit) |
#define | ID1 ( 0x1FF80050 ) |
Unique Devices IDs register set ( STM32L0xxx ) More... | |
#define | ID2 ( 0x1FF80054 ) |
#define | ID3 ( 0x1FF80064 ) |
#define | SYSHND_CTRL (*(volatile unsigned int*) (0xE000ED24u)) |
#define | NVIC_MFSR (*(volatile unsigned char*) (0xE000ED28u)) |
#define | NVIC_BFSR (*(volatile unsigned char*) (0xE000ED29u)) |
#define | NVIC_UFSR (*(volatile unsigned short*)(0xE000ED2Au)) |
#define | NVIC_HFSR (*(volatile unsigned int*) (0xE000ED2Cu)) |
#define | NVIC_DFSR (*(volatile unsigned int*) (0xE000ED30u)) |
#define | NVIC_BFAR (*(volatile unsigned int*) (0xE000ED38u)) |
#define | NVIC_AFSR (*(volatile unsigned int*) (0xE000ED3Cu)) |
Functions | |
uint32_t | ketCube_MCU_GetRandomSeed (void) |
This function return a random seed. More... | |
void | ketCube_MCU_GetUniqueId (uint8_t *id) |
This function returns a unique MCU ID. More... | |
void | ketCube_MCU_SetSleepMode (ketCube_mcu_LPMode_t mode) |
Select sleep mode. More... | |
ketCube_mcu_LPMode_t | ketCube_MCU_GetSleepMode (void) |
Get current sleep mode. More... | |
void | ketCube_MCU_EnableSleep (void) |
Enable low power mode ... More... | |
void | ketCube_MCU_DisableSleep (void) |
Disable low power mode ... More... | |
bool | ketCube_MCU_IsSleepEnabled (void) |
Disable low power mode ... More... | |
static void | ketCube_MCU_ExitStopMode (void) |
Exists Low Power Stop Mode. More... | |
void | ketCube_MCU_EnterStopMode (void) |
Enters Low Power Stop Mode. More... | |
void | ketCube_MCU_EnterSleepMode (void) |
Enters Low Power Sleep Mode. More... | |
void | ketCube_MCU_ExitSleepMode (void) |
Exit Low Power Sleep Mode. More... | |
void | ketCube_MCU_Sleep (void) |
Handle KETCube LowPower mode(s) More... | |
void | ketCube_MCU_ClockConfig (void) |
Clock Configuration The system Clock is configured as follows: System Clock source = PLL (HSI) SYSCLK(Hz) = 32000000 HCLK(Hz) = 32000000 AHB Prescaler = 1 APB1 Prescaler = 1 APB2 Prescaler = 1 HSI Frequency(Hz) = 16000000 PLLMUL = 6 PLLDIV = 3 Flash Latency(WS) = 1. More... | |
void | ketCube_MCU_SleepClockConfig (void) |
Clock Configuration The system Clock is configured as follows: System Clock source = MSI MSI(Hz) = 65000. More... | |
void | ketCube_MCU_RunClockConfig (void) |
Clock Configuration The system Clock is configured as follows: System Clock source = MSI HSI(Hz) = 32000000. More... | |
void | ketCube_MCU_WD_Monitor (void *context) |
Monitor WakeUp reasoning. More... | |
void | ketCube_MCU_WD_Init (void) |
KETCube Watchdog (IWDG) Setup. More... | |
void | ketCube_MCU_WD_Reset (void) |
KETCube Watchdog (IWDG) Reset. More... | |
static void | ketCube_VoltageDet_Init (void) |
KETCube Voltage Detector init. More... | |
void | PVD_IRQHandler (void) |
Programmable Voltage Detector (PVD) IRQ. More... | |
void | HAL_PWR_PVDCallback (void) |
Programmable Voltage Detector (PVD) Callback. More... | |
void | HAL_MspInit (void) |
Initializes the MSP. More... | |
void | HardFaultHandler (unsigned int *pStack) |
Advanced HardFault handler. More... | |
void | ketCube_MCU_DumpHardFaultRegs (ketCube_MCU_HardFaultRegs_t *HardFaultRegs) |
Dump HardFault Register Content. More... | |
Variables | |
static volatile bool | enableSleep = TRUE |
static TimerEvent_t | KETCube_WDCheckTimer |
static IWDG_HandleTypeDef | hiwdg |
PWR_PVDTypeDef | sConfigPVD = {0} |
volatile bool | ketCube_MCU_PVD_Det = FALSE |
static volatile bool | ketCube_MCU_WD_timWake = FALSE |
volatile ketCube_mcu_LPMode_t | ketCube_MCU_LPMode = KETCUBE_MCU_LPMODE_SLEEP |
Low-Power mode selection. More... | |
static volatile bool | HardFaultHandler_ContinueA = TRUE |
Set THIS variables to FALSE if you would like to debug HardFault with debug probe instead of using KETCube's way. More... | |
static volatile bool | HardFaultHandler_ContinueB = TRUE |
Set THIS variables to FALSE if you would like to debug HardFault with debug probe instead of using KETCube's way. More... | |
This file contains the KETCube MCU implementations.
Developed by: The SmartCampus Team Department of Technologies and Measurement www.smartcampus.cz | www.zcu.cz
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
#define BACKUP_PRIMASK | ( | ) | uint32_t primask_bit= __get_PRIMASK() |
#define DISABLE_IRQ | ( | ) | __disable_irq() |
#define ENABLE_IRQ | ( | ) | __enable_irq() |
#define ID1 ( 0x1FF80050 ) |
Unique Devices IDs register set ( STM32L0xxx )
#define ID2 ( 0x1FF80054 ) |
#define ID3 ( 0x1FF80064 ) |
#define NVIC_AFSR (*(volatile unsigned int*) (0xE000ED3Cu)) |
#define NVIC_BFAR (*(volatile unsigned int*) (0xE000ED38u)) |
#define NVIC_BFSR (*(volatile unsigned char*) (0xE000ED29u)) |
#define NVIC_DFSR (*(volatile unsigned int*) (0xE000ED30u)) |
#define NVIC_HFSR (*(volatile unsigned int*) (0xE000ED2Cu)) |
#define NVIC_MFSR (*(volatile unsigned char*) (0xE000ED28u)) |
#define NVIC_UFSR (*(volatile unsigned short*)(0xE000ED2Au)) |
#define RESTORE_PRIMASK | ( | ) | __set_PRIMASK(primask_bit) |
#define SYSHND_CTRL (*(volatile unsigned int*) (0xE000ED24u)) |
void HAL_MspInit | ( | void | ) |
Initializes the MSP.
None |
void HAL_PWR_PVDCallback | ( | void | ) |
Programmable Voltage Detector (PVD) Callback.
void HardFaultHandler | ( | unsigned int * | pStack | ) |
Advanced HardFault handler.
void ketCube_MCU_EnterSleepMode | ( | void | ) |
Enters Low Power Sleep Mode.
void ketCube_MCU_EnterStopMode | ( | void | ) |
Enters Low Power Stop Mode.
void ketCube_MCU_ExitSleepMode | ( | void | ) |
Exit Low Power Sleep Mode.
|
static |
Exists Low Power Stop Mode.
void ketCube_MCU_WD_Monitor | ( | void * | context | ) |
Monitor WakeUp reasoning.
|
static |
KETCube Voltage Detector init.
void PVD_IRQHandler | ( | void | ) |
Programmable Voltage Detector (PVD) IRQ.
|
static |
|
static |
Set THIS variables to FALSE if you would like to debug HardFault with debug probe instead of using KETCube's way.
|
static |
Set THIS variables to FALSE if you would like to debug HardFault with debug probe instead of using KETCube's way.
|
static |
volatile bool ketCube_MCU_PVD_Det = FALSE |
|
static |
|
static |
PWR_PVDTypeDef sConfigPVD = {0} |