Formatted code (#1007)

* Updated style

* Updated files

* fixed new line

* Updated spacing

* File fix WIP

* Updated to clang 13

* updated comment style

* Removed old comment code
This commit is contained in:
jLynx 2023-05-19 08:16:05 +12:00 committed by GitHub
parent 7aca7ce74d
commit 033c4e9a5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
599 changed files with 70746 additions and 66896 deletions

View file

@ -33,85 +33,85 @@ using namespace lpc43xx;
namespace portapack {
void IO::init() {
data_mask_set();
data_write_high(0);
data_mask_set();
data_write_high(0);
dir_read();
lcd_rd_deassert();
lcd_wr_deassert();
io_stb_deassert();
addr(0);
dir_read();
lcd_rd_deassert();
lcd_wr_deassert();
io_stb_deassert();
addr(0);
gpio_dir.output();
gpio_lcd_rdx.output();
gpio_lcd_wrx.output();
gpio_io_stbx.output();
gpio_addr.output();
gpio_rot_a.input();
gpio_rot_b.input();
gpio_dir.output();
gpio_lcd_rdx.output();
gpio_lcd_wrx.output();
gpio_io_stbx.output();
gpio_addr.output();
gpio_rot_a.input();
gpio_rot_b.input();
}
void IO::lcd_backlight(const bool value) {
io_reg = (io_reg & 0x7f) | ((value ? 1 : 0) << 7);
io_write(1, io_reg);
io_reg = (io_reg & 0x7f) | ((value ? 1 : 0) << 7);
io_write(1, io_reg);
}
void IO::lcd_reset_state(const bool active) {
io_reg = (io_reg & 0xfe) | ((active ? 1 : 0) << 0);
io_write(1, io_reg);
io_reg = (io_reg & 0xfe) | ((active ? 1 : 0) << 0);
io_write(1, io_reg);
}
void IO::audio_reset_state(const bool active) {
/* NOTE: This overwrites the contents of the IO register, which for now
* have no significance. But someday...?
*/
io_reg = (io_reg & 0xfd) | ((active ? 1 : 0) << 1);
io_write(1, io_reg);
/* NOTE: This overwrites the contents of the IO register, which for now
* have no significance. But someday...?
*/
io_reg = (io_reg & 0xfd) | ((active ? 1 : 0) << 1);
io_write(1, io_reg);
}
void IO::reference_oscillator(const bool enable) {
const uint8_t mask = 1 << 6;
io_reg = (io_reg & ~mask) | (enable ? mask : 0);
io_write(1, io_reg);
const uint8_t mask = 1 << 6;
io_reg = (io_reg & ~mask) | (enable ? mask : 0);
io_write(1, io_reg);
}
uint32_t IO::io_update(const TouchPinsConfig write_value) {
/* Very touchy code to save context of PortaPack data bus while the
* resistive touch pin drive is changed. Order of operations is
* important to prevent latching spurious data into the LCD or IO
* registers.
*/
/* Very touchy code to save context of PortaPack data bus while the
* resistive touch pin drive is changed. Order of operations is
* important to prevent latching spurious data into the LCD or IO
* registers.
*/
const auto save_data = data_read();
const auto addr = gpio_addr.read();
const auto dir = gpio_dir.read();
const auto save_data = data_read();
const auto addr = gpio_addr.read();
const auto dir = gpio_dir.read();
io_stb_assert();
io_stb_assert();
/* Switch to read */
dir_read();
addr_0();
__asm__("nop");
__asm__("nop");
__asm__("nop");
const auto switches_raw = data_read();
/* Switch to read */
dir_read();
addr_0();
__asm__("nop");
__asm__("nop");
__asm__("nop");
const auto switches_raw = data_read();
/* Switch to write */
data_write_low(toUType(write_value));
dir_write();
__asm__("nop");
__asm__("nop");
__asm__("nop");
io_stb_deassert();
/* Switch to write */
data_write_low(toUType(write_value));
dir_write();
__asm__("nop");
__asm__("nop");
__asm__("nop");
io_stb_deassert();
data_write_low(save_data);
if( dir ) { /* 0 (write) -> 1 (read) */
dir_read();
}
gpio_addr.write(addr);
data_write_low(save_data);
if (dir) { /* 0 (write) -> 1 (read) */
dir_read();
}
gpio_addr.write(addr);
auto dfu_btn = portapack::io.dfu_read() & 0x01;
return (switches_raw & 0x7f) | (dfu_btn << 7);
auto dfu_btn = portapack::io.dfu_read() & 0x01;
return (switches_raw & 0x7f) | (dfu_btn << 7);
}
}
} // namespace portapack