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::IWDGf302x8 : public EVT::core::DEV::IWDG

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

Public Functions

IWDGf302x8(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 refresh()

Refreshes the watchdog timer.

RTC

class EVT::core::DEV::RTCf302x8 : public EVT::core::DEV::RTC

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

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

Public Functions

RTCf302x8()

Empty constructor.

Will startup the RTC.

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

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

Parameters

time[out] The time struct to populate

virtual uint32_t getTime()

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)

Set the time of the real time clock.

Parameters

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

Timer

class EVT::core::DEV::Timerf302x8 : public EVT::core::DEV::Timer

Implementation of the Timer class for the f302x8 uC.

Public Functions

explicit Timerf302x8(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)

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.