Commit graph

12 commits

Author SHA1 Message Date
Joe Finney 427f56863c Merge pull request #6 from mmoskal/tcracefix
Avoid race condition in clearing TC interrupt flags
2017-06-15 15:53:01 +01:00
Michal Moskal 6c250bb0e7 Avoid race condition in clearing TC interrupt flags 2017-06-15 13:05:59 +01:00
Joe Finney 03f4fbc253 Extend range of PWM and minor code optimisations
Corrected minor bug that prevented the use of long periods (beyond 500ms).
Updated timer instance to be const to allow compiler optimisation
minor code cleanups
2016-10-24 15:56:05 +01:00
James Devine be51bd33c1 mbed-classic: added new PWM implementation
The previous pwm implementation was subject to innaccurracies
due to BLE interrupts. This new implementation, courtesy of
@finneyj is resiliant to BLE interrupts, other than a small
time window when changing the pwm period.
2016-10-22 22:18:52 +01:00
Devine 3d3ff2e7eb mbed-classic: merge targets.json from upstream. 2016-07-13 14:29:44 +01:00
James Devine 1fb8ab4c19 mbed-classic: BUGFIX for timer when using wait_ms from interrupt context
Previously if a user used wait[_ms,_us] in interrupt context the device would
hang indefinitely. This was due to incrementing overflowCount from
interrupt context only.

This meant that if a user used wait[_ms,_us] in an ISR with
the same or greater interrupt priority, it would result in an infinite
loop as the overflowCount variable would never be incremented, and
wait[_ms,_us] would never return.

This patch simply applies a better solution for the race condition
mentioned in the previous commit. It instead disables the timer1
interrupt and increments the overflowCount variable, preventing
the race condition whilst supporting wait[_ms,_us] in interrupt
2016-05-13 16:39:15 +01:00
James Devine 0918819fd0 mbed-classic: added nrf51.h from most recent SDK
Upstream mbed doesn't have the correct version of nrf51.h for builds
with mbed-classic on

This means that builds fail online due to incompatible nrf51.h's.

This commit adds the correct version of nrf51.h to our repo.
2016-04-08 00:37:12 +01:00
Joe Finney 1a8031daf8 microbit: Patch to HF Ticker implementaiton to reduce glitching on wait_ms()
Updated ticker implementation to:

 - Ensure initialisation of overflowount variable to zero (was previously undefined)

  - Update internal counter 'read' operation to handle overflow conditions
differently. Instead of re-implementing the overflow handler in the 'read'
operation, it now leaves this to a single code path in the ISR. Instead, the
code is simply made aware of overflows and handles this as a local event. This
prevents the possibility of duplicate increments to overflowCount (which
appeared to occur under testing, especially when the mbed wait_ms busy-wait function is used).
2016-04-07 10:30:48 +01:00
Joe Finney 4618870501 microbit: PortOut/PortIn now respects bit mask
The mbed PortOut and PortIn abstractions require the definition of a mask that
specifies which pins in the given port are to be used.

The nrf51822 implementation did not respect this funcitonality, and would
overwrite all pins defined as an output, regardless of whether they were
defined as part of the mask.
2016-03-26 18:47:13 +00:00
James Devine 5678d944fe mbed-classic: reduced priority of timer interrupt
A higher priority ticker interrupt caused interoperability issues
with the nordic soft device. This commit reduces the interupt priority.
2016-03-24 16:09:41 +00:00
James Devine 6888edef4c updated implementation for us_ticker.c
We are now using a timer that uses HFCLK for timer calls
this should mean that we have a higher resolution for
2016-02-02 15:30:52 +00:00
James Devine 93df986f58 initial commit before we edit this git repo
We are about to update the us_ticker.c implementation
so that we can gain increased granularity for the
all timer related classes.
2016-02-02 15:26:15 +00:00