Commit Graph

7 Commits

Author SHA1 Message Date
Nico Tonnhofer 426ffb9420 timer-stm32: correct some init code
clear status register first
and enable the counter
2019-04-17 21:42:28 +02:00
Nico Tonnhofer b62bad1b0a stm32: rename __ARM_STM32F411__ to __ARM_STM32__ 2019-04-17 21:42:28 +02:00
Nico Tonnhofer d9a350749d STM32F411: save cpu cycles are 160
Also, first interrupt should not occur at 0.
2017-03-03 18:54:57 +01:00
Nico Tonnhofer 14a4980ea1 STM32F411: implement the stepper interrupt. 2017-03-03 18:54:56 +01:00
Nico Tonnhofer 42b26d9c20 STM32F411: get clock.c in.
No code changes neccessary.

This code in ifclock(clock_flag_1s) in clock.c should give a nice,
accurate clock:

    static uint8_t minutes = 0, seconds = 0;

    seconds++;
    if ( ! (seconds % 60)) {
      seconds = 0;
      minutes++;
    }
    sersendf_P(PSTR("%su:"), minutes);
    if (seconds < 10)
      serial_writechar('0');
    sersendf_P(PSTR("%su\n"), seconds);

Current sizes are:

    SIZES          ARM...     stm32f411
    FLASH  :  4464 bytes           1%
    RAM    :   204 bytes           1%
    EEPROM :     0 bytes           0%
2017-03-03 18:54:56 +01:00
Nico Tonnhofer a798cfac34 STM32F411: get timer.c in, so far only with the system clock.
This test code in SysTickHandler() should give you a rather
accurate clock with only a few seconds deviation per hour:

  #include "serial.h"
  #include "sersendf.h"
  void SysTick_Handler(void) {
    static uint32_t count = 0;
    static uint8_t minutes = 0, seconds = 0;

    count++;

    if ( ! (count % 500)) {   // A full second.
      seconds++;
      if ( ! (seconds % 60)) {
        seconds = 0;
        minutes++;
      }
      sersendf_P(PSTR("%su:"), minutes);
      if (seconds < 10)
        serial_writechar('0');
      sersendf_P(PSTR("%su\n"), seconds);
    }
  [...]
2017-03-03 18:54:56 +01:00
Nico Tonnhofer 65dab6b180 STM32F411: create timer-stm32.c
Empty, so far.
2017-03-03 18:54:56 +01:00