1. 15 Jun, 2017 1 commit
  2. 06 May, 2017 1 commit
  3. 18 Apr, 2017 1 commit
    • Henrik Sölver's avatar
      stmhal/timer: Clear interrupt flag before setting callback. · 1f3887dc
      Henrik Sölver authored
      Sometimes when setting a channel callback the callback fires immediately,
      even if the compare register is set to a value far into the future. This
      happens when the free running counter has previously been equal to what
      happens to be in the compare register.
      This patch make sure that there is no pending interrupt when setting a
  4. 20 Mar, 2017 1 commit
    • Damien George's avatar
      stmhal: Enable micropython.schedule(). · a5159edc
      Damien George authored
      ExtInt, Timer and CAN IRQ callbacks are made to work with the scheduler.
      They are still hard IRQs by default, but one can now call
      micropython.schedule within the hard IRQ to schedule a soft callback.
  5. 04 Jan, 2017 1 commit
  6. 22 Aug, 2016 2 commits
    • Damien George's avatar
      stmhal: Remove obsolete code for special handling of TIM3 irq settings. · d2d9dfcd
      Damien George authored
      TIM3 is no longer special, or at least does not have special IRQ settings.
    • Dave Hylands's avatar
      stmhal: Fix timer capture/compare interrupt handling for TIM1 and TIM8. · c6983e3c
      Dave Hylands authored
      It turns out that TIM1 and TIM8 have their own Capture/Compare
      interrupt vector. For all of the other timers, the capture/compare
      interrupt vector is the same as the update vector.
      So we need to add handlers for these vectors and enable them
      when using capture/compare callbacks.
      During testing of this, I also found that passing a channel callback
      into the channel constructor would not enable interrupts properly.
      I tested using:
      >>> pyb.Timer(1, freq=4).channel(1, pyb.Timer.OC_TOGGLE, callback=lambda t: print('.', end=''))
      I tested the above with channels 1, 4, and 8
  7. 17 Apr, 2016 1 commit
  8. 29 Jan, 2016 3 commits
    • Damien George's avatar
      stmhal: Add PWM capability for LED(3) and LED(4) on pyboards. · a8a4b01a
      Damien George authored
      USB CDC no longer needs TIM3 (which was originally used for LED(4) PWM)
      and so TIM3 has been freed for general purpose use by the user.  Hence
      LED(4) lost its PWM capabilities.
      This patch reinstates the PWM capabilities using a semi-generic piece
      of code which allows to configure a timer and PWM channel to use for any
      LED.  But the PWM capability is only configured if the LED is set to an
      intensity between 1 and 254 (ie only when needed).  In that case the
      relevant timer is configured for PWM.  It's up to the user to make sure
      the timers are not used if PWM is active.
      This patch also makes sure that PWM LEDs are turned off using standard
      GPIO when calling led.off() or led.intensity(0), instead of just setting
      the PWM counter to zero.
    • Damien George's avatar
      stmhal: Make TIM3 available for use by the user. · ea89b80f
      Damien George authored
      TIM3 is no longer used by USB CDC for triggering outgoing data, so we
      can now make it available to the user.
      PWM fading on LED(4) is now gone, but will be reinstated in a new way.
    • Damien George's avatar
      stmhal: Make USB CDC driver use SOF instead of TIM3 for outgoing data. · d3631339
      Damien George authored
      Previous to this patch the USB CDC driver used TIM3 to trigger the
      sending of outgoing data over USB serial.  This patch changes the
      behaviour so that the USB SOF interrupt is used to trigger the processing
      of the sending.  This reduces latency and increases bandwidth of outgoing
      Thanks to Martin Fischer, aka @hoihu, for the idea and initial prototype.
      See PR #1713.
  9. 11 Jan, 2016 1 commit
    • Damien George's avatar
      py: Change first arg of type.make_new from mp_obj_t to mp_obj_type_t*. · 5b3f0b7f
      Damien George authored
      The first argument to the type.make_new method is naturally a uPy type,
      and all uses of this argument cast it directly to a pointer to a type
      structure.  So it makes sense to just have it a pointer to a type from
      the very beginning (and a const pointer at that).  This patch makes
      such a change, and removes all unnecessary casting to/from mp_obj_t.
  10. 09 Dec, 2015 1 commit
  11. 04 Dec, 2015 1 commit
    • Damien George's avatar
      stmhal: Add option to free up TIM3 from USB VCP polling. · 66b96822
      Damien George authored
      This is a hack to free up TIM3 so that it can be used by the user.
      Instead we use the PVD irq to call the USB VCP polling function, and
      trigger it from SysTick (so SysTick itself does not do any processing).
      The feature is enabled for pyboard lite only, since it lacks timers.
  12. 24 Nov, 2015 1 commit
    • Damien George's avatar
      stmhal: Move flash storage idle tick handler from TIM3 to SysTick. · e99e6c88
      Damien George authored
      Using SysTick to do the counting and dispatch of the flash storage idle
      handler is more efficient than requiring a dedicated hardware timer.
      No new counter is needed, just the existing uwTick variable.  The
      processing is not actually done in the SysTick IRQ, it is deferred to
      the flash IRQ (which runs at lower priority).
  13. 01 Nov, 2015 1 commit
  14. 31 Oct, 2015 1 commit
    • Damien George's avatar
      all: Add py/mphal.h and use it in all ports. · 731f3592
      Damien George authored
      py/mphal.h contains declarations for generic mp_hal_XXX functions, such
      as stdio and delay/ticks, which ports should provide definitions for.  A
      port will also provide mphalport.h with further HAL declarations.
  15. 29 Jul, 2015 1 commit
  16. 22 Jul, 2015 1 commit
  17. 21 Jul, 2015 1 commit
  18. 28 Apr, 2015 1 commit
  19. 22 Apr, 2015 1 commit
  20. 18 Apr, 2015 1 commit
  21. 16 Apr, 2015 2 commits
    • blmorris's avatar
      stmhal: Use new %q format to print qstr's in a few more places. · 4c459213
      blmorris authored
      Saves 68 bytes.
    • Damien George's avatar
      py: Overhaul and simplify printf/pfenv mechanism. · 7f9d1d6a
      Damien George authored
      Previous to this patch the printing mechanism was a bit of a tangled
      mess.  This patch attempts to consolidate printing into one interface.
      All (non-debug) printing now uses the mp_print* family of functions,
      mainly mp_printf.  All these functions take an mp_print_t structure as
      their first argument, and this structure defines the printing backend
      through the "print_strn" function of said structure.
      Printing from the uPy core can reach the platform-defined print code via
      two paths: either through mp_sys_stdout_obj (defined pert port) in
      conjunction with mp_stream_write; or through the mp_plat_print structure
      which uses the MP_PLAT_PRINT_STRN macro to define how string are printed
      on the platform.  The former is only used when MICROPY_PY_IO is defined.
      With this new scheme printing is generally more efficient (less layers
      to go through, less arguments to pass), and, given an mp_print_t*
      structure, one can call mp_print_str for efficiency instead of
      mp_printf("%s", ...).  Code size is also reduced by around 200 bytes on
      Thumb2 archs.
  22. 20 Mar, 2015 1 commit
  23. 09 Mar, 2015 1 commit
  24. 23 Feb, 2015 2 commits
  25. 13 Feb, 2015 1 commit
  26. 08 Jan, 2015 1 commit
  27. 07 Jan, 2015 1 commit
  28. 01 Jan, 2015 1 commit
  29. 08 Dec, 2014 1 commit
    • Paul Sokolovsky's avatar
      modsys: Add sys.print_exception(exc, file=sys.stdout) function. · 46c3ab20
      Paul Sokolovsky authored
      The function is modeled after traceback.print_exception(), but unbloated,
      and put into existing module to save overhead on adding another module.
      Compliant traceback.print_exception() is intended to be implemented in
      micropython-lib in terms of sys.print_exception().
      This change required refactoring mp_obj_print_exception() to take pfenv_t
      interface arguments.
      Addresses #751.
  30. 10 Oct, 2014 1 commit
  31. 05 Oct, 2014 4 commits
  32. 04 Oct, 2014 1 commit
    • Damien George's avatar
      stmhal: Allow pyb.freq() function to change SYSCLK frequency. · 24119176
      Damien George authored
      Eg pyb.freq(120000000) sets the CPU to 120MHz.  The frequency can be set
      at any point in the code, and can be changed as many times as you like.
      Note that any active timers will need to be reconfigured after a freq
      Valid range is 24MHz to 168MHz (but not all freqs are supported).  The
      code maintains a 48MHz clock for the USB at all times and it's possible
      to change the frequency at a USB REPL and keep the REPL alive (well,
      most of the time it stays, sometimes it resets the USB for some reason).
      Note that USB does not work with pyb.freq of 24MHz.