Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed mbed-rtos tsi_sensor SLCD
Revision 2:070500d1e54b, committed 2020-03-10
- Comitter:
- teajaypierce
- Date:
- Tue Mar 10 21:00:19 2020 +0000
- Parent:
- 1:03ee5f19d879
- Commit message:
- lab4b
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 03ee5f19d879 -r 070500d1e54b main.cpp
--- a/main.cpp Wed Feb 19 01:26:00 2020 +0000
+++ b/main.cpp Tue Mar 10 21:00:19 2020 +0000
@@ -161,11 +161,11 @@
/* available functions */
/* float TSIAnalogSlider.readPercentage() */
-//#include "keypad4x4.h"
-//BusOut keypad4x4_columns(PTE19, PTE18, PTE17, PTE16);
-//BusIn keypad4x4_rows(PTA14, PTA15, PTA16, PTA17);
-//InterruptIn keypad4x4_interrupt(PTC16);
-//available functions:
+#include "keypad4x4.h"
+BusOut keypad4x4_columns(PTE19, PTE18, PTE17, PTE16);
+BusIn keypad4x4_rows(PTA14, PTA15, PTA16, PTA17);
+InterruptIn keypad4x4_interrupt(PTC16);
+available functions:
/*
int keypad4x4_set_type(int type)
int keypad4x4_query(char *key_value, int * key_row, int *key_column)
@@ -175,7 +175,7 @@
*/
#include "NKC_LCD.h"
-//Serial lcd(PTD3,NC);
+Serial lcd(PTD3,NC);
//Serial lcd(J1_6,NC);
//available functions:
/*
@@ -244,58 +244,28 @@
char tempc;
-int main()
-{
- pc.baud(115200);
- pc.printf("\nStarting\n");
- pc.printf("lcd baud decode %i\n",lcd_baud_decode(115200));
- lcd_default_baud(115200);
- pc.printf("lcd baud %i\n",lcd_baud(115200));
- uart1.baud(115200);
- // slcd.All_Segments(0);
-
-
-
+ int main(){
+ pc.baud(115200);
+ lcd_baud(115200);
+ lcd_default_baud(115200);
+
while(true)
{
- if(pc.readable())
- {
- tempc=pc.getc();
- pc_string[pc_count++]=tempc;
- if(pc_count>=40 || tempc==CR || tempc==LF)
+ if(keypad4x4¬_ispressed())
{
- pc_string[pc_count++]='\n';
- pc_string[pc_count++]=NULL;
- pc_ready=1;
+ tempc=pc.getc();
+ pc_string[pc_count++]=tempc;
+ if(pc_count>=40 || tempc==CR || tempc==LF)
+ {
+ pc_string[pc_count++]=LF;
+ pc_string[pc_count++]=NULL;
+ pc_ready=1;
+ }
}
- }
- if(uart1.readable())
- {
-
-
- }
- if(pc_ready == 1)
- {
- pc.putc('\n');
- vt100_set_foreground(green);
- //pc.puts(pc_string);
- pc.printf("%s",pc_string);
- uart1.printf("%s",pc_string);
- lcd_cursor(0, 0);
- lcd.printf("%s",pc_string);
- pc_ready=0;
- pc_count=0;
- vt100_text_default();
- }
- if(uart1_ready==1)
- {
-
-
-
- }
-
-
-}
-/* YOUR CODE GOES HERE */
+ if(keypad4x4_getchar())
+ {
+ keypad4x4_getc();
+ }
+
-}
+}
\ No newline at end of file