TYBLE16 will become mbed chip! You can compile as a BBC micro:bit on the mbed (not mbed-os5).
Please see follows.
/users/kenjiArai/notebook/tyble16-module-will-become-a-mbed-family--mbedliza/#
main.cpp@0:64039a43c2e1, 2017-10-29 (annotated)
- Committer:
- kenjiArai
- Date:
- Sun Oct 29 03:46:59 2017 +0000
- Revision:
- 0:64039a43c2e1
TYBLE16 will become mbed chip! You can compile as a BBC micro:bit on the mbed (not mbed-os5).
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kenjiArai | 0:64039a43c2e1 | 1 | /* |
kenjiArai | 0:64039a43c2e1 | 2 | * Mbed Application program / Using Akizuki BLE Module AE-TYBLE16 |
kenjiArai | 0:64039a43c2e1 | 3 | * on-board module : TAIYO YUDEN BLE 4.2 TYSA-B (EYSGJNAWY-WX) |
kenjiArai | 0:64039a43c2e1 | 4 | * |
kenjiArai | 0:64039a43c2e1 | 5 | * http://akizukidenshi.com/catalog/g/gK-12339/ |
kenjiArai | 0:64039a43c2e1 | 6 | * |
kenjiArai | 0:64039a43c2e1 | 7 | * Copyright (c) 2017 Kenji Arai / JH1PJL |
kenjiArai | 0:64039a43c2e1 | 8 | * http://www.page.sannet.ne.jp/kenjia/index.html |
kenjiArai | 0:64039a43c2e1 | 9 | * http://mbed.org/users/kenjiArai/ |
kenjiArai | 0:64039a43c2e1 | 10 | * Created: October 29th, 2017 |
kenjiArai | 0:64039a43c2e1 | 11 | * Revised: October 29th, 2017 |
kenjiArai | 0:64039a43c2e1 | 12 | */ |
kenjiArai | 0:64039a43c2e1 | 13 | |
kenjiArai | 0:64039a43c2e1 | 14 | // Include -------------------------------------------------------------------- |
kenjiArai | 0:64039a43c2e1 | 15 | #include "mbed.h" |
kenjiArai | 0:64039a43c2e1 | 16 | #include "TextLCD.h" |
kenjiArai | 0:64039a43c2e1 | 17 | |
kenjiArai | 0:64039a43c2e1 | 18 | // Definition ----------------------------------------------------------------- |
kenjiArai | 0:64039a43c2e1 | 19 | |
kenjiArai | 0:64039a43c2e1 | 20 | // Object/ Constructor -------------------------------------------------------- |
kenjiArai | 0:64039a43c2e1 | 21 | Serial pc(P0_1, P0_3); |
kenjiArai | 0:64039a43c2e1 | 22 | DigitalOut led(P0_5); |
kenjiArai | 0:64039a43c2e1 | 23 | I2C i2c(P0_0, P0_2); |
kenjiArai | 0:64039a43c2e1 | 24 | TextLCD_I2C_N lcd(&i2c, 0x7c, TextLCD::LCD16x2); // LCD(Akizuki AQM1602A) |
kenjiArai | 0:64039a43c2e1 | 25 | |
kenjiArai | 0:64039a43c2e1 | 26 | // RAM ------------------------------------------------------------------------ |
kenjiArai | 0:64039a43c2e1 | 27 | |
kenjiArai | 0:64039a43c2e1 | 28 | // ROM / Constant data -------------------------------------------------------- |
kenjiArai | 0:64039a43c2e1 | 29 | |
kenjiArai | 0:64039a43c2e1 | 30 | // Function prototypes -------------------------------------------------------- |
kenjiArai | 0:64039a43c2e1 | 31 | |
kenjiArai | 0:64039a43c2e1 | 32 | //------------------------------------------------------------------------------ |
kenjiArai | 0:64039a43c2e1 | 33 | // Control Program |
kenjiArai | 0:64039a43c2e1 | 34 | //------------------------------------------------------------------------------ |
kenjiArai | 0:64039a43c2e1 | 35 | int main() |
kenjiArai | 0:64039a43c2e1 | 36 | { // 1234567890123456 |
kenjiArai | 0:64039a43c2e1 | 37 | char lcd_buf[20] = "by K.Arai/JH1PJL"; |
kenjiArai | 0:64039a43c2e1 | 38 | uint32_t n = 0; |
kenjiArai | 0:64039a43c2e1 | 39 | |
kenjiArai | 0:64039a43c2e1 | 40 | pc.printf("\r\n\r\nApplication for AE-TYBLE16 Module\r\n"); |
kenjiArai | 0:64039a43c2e1 | 41 | pc.printf(" created on %s %s (UTC)\r\n", __DATE__, __TIME__); |
kenjiArai | 0:64039a43c2e1 | 42 | // lcd |
kenjiArai | 0:64039a43c2e1 | 43 | lcd.locate(0, 0); // 1st line top |
kenjiArai | 0:64039a43c2e1 | 44 | lcd.puts("1234567890123456"); |
kenjiArai | 0:64039a43c2e1 | 45 | lcd.locate(0, 1); // 2nd line top |
kenjiArai | 0:64039a43c2e1 | 46 | lcd.printf("%s", lcd_buf); |
kenjiArai | 0:64039a43c2e1 | 47 | lcd.setCursor(TextLCD_Base::CurOff_BlkOff); |
kenjiArai | 0:64039a43c2e1 | 48 | lcd.setContrast(0x1b); // for AE-AQM1602A |
kenjiArai | 0:64039a43c2e1 | 49 | wait(5.0f); |
kenjiArai | 0:64039a43c2e1 | 50 | while (true){ |
kenjiArai | 0:64039a43c2e1 | 51 | sprintf(lcd_buf, "passed %5d sec", n++); |
kenjiArai | 0:64039a43c2e1 | 52 | pc.printf(" %sonds\r\n", lcd_buf); |
kenjiArai | 0:64039a43c2e1 | 53 | lcd.locate(0, 0); // 1st line |
kenjiArai | 0:64039a43c2e1 | 54 | lcd.printf("%s", lcd_buf); |
kenjiArai | 0:64039a43c2e1 | 55 | led = !led; |
kenjiArai | 0:64039a43c2e1 | 56 | wait(1.0f); |
kenjiArai | 0:64039a43c2e1 | 57 | } |
kenjiArai | 0:64039a43c2e1 | 58 | } |
kenjiArai | 0:64039a43c2e1 | 59 |