-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed terminal code to work bidirectional and added it to the menu
- Loading branch information
1 parent
7ce6d8a
commit e74f9f5
Showing
6 changed files
with
60 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,36 @@ | ||
#include "badge_user.h" | ||
|
||
//simple one way terminal - characters from serial are directed to stdio | ||
// Simple terminal program: | ||
// Characters from the serial port are printed on the screen, and characters | ||
// from the keyboard are sent to the serial port | ||
// | ||
// NOTE: Just like with a real terminal, characters from the keyboard don't get | ||
// printed on the screen; the host computer (to which you connect the serial | ||
// port) should take care of echoing the characters (or not, e.g. when you're | ||
// typing a password). | ||
// | ||
// NOTE: this is a simple program that basically loops at full speed. It works | ||
// fine but of course it's not very efficient with energy. It would be better | ||
// to put the CPU to sleep and let the UART or the keyboard wake it up. This | ||
// is left as an excercise for the reader :-) | ||
|
||
void user_program_init(void) | ||
void user_term_init(void) | ||
{ | ||
clr_buffer(); | ||
video_gotoxy(0,0); | ||
serial_flush(); | ||
} | ||
|
||
void user_program_loop(void) | ||
void user_term_loop(void) | ||
{ | ||
uint8_t temp; | ||
if (rx_sta()) | ||
{ | ||
temp = rx_read(); | ||
stdio_c(temp); | ||
} | ||
} | ||
if (rx_sta()) | ||
{ | ||
stdio_c(rx_read()); | ||
} | ||
|
||
uint8_t c; | ||
if (stdio_get(&c)) | ||
{ | ||
tx_write(c); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/************************************ | ||
* Module that can be used as a serial terminal | ||
************************************/ | ||
void user_term_init(void); | ||
void user_term_loop(void); |