mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-24 06:44:25 -04:00
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:
parent
7aca7ce74d
commit
033c4e9a5b
599 changed files with 70746 additions and 66896 deletions
|
@ -39,47 +39,43 @@ namespace touch {
|
|||
namespace adc {
|
||||
|
||||
constexpr uint8_t adc0_sel =
|
||||
(1 << portapack::adc0_touch_xp_input)
|
||||
| (1 << portapack::adc0_touch_xn_input)
|
||||
| (1 << portapack::adc0_touch_yp_input)
|
||||
| (1 << portapack::adc0_touch_yn_input)
|
||||
;
|
||||
(1 << portapack::adc0_touch_xp_input) | (1 << portapack::adc0_touch_xn_input) | (1 << portapack::adc0_touch_yp_input) | (1 << portapack::adc0_touch_yn_input);
|
||||
const auto adc0_interrupt_mask = flp2(adc0_sel);
|
||||
|
||||
constexpr lpc43xx::adc::CR adc0_cr {
|
||||
.sel = adc0_sel,
|
||||
.clkdiv = 49, /* 400kHz sample rate, 2.5us/sample @ 200MHz PCLK */
|
||||
.resolution = 9, /* Ten clocks */
|
||||
.edge = 0,
|
||||
constexpr lpc43xx::adc::CR adc0_cr{
|
||||
.sel = adc0_sel,
|
||||
.clkdiv = 49, /* 400kHz sample rate, 2.5us/sample @ 200MHz PCLK */
|
||||
.resolution = 9, /* Ten clocks */
|
||||
.edge = 0,
|
||||
};
|
||||
constexpr lpc43xx::adc::Config adc0_config {
|
||||
.cr = adc0_cr,
|
||||
constexpr lpc43xx::adc::Config adc0_config{
|
||||
.cr = adc0_cr,
|
||||
};
|
||||
|
||||
void init() {
|
||||
adc0::clock_enable();
|
||||
adc0::interrupts_disable();
|
||||
adc0::power_up(adc0_config);
|
||||
adc0::interrupts_enable(adc0_interrupt_mask);
|
||||
adc0::clock_enable();
|
||||
adc0::interrupts_disable();
|
||||
adc0::power_up(adc0_config);
|
||||
adc0::interrupts_enable(adc0_interrupt_mask);
|
||||
}
|
||||
|
||||
void start() {
|
||||
adc0::start_burst();
|
||||
adc0::start_burst();
|
||||
}
|
||||
|
||||
// static constexpr bool monitor_overruns_and_not_dones = false;
|
||||
|
||||
Samples get() {
|
||||
const auto xp_reg = LPC_ADC0->DR[portapack::adc0_touch_xp_input];
|
||||
const auto xn_reg = LPC_ADC0->DR[portapack::adc0_touch_xn_input];
|
||||
const auto yp_reg = LPC_ADC0->DR[portapack::adc0_touch_yp_input];
|
||||
const auto yn_reg = LPC_ADC0->DR[portapack::adc0_touch_yn_input];
|
||||
return {
|
||||
(xp_reg >> 6) & 0x3ff,
|
||||
(xn_reg >> 6) & 0x3ff,
|
||||
(yp_reg >> 6) & 0x3ff,
|
||||
(yn_reg >> 6) & 0x3ff,
|
||||
};
|
||||
const auto xp_reg = LPC_ADC0->DR[portapack::adc0_touch_xp_input];
|
||||
const auto xn_reg = LPC_ADC0->DR[portapack::adc0_touch_xn_input];
|
||||
const auto yp_reg = LPC_ADC0->DR[portapack::adc0_touch_yp_input];
|
||||
const auto yn_reg = LPC_ADC0->DR[portapack::adc0_touch_yn_input];
|
||||
return {
|
||||
(xp_reg >> 6) & 0x3ff,
|
||||
(xn_reg >> 6) & 0x3ff,
|
||||
(yp_reg >> 6) & 0x3ff,
|
||||
(yn_reg >> 6) & 0x3ff,
|
||||
};
|
||||
}
|
||||
|
||||
} /* namespace adc */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue