CAC_smartcushion / Mbed OS AdiSense1000_V21_Smartcushion

Fork of Sean_AdiSense1000_V21 by Rohan Gurav

Committer:
nfathurr
Date:
Thu Oct 25 08:59:30 2018 +0000
Revision:
36:4aded4b4f060
Parent:
35:853be4d80ff3
modified output into one line

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nfathurr 34:029fc3b83f78 1 /*
nfathurr 34:029fc3b83f78 2 ******************************************************************************
nfathurr 34:029fc3b83f78 3 * file: myswift_periph.cpp
nfathurr 34:029fc3b83f78 4 *-----------------------------------------------------------------------------
nfathurr 34:029fc3b83f78 5 */
nfathurr 34:029fc3b83f78 6
nfathurr 34:029fc3b83f78 7 #include "myproswift_periph.h"
nfathurr 34:029fc3b83f78 8
nfathurr 34:029fc3b83f78 9 /*
nfathurr 34:029fc3b83f78 10 ******************************************************************************
nfathurr 34:029fc3b83f78 11 * ADISense1000
nfathurr 34:029fc3b83f78 12 *-----------------------------------------------------------------------------
nfathurr 34:029fc3b83f78 13 */
nfathurr 34:029fc3b83f78 14 //connection information for initialising ADISense1000
nfathurr 34:029fc3b83f78 15 /*
nfathurr 34:029fc3b83f78 16 ADI_SENSE_CONNECTION connectionInfo = {
nfathurr 34:029fc3b83f78 17 .type = ADI_SENSE_CONNECTION_TYPE_SPI,
nfathurr 34:029fc3b83f78 18 .spi = {
nfathurr 34:029fc3b83f78 19 .mosiPin = SPI_MOSI,
nfathurr 34:029fc3b83f78 20 .misoPin = SPI_MISO,
nfathurr 34:029fc3b83f78 21 .sckPin = SPI_SCK,
nfathurr 34:029fc3b83f78 22 .csPin = D10,
nfathurr 34:029fc3b83f78 23 .maxSpeedHz = 2000000,
nfathurr 34:029fc3b83f78 24 },
nfathurr 34:029fc3b83f78 25 .gpio = {
nfathurr 34:029fc3b83f78 26 .resetPin = D6,
nfathurr 34:029fc3b83f78 27 .errorPin = D3,
nfathurr 34:029fc3b83f78 28 .alertPin = D4,
nfathurr 34:029fc3b83f78 29 .datareadyPin = D5,
nfathurr 34:029fc3b83f78 30 },
nfathurr 34:029fc3b83f78 31 .log = {
nfathurr 34:029fc3b83f78 32 .txPin = D1,
nfathurr 34:029fc3b83f78 33 .rxPin = D0,
nfathurr 34:029fc3b83f78 34 .baudRate = 115200,
nfathurr 34:029fc3b83f78 35 .disableLogs = false,
nfathurr 34:029fc3b83f78 36 },
nfathurr 34:029fc3b83f78 37 };
nfathurr 34:029fc3b83f78 38 */
nfathurr 34:029fc3b83f78 39
nfathurr 34:029fc3b83f78 40 ADI_SENSE_CONNECTION connectionInfo = {
nfathurr 34:029fc3b83f78 41 .type = ADI_SENSE_CONNECTION_TYPE_SPI,
nfathurr 34:029fc3b83f78 42 .spi = {
nfathurr 34:029fc3b83f78 43 .mosiPin = SENSE_SPI_MOSI,
nfathurr 34:029fc3b83f78 44 .misoPin = SENSE_SPI_MISO,
nfathurr 34:029fc3b83f78 45 .sckPin = SENSE_SPI_SCK,
nfathurr 34:029fc3b83f78 46 .csPin = SENSE_SPI_CS,
nfathurr 34:029fc3b83f78 47 .maxSpeedHz = SENSE_SPI_FREQUENCY,
nfathurr 34:029fc3b83f78 48 },
nfathurr 34:029fc3b83f78 49 .gpio = {
nfathurr 34:029fc3b83f78 50 .resetPin = SENSE_RST_PIN,
nfathurr 34:029fc3b83f78 51 .errorPin = SENSE_ERROR_PIN,
nfathurr 34:029fc3b83f78 52 .alertPin = SENSE_ALERT_PIN,
nfathurr 34:029fc3b83f78 53 .datareadyPin = SENSE_DREADY_PIN,
nfathurr 34:029fc3b83f78 54 },
nfathurr 34:029fc3b83f78 55 .log = {
nfathurr 36:4aded4b4f060 56 .txPin = PC_UART_TX_PIN,
nfathurr 36:4aded4b4f060 57 .rxPin = PC_UART_RX_PIN,
nfathurr 36:4aded4b4f060 58 .baudRate = PC_UART_BAUDRATE,
nfathurr 34:029fc3b83f78 59 .disableLogs = false,
nfathurr 34:029fc3b83f78 60 },
nfathurr 34:029fc3b83f78 61 };
nfathurr 34:029fc3b83f78 62
nfathurr 34:029fc3b83f78 63 /*
nfathurr 34:029fc3b83f78 64 ******************************************************************************
nfathurr 34:029fc3b83f78 65 * Bluetooth Low Energy
nfathurr 34:029fc3b83f78 66 *-----------------------------------------------------------------------------
nfathurr 34:029fc3b83f78 67 */
nfathurr 34:029fc3b83f78 68 //reset pin of BLE module
nfathurr 34:029fc3b83f78 69 DigitalOut ble_rst(BLE_RST_PIN, 0);
nfathurr 34:029fc3b83f78 70
nfathurr 34:029fc3b83f78 71 //flow control
nfathurr 34:029fc3b83f78 72 DigitalOut ble_Cts(BLE_CTS_PIN, 1);
nfathurr 34:029fc3b83f78 73 DigitalIn ble_Rts(BLE_RTS_PIN);
nfathurr 34:029fc3b83f78 74
nfathurr 34:029fc3b83f78 75 Serial bleSerialDevice(BLE_SERIAL_TX, BLE_SERIAL_RX, BLE_BAUD_RATE);
nfathurr 34:029fc3b83f78 76
nfathurr 36:4aded4b4f060 77 //Serial bleSerialDevice(PC_UART_TX_PIN, PC_UART_RX_PIN, PC_UART_BAUDRATE);
nfathurr 36:4aded4b4f060 78
nfathurr 34:029fc3b83f78 79 #ifdef BL652
nfathurr 34:029fc3b83f78 80 DigitalOut bleMode0(BLE_MODE_0_PIN, 0);
nfathurr 34:029fc3b83f78 81 DigitalOut bleMode1(BLE_MODE_1_PIN, 0);
nfathurr 34:029fc3b83f78 82 #endif
nfathurr 34:029fc3b83f78 83
nfathurr 34:029fc3b83f78 84
nfathurr 34:029fc3b83f78 85 /*
nfathurr 34:029fc3b83f78 86 ******************************************************************************
nfathurr 34:029fc3b83f78 87 * PC Serial
nfathurr 34:029fc3b83f78 88 *-----------------------------------------------------------------------------
nfathurr 34:029fc3b83f78 89 */
nfathurr 34:029fc3b83f78 90
nfathurr 34:029fc3b83f78 91 //pointer initialised in adi_sense_Log.cpp using pins defined in this header
nfathurr 34:029fc3b83f78 92 Serial *gpUartDevice = new Serial(PC_UART_TX_PIN, PC_UART_RX_PIN, PC_UART_BAUDRATE);
nfathurr 34:029fc3b83f78 93
nfathurr 34:029fc3b83f78 94 /*
nfathurr 34:029fc3b83f78 95 ******************************************************************************
nfathurr 34:029fc3b83f78 96 * Battery
nfathurr 34:029fc3b83f78 97 *-----------------------------------------------------------------------------
nfathurr 34:029fc3b83f78 98 */
nfathurr 34:029fc3b83f78 99
nfathurr 34:029fc3b83f78 100 //pin for reading the current voltage of the battery
nfathurr 34:029fc3b83f78 101 //need solution to this. Battery ranges from 4.2V to 2V where the adc can only
nfathurr 34:029fc3b83f78 102 //read to 3.3V (VDD)
nfathurr 34:029fc3b83f78 103 //AnalogIn batteryV(BATTERY_V_PIN);
nfathurr 34:029fc3b83f78 104
nfathurr 34:029fc3b83f78 105 /*
nfathurr 34:029fc3b83f78 106 ******************************************************************************
nfathurr 34:029fc3b83f78 107 * Status LED
nfathurr 34:029fc3b83f78 108 *-----------------------------------------------------------------------------
nfathurr 34:029fc3b83f78 109 */
nfathurr 34:029fc3b83f78 110
nfathurr 34:029fc3b83f78 111 //flash when flash led is called, also iluminated when device boots successfully
nfathurr 34:029fc3b83f78 112 DigitalOut status_led(STATUS_LED_PIN, 0);
nfathurr 34:029fc3b83f78 113 //DigitalOut status_led1(PC_6, 0);
nfathurr 34:029fc3b83f78 114
nfathurr 34:029fc3b83f78 115