11 #include PLATFORM_HEADER
22 WDOG_CFG = WDOG_ENABLE;
35 WDOG_CFG = WDOG_DISABLE;
41 if(WDOG_CFG&WDOG_ENABLE) {
50 static volatile uint32_t *
const configRegs[] =
51 { (
volatile uint32_t *)GPIO_PACFGL_ADDR,
52 (
volatile uint32_t *)GPIO_PACFGH_ADDR,
53 (
volatile uint32_t *)GPIO_PBCFGL_ADDR,
54 (
volatile uint32_t *)GPIO_PBCFGH_ADDR,
55 (
volatile uint32_t *)GPIO_PCCFGL_ADDR,
56 (
volatile uint32_t *)GPIO_PCCFGH_ADDR };
58 portcfg = *configRegs[io/4];
59 portcfg = portcfg & ~((0xF)<<((io&3)*4));
60 *configRegs[io/4] = portcfg | (config <<((io&3)*4));
67 *((
volatile uint32_t *)(GPIO_PxSET_BASE+(GPIO_Px_OFFSET*(gpio/8)))) =
BIT(gpio&7);
69 *((
volatile uint32_t *)(GPIO_PxCLR_BASE+(GPIO_Px_OFFSET*(gpio/8)))) =
BIT(gpio&7);
84 INT_CFGCLR = INT_SLEEPTMR;
87 #ifdef DIGITAL_OSC32_EXT
91 //Enable the 32kHz XTAL (and disable SlowRC since it is not needed)
92 SLEEPTMR_CLKEN = SLEEPTMR_CLK32KEN;
95 SLEEPTMR_CFG = (SLEEPTMR_ENABLE |
96 (0 << SLEEPTMR_DBGPAUSE_BIT)|
97 (5 << SLEEPTMR_CLKDIV_BIT) |
98 (1 << SLEEPTMR_CLKSEL_BIT)) ;
100 //Enable the SlowRC (and disable 32kHz XTAL since it is not needed)
101 SLEEPTMR_CLKEN = SLEEPTMR_CLK10KEN;
102 SLEEPTMR_CFG = (SLEEPTMR_ENABLE |
103 (0 << SLEEPTMR_DBGPAUSE_BIT)|
104 (0 << SLEEPTMR_CLKDIV_BIT) |
105 (0 << SLEEPTMR_CLKSEL_BIT)) ;
106 #ifndef DISABLE_RC_CALIBRATION
108 #endif//DISABLE_RC_CALIBRATION
109 #endif//ENABLE_OSC32K
112 INT_SLEEPTMRFLAG = (INT_SLEEPTMRWRAP | INT_SLEEPTMRCMPA | INT_SLEEPTMRCMPB);
114 INT_SLEEPTMRCFG = INT_SLEEPTMRCFG_RESET;
116 INT_CFGSET = INT_SLEEPTMR;
#define TRUE
An alias for one, used for clarity.
void halGpioConfig(uint32_t io, uint32_t config)
Configure an IO pin's operating mode.
#define BIT(x)
Useful to reference a single bit of a byte.
void halInternalEnableWatchDog(void)
Enables the watchdog timer.
Utility and convenience functions for STM32W108 microcontroller, common to both the full and minimal ...
void halInternalDisableWatchDog(uint8_t magicKey)
Disables the watchdog timer.
void halGpioSet(uint32_t gpio, boolean value)
Set/Clear single GPIO bit.
boolean halInternalWatchDogEnabled(void)
Determines whether the watchdog has been enabled or disabled.
void halInternalResetWatchDog(void)
Resets the watchdog timer.
Minimal Hal functions common across all microcontroller-specific files.
#define MICRO_DISABLE_WATCH_DOG_KEY
The value that must be passed as the single parameter to halInternalDisableWatchDog() in order to suc...
#define FALSE
An alias for zero, used for clarity.
uint16_t halInternalStartSystemTimer(void)
Initializes the system tick.
void halInternalCalibrateSlowRc(void)
Calibrates the internal SlowRC to generate a 1024 Hz (1kHz) clock.