summaryrefslogtreecommitdiff
path: root/wasp/drivers
AgeCommit message (Collapse)Author
2021-09-10drivers: hrs3300: Reduce HGAIN to x8Daniel Thompson
Experimentally drop the HGAIN to x8. Currently the evidence base for this change is a little weak but it doesn't seem to be *worse* than what we have now. Therefore I hope the wasp-os users will forgive me for using them as guinea pigs! Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-20drivers: cst816s: Add a version() methodDaniel Thompson
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-19rtc: Undo the once-per-second wake upDaniel Thompson
So... waking up once per second turns out to be a dumb idea because it regresses the stop watch and HRS tools (which now also only wake up once per second). Undo this change but sprinkle a few more micropython.native decorations on methods used on the wakeup path to minimise power. Fixes: fb18705b9b9cc ("manager/rtc: Experimental power saving technique") Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-18drivers: nrf_rtc: Fix sphinx buildDaniel Thompson
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-04manager/rtc: Experimental power saving techniqueDaniel Thompson
Currently the time is calculated 8 times per second from (relatively) slow python code. Optimize the power consumed by reducing the number of times we check for wall time updates to only once-per-second and use native code generation to reduce VM overhead when executing this critical code. At the time of writing the difference is battery life has not yet been measured (but we know the current master branch is worse than v0.4 and, in theory at least, this should close the gap). Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-02-20st7789: Fix incorrect variable name in ST7789_SPIs. __init__ docstring.Piotr Tworek
The data signal pin name is dc, not cs. Signed-off-by: Piotr Tworek <tworaz@tworaz.net>
2021-01-17drivers: st7789: Further reduce allocations during set_window()Daniel Thompson
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-17drivers: st7789: Pre-allocate a memoryviewDaniel Thompson
Reduce the cost of slicing the linebuffer by pre-allocating a memoryview. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-17drivers: st7789: Optimize set_window()Daniel Thompson
For small graphical items (line drawing, font glyphs) the performance of the set_window() method is critical. Emit native code for this function and optimize the SPI write_cmd() method to avoid memory allocation. This give a performance boost of a little over 15% for (24pt) font rendering and 30% for line drawing. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-31drivers: bma421: Switch over to reset_step_counter()Daniel Thompson
Currently the bma421 driver simple re-initializes the sensor when asked to set the step counter to zero. Switch over to the proper function for this. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-12boards: simulator: Improve spi.write() simulationDaniel Thompson
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-14manager: Implement alarm callbacks for applications to useDaniel Thompson
Create a simple time queue where actions (functions or bound methods) can be queued against the real time clock. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-11hrs3300: Defer initialization until the HRS is usedDaniel Thompson
This means hardware failure won't cause the initial boot to fail. This won't stop the heart rate app from crashing when it starts up but at least it will give a comprehensible crash report. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-10drivers: flash: Automatic wake/sleep to minimise idle currentDaniel Thompson
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-09-27boards: Remove flash wake up commandsJeffrey Bailey
Wake from deep power down is now handled in the driver. Remove attempt to wake the board files. Signed-off-by: Jeffrey Bailey <wb.jeffrey@gmail.com> [daniel@redfelineninja.org.uk: Update commit message, simplify slightly, extended to all boards with spinor flash and update gitmodules to bring in the flash driver updates.] Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-09-21drivers: cst816s: Clear the event buffer during a wake upDaniel Thompson
Currently with CST816S controllers (but not CST716S controllers) then a swipe delivered whilst the device is asleep will sometimes be processed after we wake it up. That's never likely to be useful. Fix this by explicitly clearing the event buffer as part of the wakeup sequence. Reported-by: Siroj42 <siroj42@users.noreply.github.com> Fixes: #65 Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-08-15drivers: cst816s: Handle a failure to sleepDaniel Thompson
Exceptions on th sleep path more or less kill the device (it is half alseep and is not on... but not off enough for the power button to work. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-08-15wasp: Introduce a NEXT eventDaniel Thompson
This is useful for devices that do not have touchscreens. It can be used to cycle through the quick ring and to check out notifications. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-08-09k9: Add support for Senbono K9Daniel Thompson
The K9 is similar to the PineTime and P8 devices but does not appear to use the CST[78]16 touch screen controllers. At present the protocol is not known (readfrom yields all zeros, readfrom_mem provokes an exception) so we have a hugely limited interface consisting of the side button and the touchscreen interrupts (in other words we can treat the touchscreen like a second button). Works suprisingly well considering... Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-30wasp: Switch to scheduling from interruptDaniel Thompson
This has two useful properties. Firstly it means the watch will be maintained in the background, allowing the REPL to be used for notifications and other updates. Secondly it will save a little bit of power by reducing the work needed to handle spurious wake ups. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-22drivers: hrs3300: Add a basic HRS3300 sensor driverDaniel Thompson
Add the driver and enable it on PineTime. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-12drivers: bma421: Reduce the post-reset delayDaniel Thompson
There nothing in the docs to give the delay time required after a reset. Currently we use 200ms because that appears on some older code for BMA423 but is removed in more recent drivers. 50ms is still a long time (for hardware) and has held up in testing. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-11drivers: cst816s: optimize for power saving and responsivenessFuji Pebri
Signed-off-by: Fuji Pebri <pebri86@gmail.com> [daniel@redfelineinja.org.uk: removed leading underscore from method arguments, removed redundant state tracking, adopt i2c.writeto_mem] Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-09wasp: apps: Step counter applicationDaniel Thompson
Currently there's no fancy algorithms to estimate stride length. Just pure simple step counting directly from the hardware's "intelligence engine". Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-05-14drivers: vibrator: Finalize docstringsDaniel Thompson
2020-05-14drivers: st7789: Finalize docstringsDaniel Thompson
2020-05-14drivers: signal: Finalize docstringsDaniel Thompson
2020-05-14drivers: nrf_rtc: Finalize docstringsDaniel Thompson
2020-05-14drivers: cst816s: Finalize docstringsDaniel Thompson
2020-05-14drivers: battery: Finalize docstringsDaniel Thompson
2020-05-10drivers: nrf_rtc: Fix some tab/space issuesDaniel Thompson
These issues do not appear when parsing with micropython but when we import this file into sphinx then things go a bit south.
2020-05-09Add PNVRAM support to avoid forgetting the time during a reboot.Daniel Thompson
2020-04-26wasp: drivers: nrf_rtc: Fix a nasty bug when setting the timeDaniel Thompson
The code to recalculate the uptime to walltime adjustment was broken (e.g. the longer we leave it after reboot the more inaccurate the time setting becomes). Fixes: 80079e4 ("wasp: nrf_rtc: Add a tiny bit of extra resolution")
2020-04-26wasp: nrf_rtc: Add a tiny bit of extra resolutionDaniel Thompson
We now have a couple of applications (stopwatch, Game of Life) that benefit from sub-second precision. The micropython RTC/utime code for nrf still needs a major overhaul but this allows us to paper over the cracks for just a little longer.
2020-04-08wasp: draw565: Optimize the 2-bit RLE drawing functionsDaniel Thompson
There's a bunch of different changes here but there are only really three big wins. The biggest win comes from restructuring the 2-bit RLE decode loop to avoid the inner function (~20%) but the switch to 16-bit writes in _fill() and adoption of quick_write (e.g. no CS toggling) are also note worthy (and about 5% each).
2020-04-06wasp: vibrator: Better default for pulseDaniel Thompson
These defaults are good for giving quick UI feedback.
2020-03-22Add licensing information for all wasp-os files.Daniel Thompson
2020-03-09drivers: st7789: Automatically park ready for the next call to write dataDaniel Thompson
This makes line-by-line drawing more efficient because don't have to handle the dc line. The optimization targets font rendering and if good for slightly less than 10% rendering improvement.
2020-03-09wasp: draw565: Refactor to allow apps to focus on the drawable.Daniel Thompson
2020-03-08wasp: manager: Blankt the display during app transitionsDaniel Thompson
2020-03-08drivers: cst816s: Minor tweaks to the generated documentation.Daniel Thompson
2020-03-08wasp: Integrate the touch driverDaniel Thompson
At this point we are starting to bring an event model for applications but there's still a long way to go!
2020-03-07drivers: nrf_rtc: Add a higher res monotonic timerDaniel Thompson
2020-03-07drivers: cst816s: Decouple from the watch moduleDaniel Thompson
2020-03-06wasp: cst816s: Initial PoC driverDaniel Thompson
2020-02-19wasp: Add a simple font rendererDaniel Thompson
2020-02-19wasp: Add full dd-mm-yyyy calender trackingDaniel Thompson
2020-02-09wasp: Add pure-python SPI NOR FLASH driversDaniel Thompson
2020-02-08drivers: st7789: Optimize RLE decoding loopDaniel Thompson
Migrate the filling of the line buffer into a seperate function. This does naturally reduce the cost of the loop management but much more importantly allows us to use viper native code generator.
2020-02-03wasp: st7789: Make fill() control sizingDaniel Thompson