
lab4b
Dependencies: mbed mbed-rtos tsi_sensor SLCD
Diff: main.cpp
- Revision:
- 3:a5d13ab0abf2
- Parent:
- 1:03ee5f19d879
- Child:
- 4:63adf2970ba5
--- a/main.cpp Tue Feb 25 23:09:31 2020 +0000 +++ b/main.cpp Tue Mar 03 22:28:41 2020 +0000 @@ -71,7 +71,7 @@ //PwmOut Speaker2(PTE23); // All of the follwoing define "pc" identically -Serial pc(USBTX, USBRX); // MBED standard pin names + //Serial pc(PTA2, PTA1); // KL46Z pin names //Serial pc(J1_4, J1_2); // Jumper position pin names //Serial pc(D1,D0); // Arduino-equivalent pin names @@ -96,7 +96,7 @@ pc.scanf() */ -#include "VT100.h" +//#include "VT100.h" //The VT100 functions send terminal control commands to the "pc" serial port /* void vt100_home() @@ -161,7 +161,7 @@ /* 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); @@ -234,68 +234,21 @@ //SPI spi1(PTD6, PTD7, PTD5, PTD4, use_gpio_ssel_t); //SPI spi1(D11, D12, D13); //SPI spi1(D11, D12, D13, D10, use_gpio_ssel_t); + -char pc_string[50]; -char uart1_string[50]; -int pc_count=0; -int uart1_count=0; -int pc_ready=0; -int uart1_ready=0; +//BusOut seven_segment(SEVEN_SEGMENT_A,SEVEN_SEGMENT_B,SEVEN_SEGMENT_C,SEVEN_SEGMENT_D,SEVEN_SEGMENT_E,SEVEN_SEGMENT_F,SEVEN_SEGMENT_G,SEVEN_SEGMENT_DP); +//BusIn switches(PTE16, PTE17, PTE18, PTE19, PTA17, PTA16, PTA15, PTA14); -char tempc; +Serial pc(USBTX, USBRX); // MBED standard pin names +#include "seven_segment.h" +#include "keypad4x4.h" +char n; 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); - - - -while(true) -{ - if(pc.readable()) - { - tempc=pc.getc(); - pc_string[pc_count++]=tempc; - if(pc_count>=40 || tempc==CR || tempc==LF) - { - pc_string[pc_count++]='\n'; - 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) - { - - - - } - - + while(true) + { + n=keypad4x4_getc(); + seven_segment_output(n); + } } -/* YOUR CODE GOES HERE */ - -}