AD4130 Mbed IIO Firmware

Dependencies:   tempsensors sdp_k1_sdram

Committer:
Kjansen45
Date:
Fri May 21 13:16:00 2021 +0000
Revision:
0:ad93df57f473
Initial commit;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kjansen45 0:ad93df57f473 1 /* Copyright (c) 2019 Analog Devices, Inc. All rights reserved.
Kjansen45 0:ad93df57f473 2
Kjansen45 0:ad93df57f473 3 Redistribution and use in source and binary forms, with or without modification,
Kjansen45 0:ad93df57f473 4 are permitted provided that the following conditions are met:
Kjansen45 0:ad93df57f473 5 - Redistributions of source code must retain the above copyright notice,
Kjansen45 0:ad93df57f473 6 this list of conditions and the following disclaimer.
Kjansen45 0:ad93df57f473 7 - Redistributions in binary form must reproduce the above copyright notice,
Kjansen45 0:ad93df57f473 8 this list of conditions and the following disclaimer in the documentation
Kjansen45 0:ad93df57f473 9 and/or other materials provided with the distribution.
Kjansen45 0:ad93df57f473 10 - Modified versions of the software must be conspicuously marked as such.
Kjansen45 0:ad93df57f473 11 - This software is licensed solely and exclusively for use with processors/products
Kjansen45 0:ad93df57f473 12 manufactured by or for Analog Devices, Inc.
Kjansen45 0:ad93df57f473 13 - This software may not be combined or merged with other code in any manner
Kjansen45 0:ad93df57f473 14 that would cause the software to become subject to terms and conditions which
Kjansen45 0:ad93df57f473 15 differ from those listed here.
Kjansen45 0:ad93df57f473 16 - Neither the name of Analog Devices, Inc. nor the names of its contributors
Kjansen45 0:ad93df57f473 17 may be used to endorse or promote products derived from this software without
Kjansen45 0:ad93df57f473 18 specific prior written permission.
Kjansen45 0:ad93df57f473 19 - The use of this software may or may not infringe the patent rights of one or
Kjansen45 0:ad93df57f473 20 more patent holders. This license does not release you from the requirement
Kjansen45 0:ad93df57f473 21 that you obtain separate licenses from these patent holders to use this software.
Kjansen45 0:ad93df57f473 22
Kjansen45 0:ad93df57f473 23 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS" AND
Kjansen45 0:ad93df57f473 24 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
Kjansen45 0:ad93df57f473 25 TITLE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
Kjansen45 0:ad93df57f473 26 NO EVENT SHALL ANALOG DEVICES, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
Kjansen45 0:ad93df57f473 27 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES
Kjansen45 0:ad93df57f473 28 (INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF CLAIMS OF INTELLECTUAL
Kjansen45 0:ad93df57f473 29 PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
Kjansen45 0:ad93df57f473 30 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Kjansen45 0:ad93df57f473 31 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
Kjansen45 0:ad93df57f473 32 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
Kjansen45 0:ad93df57f473 33 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kjansen45 0:ad93df57f473 34
Kjansen45 0:ad93df57f473 35 2019-01-10-7CBSD SLA
Kjansen45 0:ad93df57f473 36 */
Kjansen45 0:ad93df57f473 37
Kjansen45 0:ad93df57f473 38 #include "mbed.h"
Kjansen45 0:ad93df57f473 39
Kjansen45 0:ad93df57f473 40 // LED Blinking rate in milliseconds (Note: need to define the unit of a time duration i.e. seconds(s) or milliseconds(ms))
Kjansen45 0:ad93df57f473 41 #define SLEEP_TIME 500ms
Kjansen45 0:ad93df57f473 42
Kjansen45 0:ad93df57f473 43 // Initialise the digital pin that controls LED1
Kjansen45 0:ad93df57f473 44 DigitalOut led(LED1);
Kjansen45 0:ad93df57f473 45 // Initialise the serial object with TX and RX pins
Kjansen45 0:ad93df57f473 46 static BufferedSerial serial_port(USBTX, USBRX);
Kjansen45 0:ad93df57f473 47
Kjansen45 0:ad93df57f473 48 // The File handler is needed to allow printf commands to write to the terminal
Kjansen45 0:ad93df57f473 49 FileHandle *mbed::mbed_override_console(int fd)
Kjansen45 0:ad93df57f473 50 {
Kjansen45 0:ad93df57f473 51 return &serial_port;
Kjansen45 0:ad93df57f473 52 }
Kjansen45 0:ad93df57f473 53
Kjansen45 0:ad93df57f473 54 // main() runs in its own thread in the OS
Kjansen45 0:ad93df57f473 55 int main()
Kjansen45 0:ad93df57f473 56 {
Kjansen45 0:ad93df57f473 57 // printing the Mbed OS version this example was written to the console
Kjansen45 0:ad93df57f473 58 printf("This Application has been developed on Mbed OS version 6.4\r\n");
Kjansen45 0:ad93df57f473 59
Kjansen45 0:ad93df57f473 60 // printing the actual Mbed OS version that this application is using to the console.
Kjansen45 0:ad93df57f473 61 printf(
Kjansen45 0:ad93df57f473 62 "Mbed OS version %d.%d.%d is what this applicaiton is currently using\r\n",
Kjansen45 0:ad93df57f473 63 MBED_MAJOR_VERSION,
Kjansen45 0:ad93df57f473 64 MBED_MINOR_VERSION,
Kjansen45 0:ad93df57f473 65 MBED_PATCH_VERSION
Kjansen45 0:ad93df57f473 66 );
Kjansen45 0:ad93df57f473 67
Kjansen45 0:ad93df57f473 68 // The loop will toggle the LED every 500ms(SLEEP_TIME = 500ms) and print LED1s current state to the terminal
Kjansen45 0:ad93df57f473 69 while (1) {
Kjansen45 0:ad93df57f473 70 led = !led; // toggle LED1 state
Kjansen45 0:ad93df57f473 71 printf("LED1 state: %d \r\n", (uint8_t)led);
Kjansen45 0:ad93df57f473 72 ThisThread::sleep_for(SLEEP_TIME);
Kjansen45 0:ad93df57f473 73 }
Kjansen45 0:ad93df57f473 74 }
Kjansen45 0:ad93df57f473 75