diff options
author | Nao Pross <naopross@thearcway.org> | 2018-05-04 18:27:12 +0200 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-05-04 18:27:12 +0200 |
commit | 5e8e628da03121323351e54e6866826288e4c4bd (patch) | |
tree | 4b3476cec9c295b5c633ea6b801815a131e2780b /main.cpp | |
parent | Add templated generic implementaions for uart, rename uart1.tpp to uart.tpp (diff) | |
download | SAMLiquidSmoke-5e8e628da03121323351e54e6866826288e4c4bd.tar.gz SAMLiquidSmoke-5e8e628da03121323351e54e6866826288e4c4bd.zip |
Implement most of basic HAL
Oscillator:
The oscillator is configured correctly.
Interrupts:
RX uart interrupts work.
The global interrupt vector table is enabled.
UART:
RX features work.
Diffstat (limited to '')
-rw-r--r-- | main.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -1,5 +1,5 @@ /* - * File: main.c + * File: main.cpp * Author: naopross * * Created on May 1, 2018, 6:18 PM @@ -8,19 +8,27 @@ #include <stdio.h> #include <stdlib.h> -// #include "mcc_generated_files/mcc.h" +// basic devices +#include "hal/confbits.hpp" +#include "hal/hwconfig.hpp" +// specific devices #include "hal/uart.tpp" #include "hal/pin.tpp" extern "C" { #include <xc.h> + #include <proc/p32mx470f512h.h> } 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); @@ -30,6 +38,14 @@ int main(int argc, char** argv) led3.set(1); while (true) { + while (uart::rx_buffer_empty<1>()); +// while (!uart::rx_buffer_empty<1>()) { +// uart::write<1>(uart::read<1>()); +// uart::write<1>("\n\rk") +// } + + uart::read<1>(); + led1.toggle(); } return 0; |