1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00
Commit graph

103 commits

Author SHA1 Message Date
Steve Evans
87c8847c13 New SPI API supporting DMA
Call targetConfiguration() once before config is loaded and again afterwards in case the config needs to be changed to load from SD card etc

Drop SPI clock during binding

Remove debug

Add per device SPI DMA enable

Fix sdioPinConfigure() declaration warning

Reduce clock speed during SPI RX initialisation
2021-07-25 12:40:25 +12:00
Bruce Luckcuck
e7b9828c3b Add option to display OSD menus over a solid gray background
Improves menu readability by changing the background from a transparent display of the camera image to a static opaque gray background.

The behavior is controlled with the `osd_menu_background` parameter which defaults to `TRANSPARENT` to preserve the previous behavior. Other opaque options are available:
```
osd_menu_background = TRANSPARENT
Allowed values: TRANSPARENT, BLACK, GRAY, LIGHT_GRAY
```

The background setting is available in the CMS OSD menu and the user can cycle through the various options with the display updating in real-time.

Currently only the onboard MAX7456-based OSD is supported, but the implementation adds `displayPort` support so it can easily be extended to other OSD devices if those manufacturers want to add support. Also can be extended to other background types (like colors, varying transparency, etc.) for future device support.

Makes use of the built-in MAX7456 feature to display all transparent pixels as "gray". The MAX7456 display area seems to be a few scan lines smaller than the actual camera video image so it's normal for some of the camera image to "leak" at the top/bottom of the display. The OSD display area can be adjusted up/down using the `vcd_v_offset` setting if desired.
2021-01-10 18:19:59 -05:00
Steve Evans
41a0ca43d1 Run SPI FLASH at full speed 2020-10-27 00:17:34 +00:00
Alberto García Hierro
db0e1e7788 MAX7456: Support delayed initialization
This allows the init sequence to correctly determine and store that
the selected display device after autoselection was MAX7456 but it
hasn't been yet initialized, and allows us to properly transmit this
information to the configurator.

This also lets the display subsystem initialize the MAX7456 at any
time, so for example in flight controllers that require battery power
in order to turn on the MAX7456, the user can plug the battery after
powering the system up via USB and the MAX7456 will be detected shortly
after without having to reboot.
2020-06-25 11:51:12 +01:00
Alberto García Hierro
37e66b3dda Add support for FrSky OSD
- Add displayWriteFontCharacter() for font writing, removing all max7456
specific code.
- Add displayIsReady() for asynchronous display initialization
- Add displayBeginTransaction()/displayCommitTransaction() for display
transactions, which allow performing complex drawing operations without
flickering
- Add displayGetCanvas(), which retrieves the canvas associated with a
display (if it has it)
- Add canvas implementation for pixel based access for a display
- Add FrSkyOSD driver and displayPort driver
- Enable FrSkyOSD driver for targets with flash > 256
- Rename max7456_symbols.h to osd_symbols.h
2019-11-30 22:06:36 +00:00
markhermelinggt
9c6e983358
Uninitialized variable in max7456DrawScreenSlow
Found through static analysis with GrammaTech CodeSonar

Need to make sure escapeCharFound is initialized to false. It doesn't look like anything really can go wrong (yet), but the loop in 804 could be executed even if not needed.
2019-11-19 11:45:59 -05:00
Bruce Luckcuck
a12ab13462 Prevent font upload if max7456 is not detected
Prevents wedge if a font upload is attempted but the max7456 device wasn't detected during initialization.
2019-11-10 19:17:05 -05:00
Bruce Luckcuck
5f5ee33718 Add OSD background support for the static portions of display elements
Significantly reduces the time the OSD task spends drawing elements that are completely or mostly static. The larger the element the more time savings are realized. Currently implemented support for:
- Crosshairs
- Artificial Horizon Sidebars
- Craft name
- Display name
- Stick overlay

