CAC_smartcushion / Mbed OS AdiSense1000_V21_Smartcushion

Fork of Sean_AdiSense1000_V21 by Rohan Gurav

Committer:
nfathurr
Date:
Thu Sep 27 12:14:22 2018 +0000
Revision:
35:853be4d80ff3
Parent:
34:029fc3b83f78
Child:
36:4aded4b4f060
fixed the adxl configuration

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 34:029fc3b83f78 56 /*
nfathurr 34:029fc3b83f78 57 * #define PC_UART_TX_PIN PA_11
nfathurr 34:029fc3b83f78 58 * #define PC_UART_RX_PIN PA_12
nfathurr 34:029fc3b83f78 59 */
nfathurr 34:029fc3b83f78 60 .txPin = PA_11,
nfathurr 34:029fc3b83f78 61 .rxPin = PA_12,
nfathurr 34:029fc3b83f78 62 .baudRate = 115200,
nfathurr 34:029fc3b83f78 63 .disableLogs = false,
nfathurr 34:029fc3b83f78 64 },
nfathurr 34:029fc3b83f78 65 };
nfathurr 34:029fc3b83f78 66
nfathurr 34:029fc3b83f78 67 /*
nfathurr 34:029fc3b83f78 68 ******************************************************************************
nfathurr 34:029fc3b83f78 69 * Bluetooth Low Energy
nfathurr 34:029fc3b83f78 70 *-----------------------------------------------------------------------------
nfathurr 34:029fc3b83f78 71 */
nfathurr 34:029fc3b83f78 72 //reset pin of BLE module
nfathurr 34:029fc3b83f78 73 DigitalOut ble_rst(BLE_RST_PIN, 0);
nfathurr 34:029fc3b83f78 74
nfathurr 34:029fc3b83f78 75 //flow control
nfathurr 34:029fc3b83f78 76 DigitalOut ble_Cts(BLE_CTS_PIN, 1);
nfathurr 34:029fc3b83f78 77 DigitalIn ble_Rts(BLE_RTS_PIN);
nfathurr 34:029fc3b83f78 78
nfathurr 34:029fc3b83f78 79 Serial bleSerialDevice(BLE_SERIAL_TX, BLE_SERIAL_RX, BLE_BAUD_RATE);
nfathurr 34:029fc3b83f78 80
nfathurr 34:029fc3b83f78 81 #ifdef BL652
nfathurr 34:029fc3b83f78 82 DigitalOut bleMode0(BLE_MODE_0_PIN, 0);
nfathurr 34:029fc3b83f78 83 DigitalOut bleMode1(BLE_MODE_1_PIN, 0);
nfathurr 34:029fc3b83f78 84 #endif
nfathurr 34:029fc3b83f78 85
nfathurr 34:029fc3b83f78 86
nfathurr 34:029fc3b83f78 87 /*
nfathurr 34:029fc3b83f78 88 ******************************************************************************
nfathurr 34:029fc3b83f78 89 * PC Serial
nfathurr 34:029fc3b83f78 90 *-----------------------------------------------------------------------------
nfathurr 34:029fc3b83f78 91 */
nfathurr 34:029fc3b83f78 92
nfathurr 34:029fc3b83f78 93 //pointer initialised in adi_sense_Log.cpp using pins defined in this header
nfathurr 34:029fc3b83f78 94 Serial *gpUartDevice = new Serial(PC_UART_TX_PIN, PC_UART_RX_PIN, PC_UART_BAUDRATE);
nfathurr 34:029fc3b83f78 95
nfathurr 34:029fc3b83f78 96 /*
nfathurr 34:029fc3b83f78 97 ******************************************************************************
nfathurr 34:029fc3b83f78 98 * Battery
nfathurr 34:029fc3b83f78 99 *-----------------------------------------------------------------------------
nfathurr 34:029fc3b83f78 100 */
nfathurr 34:029fc3b83f78 101
nfathurr 34:029fc3b83f78 102 //pin for reading the current voltage of the battery
nfathurr 34:029fc3b83f78 103 //need solution to this. Battery ranges from 4.2V to 2V where the adc can only
nfathurr 34:029fc3b83f78 104 //read to 3.3V (VDD)
nfathurr 34:029fc3b83f78 105 //AnalogIn batteryV(BATTERY_V_PIN);
nfathurr 34:029fc3b83f78 106
nfathurr 34:029fc3b83f78 107 /*
nfathurr 34:029fc3b83f78 108 ******************************************************************************
nfathurr 34:029fc3b83f78 109 * Status LED
nfathurr 34:029fc3b83f78 110 *-----------------------------------------------------------------------------
nfathurr 34:029fc3b83f78 111 */
nfathurr 34:029fc3b83f78 112
nfathurr 34:029fc3b83f78 113 //flash when flash led is called, also iluminated when device boots successfully
nfathurr 34:029fc3b83f78 114 DigitalOut status_led(STATUS_LED_PIN, 0);
nfathurr 34:029fc3b83f78 115 //DigitalOut status_led1(PC_6, 0);
nfathurr 34:029fc3b83f78 116
nfathurr 34:029fc3b83f78 117