CN0397 Smart Visible Light detection shield
For additional information check out the mbed page of the Analog Devices wiki: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
main.cpp@0:f4037511cd74, 2016-11-08 (annotated)
- Committer:
- adisuciu
- Date:
- Tue Nov 08 09:57:00 2016 +0000
- Revision:
- 0:f4037511cd74
Fixed for mbed online compiler
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
adisuciu | 0:f4037511cd74 | 1 | /** |
adisuciu | 0:f4037511cd74 | 2 | * @file main.cpp |
adisuciu | 0:f4037511cd74 | 3 | * @brief Main file for the CN0397-example project |
adisuciu | 0:f4037511cd74 | 4 | * @author Analog Devices Inc. |
adisuciu | 0:f4037511cd74 | 5 | * |
adisuciu | 0:f4037511cd74 | 6 | * For support please go to: |
adisuciu | 0:f4037511cd74 | 7 | * Github: https://github.com/analogdevicesinc/mbed-adi |
adisuciu | 0:f4037511cd74 | 8 | * Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers |
adisuciu | 0:f4037511cd74 | 9 | * Product: www.analog.com/EVAL-CN0397-ARDZ |
adisuciu | 0:f4037511cd74 | 10 | * More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all |
adisuciu | 0:f4037511cd74 | 11 | |
adisuciu | 0:f4037511cd74 | 12 | ******************************************************************************** |
adisuciu | 0:f4037511cd74 | 13 | * Copyright 2016(c) Analog Devices, Inc. |
adisuciu | 0:f4037511cd74 | 14 | * |
adisuciu | 0:f4037511cd74 | 15 | * All rights reserved. |
adisuciu | 0:f4037511cd74 | 16 | * |
adisuciu | 0:f4037511cd74 | 17 | * Redistribution and use in source and binary forms, with or without |
adisuciu | 0:f4037511cd74 | 18 | * modification, are permitted provided that the following conditions are met: |
adisuciu | 0:f4037511cd74 | 19 | * - Redistributions of source code must retain the above copyright |
adisuciu | 0:f4037511cd74 | 20 | * notice, this list of conditions and the following disclaimer. |
adisuciu | 0:f4037511cd74 | 21 | * - Redistributions in binary form must reproduce the above copyright |
adisuciu | 0:f4037511cd74 | 22 | * notice, this list of conditions and the following disclaimer in |
adisuciu | 0:f4037511cd74 | 23 | * the documentation and/or other materials provided with the |
adisuciu | 0:f4037511cd74 | 24 | * distribution. |
adisuciu | 0:f4037511cd74 | 25 | * - Neither the name of Analog Devices, Inc. nor the names of its |
adisuciu | 0:f4037511cd74 | 26 | * contributors may be used to endorse or promote products derived |
adisuciu | 0:f4037511cd74 | 27 | * from this software without specific prior written permission. |
adisuciu | 0:f4037511cd74 | 28 | * - The use of this software may or may not infringe the patent rights |
adisuciu | 0:f4037511cd74 | 29 | * of one or more patent holders. This license does not release you |
adisuciu | 0:f4037511cd74 | 30 | * from the requirement that you obtain separate licenses from these |
adisuciu | 0:f4037511cd74 | 31 | * patent holders to use this software. |
adisuciu | 0:f4037511cd74 | 32 | * - Use of the software either in source or binary form, must be run |
adisuciu | 0:f4037511cd74 | 33 | * on or directly connected to an Analog Devices Inc. component. |
adisuciu | 0:f4037511cd74 | 34 | * |
adisuciu | 0:f4037511cd74 | 35 | * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR |
adisuciu | 0:f4037511cd74 | 36 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, |
adisuciu | 0:f4037511cd74 | 37 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
adisuciu | 0:f4037511cd74 | 38 | * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, |
adisuciu | 0:f4037511cd74 | 39 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
adisuciu | 0:f4037511cd74 | 40 | * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR |
adisuciu | 0:f4037511cd74 | 41 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
adisuciu | 0:f4037511cd74 | 42 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
adisuciu | 0:f4037511cd74 | 43 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
adisuciu | 0:f4037511cd74 | 44 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
adisuciu | 0:f4037511cd74 | 45 | * |
adisuciu | 0:f4037511cd74 | 46 | ********************************************************************************/ |
adisuciu | 0:f4037511cd74 | 47 | #include "mbed.h" |
adisuciu | 0:f4037511cd74 | 48 | #include "CN0397.h" |
adisuciu | 0:f4037511cd74 | 49 | |
adisuciu | 0:f4037511cd74 | 50 | Serial pc(SERIAL_TX, SERIAL_RX); |
adisuciu | 0:f4037511cd74 | 51 | |
adisuciu | 0:f4037511cd74 | 52 | int main() |
adisuciu | 0:f4037511cd74 | 53 | { |
adisuciu | 0:f4037511cd74 | 54 | pc.baud(115200); |
adisuciu | 0:f4037511cd74 | 55 | CN0397 cn0397(D10); |
adisuciu | 0:f4037511cd74 | 56 | cn0397.init(); |
adisuciu | 0:f4037511cd74 | 57 | wait_ms(500); |
adisuciu | 0:f4037511cd74 | 58 | |
adisuciu | 0:f4037511cd74 | 59 | while(1) { |
adisuciu | 0:f4037511cd74 | 60 | cn0397.set_app_data(); |
adisuciu | 0:f4037511cd74 | 61 | cn0397.display_data(); |
adisuciu | 0:f4037511cd74 | 62 | wait_ms(1000); |
adisuciu | 0:f4037511cd74 | 63 | } |
adisuciu | 0:f4037511cd74 | 64 | return 0; |
adisuciu | 0:f4037511cd74 | 65 | } |