microbit: updated the dal to use a higher resolution ticker.

Previously the DAL relied upon an implementation of a timer that
was very imprecise and lacked resolution, this commit adds a reference
to a frozen repo with us_ticker.c modifications, so that a higher resolution
timer is utilised.

This fixes #13 (finally), and also fixes lower brightness levels when using
DISPLAY_MODE_BLACK_AND_WHITE to not cause a device lockup.
This commit is contained in:
James Devine 2016-02-02 16:21:28 +00:00
parent 9ce46e5f89
commit 4cefd55ef5
3 changed files with 4 additions and 4 deletions

View File

@ -262,7 +262,7 @@
// Selects the minimum permissable brightness level for the device
// in the region of 0 (off) to 255 (full brightness)
#ifndef MICROBIT_DISPLAY_MINIMUM_BRIGHTNESS
#define MICROBIT_DISPLAY_MINIMUM_BRIGHTNESS 4
#define MICROBIT_DISPLAY_MINIMUM_BRIGHTNESS 1
#endif
// Selects the maximum permissable brightness level for the device

View File

@ -14,7 +14,7 @@
"author": "Joe Finney <j.finney@lancaster.ac.uk (mailto:j.finney@lancaster.ac.uk) >",
"homepage": "https://developer.mbed.org/teams/Lancaster-University/code/microbit/",
"dependencies": {
"mbed-classic": "~0.0.4",
"mbed-classic": "lancaster-university/mbed-classic#microbit_hfclk",
"ble": "lancaster-university/BLE_API#v2.5.0+mb",
"ble-nrf51822": "lancaster-university/nrf51822#v2.5.0+mb3",
"nrf51-sdk": "lancaster-university/nrf51-sdk#v2.2.0+mb2"
@ -22,4 +22,4 @@
"extraIncludes": [
"inc"
]
}
}

View File

@ -147,7 +147,7 @@ void MicroBitDisplay::render()
//timer does not have enough resolution for brightness of 1. 23.53 us
if(brightness != MICROBIT_DISPLAY_MAXIMUM_BRIGHTNESS && brightness > MICROBIT_DISPLAY_MINIMUM_BRIGHTNESS)
renderTimer.attach_us(this, &MicroBitDisplay::renderFinish, (((brightness * 1000) / (MICROBIT_DISPLAY_MAXIMUM_BRIGHTNESS)) * uBit.getTickPeriod()));
renderTimer.attach_us(this, &MicroBitDisplay::renderFinish, (((brightness * 950) / (MICROBIT_DISPLAY_MAXIMUM_BRIGHTNESS)) * uBit.getTickPeriod()));
//this will take around 23us to execute
if(brightness <= MICROBIT_DISPLAY_MINIMUM_BRIGHTNESS)