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.
Dependents: mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510
features/unsupported/tests/mbed/spi_C12832/main.cpp@0:098463de4c5d, 2017-01-25 (annotated)
- Committer:
- group-onsemi
- Date:
- Wed Jan 25 20:34:15 2017 +0000
- Revision:
- 0:098463de4c5d
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
group-onsemi | 0:098463de4c5d | 1 | /* Copyright (c) 2010-2011 mbed.org, MIT License |
group-onsemi | 0:098463de4c5d | 2 | * |
group-onsemi | 0:098463de4c5d | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
group-onsemi | 0:098463de4c5d | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
group-onsemi | 0:098463de4c5d | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
group-onsemi | 0:098463de4c5d | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
group-onsemi | 0:098463de4c5d | 7 | * Software is furnished to do so, subject to the following conditions: |
group-onsemi | 0:098463de4c5d | 8 | * |
group-onsemi | 0:098463de4c5d | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
group-onsemi | 0:098463de4c5d | 10 | * substantial portions of the Software. |
group-onsemi | 0:098463de4c5d | 11 | * |
group-onsemi | 0:098463de4c5d | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
group-onsemi | 0:098463de4c5d | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
group-onsemi | 0:098463de4c5d | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
group-onsemi | 0:098463de4c5d | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
group-onsemi | 0:098463de4c5d | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
group-onsemi | 0:098463de4c5d | 17 | */ |
group-onsemi | 0:098463de4c5d | 18 | |
group-onsemi | 0:098463de4c5d | 19 | #include "test_env.h" |
group-onsemi | 0:098463de4c5d | 20 | #include "mbed.h" |
group-onsemi | 0:098463de4c5d | 21 | #include "C12832.h" |
group-onsemi | 0:098463de4c5d | 22 | |
group-onsemi | 0:098463de4c5d | 23 | int main() |
group-onsemi | 0:098463de4c5d | 24 | { |
group-onsemi | 0:098463de4c5d | 25 | MBED_HOSTTEST_TIMEOUT(15); |
group-onsemi | 0:098463de4c5d | 26 | MBED_HOSTTEST_SELECT(default_auto); |
group-onsemi | 0:098463de4c5d | 27 | MBED_HOSTTEST_DESCRIPTION(SPI C12832 display); |
group-onsemi | 0:098463de4c5d | 28 | MBED_HOSTTEST_START("MBED_35"); |
group-onsemi | 0:098463de4c5d | 29 | |
group-onsemi | 0:098463de4c5d | 30 | C12832 lcd(D11, D13, D12, D7, D10); |
group-onsemi | 0:098463de4c5d | 31 | |
group-onsemi | 0:098463de4c5d | 32 | // clear the screen |
group-onsemi | 0:098463de4c5d | 33 | lcd.cls(); |
group-onsemi | 0:098463de4c5d | 34 | |
group-onsemi | 0:098463de4c5d | 35 | // print the first line and wait 3 sec |
group-onsemi | 0:098463de4c5d | 36 | lcd.locate(0,3); |
group-onsemi | 0:098463de4c5d | 37 | lcd.printf("mbed application board!"); |
group-onsemi | 0:098463de4c5d | 38 | |
group-onsemi | 0:098463de4c5d | 39 | // print the counter prefix; the number will be printed in the while loop |
group-onsemi | 0:098463de4c5d | 40 | lcd.locate(0,15); |
group-onsemi | 0:098463de4c5d | 41 | lcd.printf("Counting:"); |
group-onsemi | 0:098463de4c5d | 42 | |
group-onsemi | 0:098463de4c5d | 43 | int i=1, j=0; |
group-onsemi | 0:098463de4c5d | 44 | while(i++,i<=200) { |
group-onsemi | 0:098463de4c5d | 45 | lcd.locate(42,15); |
group-onsemi | 0:098463de4c5d | 46 | lcd.printf("%d", i); |
group-onsemi | 0:098463de4c5d | 47 | if (i % 50 == 0) { |
group-onsemi | 0:098463de4c5d | 48 | lcd.invert(j = j ? 0 : 1); |
group-onsemi | 0:098463de4c5d | 49 | }; |
group-onsemi | 0:098463de4c5d | 50 | wait(0.001); |
group-onsemi | 0:098463de4c5d | 51 | } |
group-onsemi | 0:098463de4c5d | 52 | |
group-onsemi | 0:098463de4c5d | 53 | MBED_HOSTTEST_RESULT(1); |
group-onsemi | 0:098463de4c5d | 54 | } |