From: Robin Krens Date: Fri, 13 Sep 2019 11:37:40 +0000 (+0700) Subject: mk450: documentation, prepare for merge X-Git-Url: https://robinkrens.nl/gitweb/?a=commitdiff_plain;h=4ed2b4e3cd00ec93ac4b8f15690ff7dc1984f87f;p=cortex-from-scratch mk450: documentation, prepare for merge --- diff --git a/README.md b/README.md index 42da980..d891e3c 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,8 @@ port this code to any Cortex M0/M3/M4/M7 board. * LED segment display: drivers/tm1637.c [COMPLETED] * Temperature sensor: drivers/tsensor.c [COMPLETED] * OLED display [PLANNED] - * Joystick: drivers/mk450_joystick.c [IN PROGRESS] + * Joystick: drivers/mk450_joystick.c [COMPLETED] + * TFT Screen: [PLANNED] * Memory Management [IN PROGRESS] -- FILE: lib/pool.c * User Mode [PLANNED] * System Call PendV implementation [PLANNED] diff --git a/drivers/mk450_joystick.c b/drivers/mk450_joystick.c index 7ca3366..cf500a3 100644 --- a/drivers/mk450_joystick.c +++ b/drivers/mk450_joystick.c @@ -41,15 +41,17 @@ uint16_t xyvalues[2] = {0,0}; /* Y return values is * ~0xC1C mv means y is idle state - * ~0x0 far left - * ~0xFFF far right */ + * ~0x0 far up + * ~0xFFF far down */ uint16_t mk450_gety() { int y = xyvalues[1]; return y; } -/* X return values (see y) */ +/* X return values (see y) + * Far right: 0xFFF + * Far left: 0x0 */ uint16_t mk450_getx() { int x = xyvalues[0]; diff --git a/main.c b/main.c index 2526963..bcbf6f1 100644 --- a/main.c +++ b/main.c @@ -76,7 +76,7 @@ void main() printf("Current temperature: %d °C\n", temp); */ /* ADC Joystick module */ - mk450_init(); + // mk450_init(); /* Start up terminal */ terminal(); diff --git a/rtc.c b/rtc.c index 5490b22..a6a834f 100644 --- a/rtc.c +++ b/rtc.c @@ -59,12 +59,13 @@ void * rtc_handler() { } */ // Simple LED blink - //uint32_t curr = *RTC_CNTL; - //int even = *RTC_CNTL % 2; - //(!even) ? led_off() : led_on(); + uint32_t curr = *RTC_CNTL; + int even = *RTC_CNTL % 2; + (!even) ? led_off() : led_on(); - printf("X: %x\n", mk450_getx()); - printf("Y: %x\n", mk450_gety()); + // Double Axis Joystick + //printf("X: %x\n", mk450_getx()); + //printf("Y: %x\n", mk450_gety()); rclrbit(RTC_CRL, 0); /* clear interrupt flag */ }