Cast around warnings in stm32_enc_init() and stm32_enc_set_counter().

Added casts to squash compiler warnings (as done in various other places in platform.c).