forked from M-Labs/ionpak-thermostat
start ADC after initialization, to avoid FIFO overflows
This commit is contained in:
parent
98b17fc574
commit
68eb1cdbba
@ -281,8 +281,13 @@ pub fn init() {
|
||||
.pwm2en().bit(true)
|
||||
.pwm4en().bit(true)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
pub fn start_adc() {
|
||||
cortex_m::interrupt::free(|cs| {
|
||||
let sysctl = tm4c129x::SYSCTL.borrow(cs);
|
||||
|
||||
// Set up ADC
|
||||
let gpio_d = tm4c129x::GPIO_PORTD_AHB.borrow(cs);
|
||||
let gpio_e = tm4c129x::GPIO_PORTE_AHB.borrow(cs);
|
||||
gpio_d.afsel.write(|w| w.afsel().bits(FBV_ADC|AV_ADC));
|
||||
@ -318,6 +323,9 @@ pub fn init() {
|
||||
adc0.sac.write(|w| w.avg()._64x());
|
||||
adc0.ctl.write(|w| w.vref().bit(true));
|
||||
adc0.actss.write(|w| w.asen0().bit(true));
|
||||
|
||||
let nvic = tm4c129x::NVIC.borrow(cs);
|
||||
nvic.enable(tm4c129x::Interrupt::ADC0SS0);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -98,9 +98,6 @@ fn main() {
|
||||
board::init();
|
||||
|
||||
cortex_m::interrupt::free(|cs| {
|
||||
let nvic = tm4c129x::NVIC.borrow(cs);
|
||||
nvic.enable(tm4c129x::Interrupt::ADC0SS0);
|
||||
|
||||
let mut loop_anode = LOOP_ANODE.borrow(cs).borrow_mut();
|
||||
let mut loop_cathode = LOOP_CATHODE.borrow(cs).borrow_mut();
|
||||
|
||||
@ -182,6 +179,8 @@ fn main() {
|
||||
(http::Request::new(), tcp_handle7),
|
||||
];
|
||||
|
||||
board::start_adc();
|
||||
|
||||
let mut next_blink = 0;
|
||||
let mut next_info = 0;
|
||||
let mut led_state = true;
|
||||
|
Loading…
Reference in New Issue
Block a user