STM32F302x8 DEV

Below are the devices that are interal to the STM32F302x8 MCU. As such these devices are implemented directly for the STM32F302x8.

IWDG

class EVT::core::DEV::IWDGf3xx : public EVT::core::DEV::IWDG

Implementation of the independent watchdog for STM32f3xx MCUs, which use the low-speed internal RC oscillator to detect software failures and trigger a reset.

Public Functions

explicit IWDGf3xx(uint32_t ms)

Constructor for the IWDG, which also starts the watchdog timer.

Parameters

ms – Time in milliseconds before the IWDG triggers a reset, must be a value between 8 and 32768 ms.

virtual void init() override

Initializes and activates the watchdog timer.

virtual void refresh() override

Refreshes the watchdog timer.

RTC

class EVT::core::DEV::RTCf3xx : public EVT::core::DEV::RTC

RTC implementation that makes use of the on-board real time clock on STM32f3xx MCUs.

The onboard RTC can be kept up to date with a coin cell battery.

Public Functions

RTCf3xx()

Empty constructor.

Will startup the RTC.

virtual void getTime(EVT::core::time::TimeStamp &time) override

Get the current time as determined by the real time clock.

Parameters

time[out] The time struct to populate

virtual uint32_t getTime() override

Get the timestamp since epoch in seconds.

Returns

The time since epoch as determined by the RTC

virtual void setTime(EVT::core::time::TimeStamp &time) override

Set the time of the real time clock.

Parameters

time[in] The time to set the RTC to use.

Timer

class EVT::core::DEV::Timerf3xx : public EVT::core::DEV::Timer

Implementation of the Timer class for STM32f3xx MCUs.

Public Functions

explicit Timerf3xx(TIM_TypeDef *timerPeripheral, uint32_t clockPeriod)

Will initialize the timer device on the STM with the given period and the given IRQ Handler that triggers with the given period.

Starts the timer

Parameters
  • timerPeripheral[in] – The timer peripheral to configure. Possible options for this board are TIM2, TIM15, TIM16, TIM17. It is up to the user to verify that resource conflicts do not occur.

  • timerPeripheral[in] The timer to use

  • clockPeriod[in] the clock period in ms. An interrupt will be triggered at that frequency.

virtual void startTimer(void (*irqHandler)(void *htim)) override

Starts the given timer and registers the given interrupt pointer to trigger when the timer overflows.

Parameters

irqHandler[in] The IRQ Handler function pointer. Sets a new interrupt handler function

virtual void startTimer() override

Starts the given timer using the IRQ Handler already assigned to that timer.

virtual void stopTimer() override

Stops the current timer from running.

Does not complete its current counting sequence.

virtual void reloadTimer() override

Resets the timer counter.

virtual void setPeriod(uint32_t clockPeriod) override

Set the clock period for the timer.

Will stop the timer, re-initialize the device with the updated period. You must call startTimer again to continue timer operation.

Parameters

clockPeriod[in] the clock period in ms. An interrupt will be triggered at that frequency.