aboutsummaryrefslogtreecommitdiffstats
path: root/main.cpp
blob: f2a55afbc34cf924e987f67dd163bfbe3fd6e600 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <ch.h>
#include <hal.h>

#include <vex/lcd.hpp>
#include <vex/digital.hpp>
#include <vex/vexspi.h>

int main(void) {
	// init chibios
	halInit();
	chSysInit();

	// init robot
	digital::setMode(1, 1);
	lcd::init();
	spi::init();

	int led = 1; // for led toggle

	while (1) {
		// update
		lcd::flush();
		spi::update();

		lcd::printn(0, 0, spi::getJoystick(1).Ch1);

		digital::setLed(1, led);
		led ^= 1;

		chThdSleepMilliseconds(100);
	}
}