summaryrefslogtreecommitdiff
path: root/ucoo/hal/gpio
diff options
context:
space:
mode:
authorNicolas Schodet2015-05-04 10:07:47 +0200
committerNicolas Schodet2019-10-07 00:44:50 +0200
commit9fe68a0e7b216f8142d6b0423d5cf8fc08ec7091 (patch)
tree6325e2bdec2070c6f8063d4c55de189d2c9d4e0b /ucoo/hal/gpio
parenta91aa1aad65c5f5da38511175c79a72c019b271b (diff)
ucoo/hal: use enum class
Diffstat (limited to 'ucoo/hal/gpio')
-rw-r--r--ucoo/hal/gpio/gpio.stm32f4.cc6
-rw-r--r--ucoo/hal/gpio/gpio.stm32f4.hh10
2 files changed, 9 insertions, 7 deletions
diff --git a/ucoo/hal/gpio/gpio.stm32f4.cc b/ucoo/hal/gpio/gpio.stm32f4.cc
index 1b46fd5..3ee060a 100644
--- a/ucoo/hal/gpio/gpio.stm32f4.cc
+++ b/ucoo/hal/gpio/gpio.stm32f4.cc
@@ -93,13 +93,15 @@ Gpio::output ()
void
Gpio::pull (Pull dir)
{
- GPIO_PUPDR (port_) = dmask_set (mask_, GPIO_PUPDR (port_), dir);
+ GPIO_PUPDR (port_) = dmask_set (mask_, GPIO_PUPDR (port_),
+ static_cast<uint32_t> (dir));
}
void
Gpio::speed (Speed s)
{
- GPIO_OSPEEDR (port_) = dmask_set (mask_, GPIO_OSPEEDR (port_), s);
+ GPIO_OSPEEDR (port_) = dmask_set (mask_, GPIO_OSPEEDR (port_),
+ static_cast<uint32_t> (s));
}
} // namespace ucoo
diff --git a/ucoo/hal/gpio/gpio.stm32f4.hh b/ucoo/hal/gpio/gpio.stm32f4.hh
index 325511e..01f3661 100644
--- a/ucoo/hal/gpio/gpio.stm32f4.hh
+++ b/ucoo/hal/gpio/gpio.stm32f4.hh
@@ -33,13 +33,13 @@ namespace ucoo {
class Gpio : public Io
{
public:
- enum Pull
+ enum class Pull : uint32_t
{
- PULL_NONE = GPIO_PUPD_NONE,
- PULL_UP = GPIO_PUPD_PULLUP,
- PULL_DOWN = GPIO_PUPD_PULLDOWN,
+ NONE = GPIO_PUPD_NONE,
+ UP = GPIO_PUPD_PULLUP,
+ DOWN = GPIO_PUPD_PULLDOWN,
};
- enum Speed
+ enum class Speed : uint32_t
{
SPEED_2MHZ = GPIO_OSPEED_2MHZ,
SPEED_25MHZ = GPIO_OSPEED_25MHZ,