Since the static portions are only rendered once, the static elements add no processing time to the OSD task. As an example, enabling the above elements prior to these changes results in a total rendering time of 47us. After the enhancements they take only 6us (basically the rendering phase minimum overhead). So effectively 41us are removed from the OSD task.

Opens the possibility to add large mostly static elements with no additional overhead. An example would be a camera framing element that might draw a "box" around most of the screen. Previously this would add significant processing overhead to the OSD task, but now it will have no impact.
2019-10-28 19:34:29 -04:00
Bruce Luckcuck
d155dc0ed4 hange max7456 driver to only perform stall check once a second instead of every drawScreen call
The max7456 driver performs a "stall check" looking to see if the device had stopped responding. It does this by reading the VM0 register and comparing it to the in-memory version. Presumably if communication failed because the device isn't responding then the result of the SPI transfer would be an unexpected value. If the incorrect value was returned then it would trigger a reinitialization in the hopes of getting the device to respond.

The problem is that this check was happening on **every** call to `displayDrawScreen` unnecessarily. So in the case of the OSD using the max7456 it would happen every 16.7ms (60hz) which is clearly overkill. The unnecessary register check was adding a fixed ~7us to every iteration of the OSD task (along with potential extra bus contention). So now the "stall test" is only performed once a second.
2019-10-26 17:18:11 -04:00
jflyper
e821fec341 Detect MAX/AT7456 chip existence 2019-10-18 14:54:40 +09:00
Michael Keller
8140504f84
dropping useless max7456Lock boolean (#8499)
dropping useless max7456Lock boolean
2019-06-30 12:59:51 +12:00
Kyle K
d8dd9cacc3 dropping useless max7456Lock boolean 2019-06-29 01:00:41 +00:00
jflyper
f9bd71f9be Remove bogus pg/pg.h and pg/pg_ids.h from driver files 2019-06-29 02:21:51 +09:00
root
dd388ff20d typo in src/main/drivers/max7456.c 2019-05-31 02:20:13 +00:00
root
77e2a1e29e Clean up use of MAX7456_SPI_CLK and MAX7456_RESTORE_CLK
These are set in many targets, but they are exactly the same as set in #6871

Notable exceptions: NOX, IMPUSERCF3 are set to clock data into the MAX7456 at 5MHz
2019-05-31 02:06:12 +00:00
root
bd63b7ba23 prevent max7456 screen_buffer from overflow 2019-04-23 01:24:27 +00:00
Bruce Luckcuck
f1e3c60dd9 Optimize MAX7456 driver invert and brightness functions
Eliminate unnecessary register writes by keeping previous state information and only writing the registers when the related settings actually change. Saves 17 register writes per `clearScreen()` call.

Also fixed character invert flag handling. Previously changes to the flag would only affect subsequently drawn characters and previous characters would remain unchanged. So for static OSD elements it produced an inconsistent state. Now all characters immediately reflect the current state of the invert flag.

Results in appoximately a 33% reduction in processing time for the OSD task at default settings (~31us reduced to ~21us on F405).
2019-02-05 12:02:34 -05:00
jflyper
343e9b3a67 Allow mixed speed and mode on a SPI bus by CR1 caching 2019-01-14 03:34:27 +09:00
jflyper
9ea1428d11 Introduce per device pin pre-init 2018-12-13 11:15:26 +09:00
jflyper
f434f53c35 Protect MAX7456 driver from unconfigured SPI 2018-11-16 16:43:09 +09:00
jflyper
a9d6c7840b Add CS down/up for device type detection 2018-10-26 00:35:07 +09:00
MJ666
bb685755ed Update MAX7456 driver for generic target 2018-10-03 00:06:02 +02:00
Andrey Mironov
0115ff15b2 Fixed init order of MAX7456 DisplayPort 2018-07-23 23:31:42 +03:00
jflyper
f9a43099db SPI CS preinit for configurability 2018-05-24 22:00:26 +09:00
jflyper
944a2986a5 Use busDevice_s for reconfigurability 2018-05-04 17:09:56 +09:00
Michael Keller
cb19bb16d4
Merge pull request #5793 from etracer65/max7456_double_increment
Fix incorrect double increment in MAX7456 screen drawing
2018-05-03 23:32:21 +12:00
Bruce Luckcuck
b328d1dbbc Fix incorrect double increment in MAX7456 screen drawing
The for loop variable was being erroneously double incremented when a character was updated. This would cause fewer characters to be checked/updated during each cycle based on how many were found to be updated.
2018-05-01 12:38:45 -04:00
Bruce Luckcuck
932998a33c Avoid 0xFF character when writing to MAX7456 in auto-increment mode
The 0xFF character is used as an "escape" character by the MAX7456 when using auto-increment mode. The last byte of the characters used for the logo is the 0xFF character and this was causing the version and CMS instructions to not display.

Changed the logic to avoid the 0xFF character during the auto-increment phase and added a second pass if needed to update those characters in direct addressing mode.
2018-05-01 12:07:40 -04:00
blckmn
a9f74cd6df Removed excess trailing spaces before new lines on licenses. 2018-04-25 20:58:00 +10:00
blckmn
46fe22b4bd Direct license replacement 2018-04-22 09:22:46 +10:00
Michael Keller
dd25358a63
Merge pull request #3028 from cleanflight/improve-osd-slave-comms (#5405)
Improve OSD slave timeout/disconnect/reconnect handling.
2018-03-15 02:30:46 +13:00
Andrey Mironov
ac26c975dd Adjustable OC for F405 and F411 2018-02-17 14:12:16 +03:00
mikeller
2d930b28ce Moved vcd parameter group to pg/. 2017-12-24 15:13:48 +13:00
mikeller
200167aaf7 Moved max7456 parameter group into pg/ directory. 2017-12-24 09:09:26 +13:00
mikeller
b489d0ba9d Renamed 'parameter_group' to 'pg'. 2017-12-19 23:36:31 +13:00
Martin Budden
7be1d09e50 MAX7456 code tidy 2017-11-29 09:20:45 +00:00
jflyper
0e60400350 Use max7456SpiClock in ENABLE_MAX7456 macro 2017-11-13 09:23:29 +09:00
Michael Keller
5e77763c7b Merge pull request #4224 from jflyper/bfdev-max7456-add-debug-mode
MAX7456: Convert debug statements into debug modes
2017-10-21 09:05:06 +13:00
jflyper
e50414459d Forgot about this one 😭 2017-10-20 23:48:26 +09:00
Dan Nixon
932caac42b Remove duplicate code in MAX7456 driver
Removes some duplicate code for handling black and white brightness on
initialisation.
2017-10-01 14:45:43 +01:00
jflyper
40eb071677 And another... 2017-09-24 22:12:11 +09:00
jflyper
9c30465f99 Remove a conditional block; let gcc do the job 2017-09-24 20:31:57 +09:00
jflyper
47b9bc878b Convert debug statements into debug modes 2017-09-24 19:36:35 +09:00
jflyper
268318eec6 Touching up
Disable debug variable assignment
2017-09-23 01:21:00 +09:00
jflyper
5a7ed7b686 Handle SPI clock for CPU over clocked environment 2017-09-15 11:10:28 +09:00
Martin Budden
3d4f0bb137 Whitespace tidy 2017-07-05 06:36:22 +01:00
jflyper
682d4d4014 Preset CS lines for SPI devices initial high 2017-06-20 21:10:31 +09:00
Dan Nixon
7919a6ffbd Add MAX7456 image options to CMS 2017-06-12 12:14:52 +01:00
Dan Nixon
28fcfcd34e Add inversion and brightness support to MAX7456 driver 2017-06-12 12:13:54 +01:00
Martin Budden
3a5010ea65 Replace sprintf with tfp_sprintf 2017-05-28 07:17:35 +01:00