AS-289R2 library test code for mbed OS 5
Fork of mbed-os-example-mbed5-blinky by
Revision 27:9547c5d41dde, committed 2020-01-20
- Comitter:
- MACRUM
- Date:
- Mon Jan 20 00:51:06 2020 +0900
- Parent:
- 26:e20d2feff6ec
- Child:
- 28:e0eb1c087c41
- Commit message:
- Update libraries
Changed in this revision
--- a/AS289R2.lib Fri Feb 03 10:08:52 2017 +0000 +++ b/AS289R2.lib Mon Jan 20 00:51:06 2020 +0900 @@ -1,1 +1,1 @@ -http://mbed.org/users/MACRUM/code/AS289R2/#6aac36a293c7 +http://mbed.org/users/MACRUM/code/AS289R2/#b7d6c02caf97
--- a/main.cpp Fri Feb 03 10:08:52 2017 +0000
+++ b/main.cpp Mon Jan 20 00:51:06 2020 +0900
@@ -1,5 +1,5 @@
/* AS289R2 library test program for mbed OS
- * Copyright (c) 2016, Toyomasa Watarai
+ * Copyright (c) 2016-2020, Toyomasa Watarai
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -24,9 +24,9 @@
#include "AS289R2.h"
DigitalOut led1(LED1);
-AS289R2 tp(D1);
+AS289R2 tp(AS289R2_TX, AS289R2_RX);
-const char url[] = "https://developer.mbed.org/components/AS-289R2-Thermal-Printer-Shield/";
+const char url[] = "https://os.mbed.com/components/AS-289R2-Thermal-Printer-Shield/";
void AS289R2_demo()
{
@@ -76,7 +76,7 @@
tp.printBarCode(AS289R2::BCODE_UPC_A, "01234567890");
tp.putLineFeed(4);
-
+#if 0
// LineSpaceing
tp.printf("ABCDE\r");
tp.printf("ABCDE\r");
@@ -179,16 +179,15 @@
tp.defaultBarCodeBarSize();
tp.printBarCode(AS289R2::BCODE_JAN13, "123456789012");
tp.putLineFeed(4);
+#endif
}
-// main() runs in its own thread in the OS
-// (note the calls to wait below for delays)
int main()
{
AS289R2_demo();
while (true) {
led1 = !led1;
- wait(0.5);
+ thread_sleep_for(500);
}
}
--- a/mbed-os.lib Fri Feb 03 10:08:52 2017 +0000 +++ b/mbed-os.lib Mon Jan 20 00:51:06 2020 +0900 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/mbed-os/#34c1facf42a174f47fdf9002cd8c6bf10ac41744 +https://github.com/ARMmbed/mbed-os/#64853b354fa188bfe8dbd51e78771213c7ed37f7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app.json Mon Jan 20 00:51:06 2020 +0900
@@ -0,0 +1,22 @@
+{
+ "target_overrides": {
+ "*": {
+ "platform.stdio-baud-rate" : 115200,
+ "platform.stdio-convert-newlines" : true,
+ "platform.stdio-buffered-serial" : true,
+ "platform.stdio-flush-at-exit" : true
+ }
+ },
+ "config": {
+ "AS289R2-TX": {
+ "help" : "AS289R2 TX pin name",
+ "value" : "D1",
+ "macro_name": "AS289R2_TX"
+ },
+ "AS289R2-RX": {
+ "help" : "AS289R2 RX pin name",
+ "value" : "D0",
+ "macro_name": "AS289R2_RX"
+ }
+ }
+}
Toyomasa Watarai

AS-289R2 Thermal Printer Shield