mbv: move a few things around
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
#include "async.h"
|
||||
#include "buffer.h"
|
||||
#include "gpio.h"
|
||||
#include "intc.h"
|
||||
#include "interrupts.h"
|
||||
#include "pol0.h"
|
||||
#include "timer.h"
|
||||
#include "trace.h"
|
||||
#include "hal/gpio.h"
|
||||
#include "hal/intc.h"
|
||||
#include "hal/interrupts.h"
|
||||
#include "hal/pol0.h"
|
||||
#include "hal/timer.h"
|
||||
#include "lib/async.h"
|
||||
#include "lib/buffer.h"
|
||||
|
||||
#include "uart.h"
|
||||
#include "uart_async.h"
|
||||
|
||||
@@ -21,6 +21,26 @@ Timer* timer0;
|
||||
volatile uint32_t t1overflowsecs = 0;
|
||||
volatile uint32_t t1overflowusecs = 0;
|
||||
|
||||
Gpio* gpio0;
|
||||
|
||||
void ToggleLed(int which) {
|
||||
uint8_t data = gpio0->data;
|
||||
data ^= (0x1 << which);
|
||||
gpio0->data = data;
|
||||
}
|
||||
|
||||
void SetLed(int which) {
|
||||
uint8_t data = gpio0->data;
|
||||
data |= (0x1 << which);
|
||||
gpio0->data = data;
|
||||
}
|
||||
|
||||
void ClearLed(int which) {
|
||||
uint8_t data = gpio0->data;
|
||||
data &= ~(0x1 << which);
|
||||
gpio0->data = data;
|
||||
}
|
||||
|
||||
void Uart0Isr() { HandleUartIsr(); }
|
||||
|
||||
void Timer0Isr() {
|
||||
@@ -85,12 +105,14 @@ async::task<> blink() {
|
||||
} // namespace
|
||||
|
||||
int main() {
|
||||
gpio0 = Gpio::Instance(GPIO0_BASE);
|
||||
gpio0->data = 0;
|
||||
|
||||
SetupUart();
|
||||
UartWriteBlocking("uart setup done\r\n");
|
||||
SetupTimer();
|
||||
UartWriteBlocking("timer setup done\r\n");
|
||||
|
||||
gpio0->data = 0;
|
||||
SetupInterrupts();
|
||||
|
||||
auto e = echo();
|
||||
@@ -112,8 +134,7 @@ int main() {
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "itoa.h"
|
||||
#include "lock.h"
|
||||
#include "lib/lock.h"
|
||||
|
||||
extern unsigned char _heap_begin, _heap_end;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user