/* * File: main.cpp * Author: naopross * * Created on May 1, 2018, 6:18 PM */ #define DEBUG // basic devices #include "hal/confbits.hpp" #include "hal/hwconfig.hpp" // specific devices #include "hal/uart.tpp" #include "hal/pin.tpp" // standard library #include // microchip libraries extern "C" { #include // #include } int main(int argc, char** argv) { osc::initialize(); interrupts::initialize(); uart::initialize<1>(); pin<4> led1(&LATEbits, &TRISEbits, &PORTEbits); pin<6> led2(&LATEbits, &TRISEbits, &PORTEbits); pin<7> led3(&LATEbits, &TRISEbits, &PORTEbits); led1.set(1); led2.set(1); led3.set(1); uart::write<1>("started\n\r"); while (true) { while (uart::rx_buffer<1>().empty()); while (uart::rx_buffer<1>().size() > 0) { char c = uart::read<1>(); uart::write<1>(c); uart::write<1>("\n\r"); } led1.toggle(); } return 0; }