Basic test to see if it is possible to access the low level hardware in the online compiler. It seems that it is possible. Would need much more work to get it running.

Dependencies:   mbed

Committer:
skyscraper
Date:
Wed Sep 12 18:22:01 2018 +0000
Revision:
0:c1a4bf56f1de
Quick test to see if it is possible to access the hardware  in the embed online compiler. Seems so but havent tried running it!

Who changed what in which revision?

UserRevisionLine numberNew contents of line
skyscraper 0:c1a4bf56f1de 1
skyscraper 0:c1a4bf56f1de 2 #include "stm32f4xx_hal.h"
skyscraper 0:c1a4bf56f1de 3
skyscraper 0:c1a4bf56f1de 4 /*
skyscraper 0:c1a4bf56f1de 5 Use TIM2 as encoder Encoder pins on PA0 and PA1
skyscraper 0:c1a4bf56f1de 6 */
skyscraper 0:c1a4bf56f1de 7
skyscraper 0:c1a4bf56f1de 8 int main() {
skyscraper 0:c1a4bf56f1de 9
skyscraper 0:c1a4bf56f1de 10
skyscraper 0:c1a4bf56f1de 11 RCC->APB1ENR |= (1U << 0U) ; // Enable TIM2 module
skyscraper 0:c1a4bf56f1de 12 RCC->AHB1ENR |= (1U << 0U); // enable GPIOA module
skyscraper 0:c1a4bf56f1de 13
skyscraper 0:c1a4bf56f1de 14 /* TODO:
skyscraper 0:c1a4bf56f1de 15 set up the above pins as Alternate function AF1 TIMER2
skyscraper 0:c1a4bf56f1de 16 Setup TIM2 as quadrature encoder
skyscraper 0:c1a4bf56f1de 17
skyscraper 0:c1a4bf56f1de 18 or quadrature encoder setup on F401 but with a different syntax
skyscraper 0:c1a4bf56f1de 19 See https://github.com/kwikius/quantracker/blob/master/ground/tracker/v1/azimuth_encoder.cpp
skyscraper 0:c1a4bf56f1de 20 */
skyscraper 0:c1a4bf56f1de 21 }