To create a setup screen more symbols are created and added to the
symbol table. Helper functions are added to draw homogenous areas onto
the display. Add two new fields `Click` and `Back` to the `Input`
enum. Adapt functions already handling input to those new kinds of
input. Add the setup screen construct. Add global atomics to handle
the button and the timer for handling the back input when the button
is pressed until the timer one overflows. Button press and the timer
are handled via interrupts.
Add several symbols and a symbol table in an ascii order. Add the
`print()` and `print_inverted()` functions to be able to draw strings,
"black on white" as well as "white on black" onto the display. Add a
`HomeScreen` which also saves the state of which selection is
active. To save the screen state and also make it accessible globally
use a `RefCell` contained in a `Mutex`.
Also update the build dependencies.
It has to be decided what kind of tooling should be used, for now
cargo-make is used. This will probably be changed to use the tools
provided by [probe.rs](https://probe.rs).
- Add registers where PLL_A (MSNA) and PLL_B (MSNB) start.
- Create screens to edit the PLLs and add their entries to the home
screen.
- Use a struct for keeping the PLL configs.
- For editing such big numbers make the digits selctable.
- Create utility function for calculating 10 to the power of `n`.
The "demo" from Adafruits Si5351 library is used to produce a working
proof of concept which sets PLLA to 720MHz, PLLB to 705MHz and then
Multisynth0, Multisynth1 and Multisynth2 to 120MHz, 12MHz and 13.56MHz
respectively.
Add `TODO` comment to optimize waiting times, fix capitalization in
comments, add blank line and break up long lines. To improve code
semantics `lcd_home()` and `lcd_setup()` were renamed to `draw_home()`
and `draw_setup()` respectively. Improve ordering of function calls in
`main()`.
To support basic TWI support some defines are created to keep track of
port, pins and address. Fundamental procedures such as:
- `twi_error()`
- `twi_start()`
- `twi_transmit()`
- `twi_receive()`
- `twi_stop()`
are created. Those procedures are used in `twi_read_register()` and
`twi_write_register()` which read and write data from and to registers
respectively. Lastly the TWI bit rate is set to 200kHz.
Configure fuses for the `fuses` target in Makefile to disable
`CKDIV8`. Adapt PWM generation in `lcd_update_backlight()` to new
clock division factor, as well as interrupt handling, debouncing and
dechattering.
This also enables partially lower PWM frequencies (between off and
former lowest PWM setting) for a dimmer lcd backlight.
Store read-only graphics and symbols in flash and use a symbol lookup
table which somehow fits to the ASCII character set. A macro is used
to make the creation of the symbol lookup table shorter. A function to
print strings enables the use of strings.
The default values for the contrast and backlight are set when writing
to eeprom. Use the values stored in eeprom for contrast and
backlight. Update the contrast and backlight when changing their
values.
To have the values of `value_contrast` and `value_backlight` persist
over turn offs they are loaded and stored from and in the eeprom.
For preventing the flash target from earasing the eeprom the `EESAVE`
high fuse byte is set to 0 (programmed).
The values are now loaded when booted and stored when a new value is
set in the setup menu.
In order to be able to change the setup settings two new setup states
are introduced `change_contrast` and `change_backlight`. All
procedures that handle the setup states are adapted to handle those
new states correct. To keep track of their values the global variables
`value_contrast` and `value_backlight` are introduced.
To make setup settings configurable make it possible to select them
first. Therefore the `setup_state` enum is created to keep track of
the currently selected setting state.