I-O DATA DEV2 / Mbed 2 deprecated ud-gs4-R_400G_SD_Hello

Dependencies:   mbed SDFileSystem H3LIS331DL

Committer:
hakusan270
Date:
Fri Feb 12 05:10:48 2021 +0000
Revision:
0:b76e4ba14765
Child:
1:025596ffc973
UD-GS2 mbed hello world

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hakusan270 0:b76e4ba14765 1 #include "mbed.h"
hakusan270 0:b76e4ba14765 2
hakusan270 0:b76e4ba14765 3 /*
hakusan270 0:b76e4ba14765 4 This basic example just shows how to read the ADC internal channels raw values.
hakusan270 0:b76e4ba14765 5 Please look in the corresponding device reference manual for a complete
hakusan270 0:b76e4ba14765 6 description of how to make a temperature sensor, VBat or Vref measurement.
hakusan270 0:b76e4ba14765 7 */
hakusan270 0:b76e4ba14765 8
hakusan270 0:b76e4ba14765 9 AnalogIn adc_temp(ADC_TEMP);
hakusan270 0:b76e4ba14765 10 AnalogIn adc_vref(ADC_VREF);
hakusan270 0:b76e4ba14765 11 /* UD-GS2 H/W define
hakusan270 0:b76e4ba14765 12 PIO_SWin PB_4
hakusan270 0:b76e4ba14765 13 PIO_wkup PA_4
hakusan270 0:b76e4ba14765 14 PIO_enable PB_0
hakusan270 0:b76e4ba14765 15 PIO_intout1 PB_2
hakusan270 0:b76e4ba14765 16 PIO_led PB_5
hakusan270 0:b76e4ba14765 17 PIO_v20v PC_13
hakusan270 0:b76e4ba14765 18 PIO_v18v PH_0
hakusan270 0:b76e4ba14765 19 PIO_intout2 PH_1
hakusan270 0:b76e4ba14765 20 PIO_spics PB_12
hakusan270 0:b76e4ba14765 21 PIO_battryMonEn PA_5
hakusan270 0:b76e4ba14765 22 */
hakusan270 0:b76e4ba14765 23
hakusan270 0:b76e4ba14765 24 RawSerial pc(PA_9, PA_10,115200); //console UART
hakusan270 0:b76e4ba14765 25 LowPowerTicker interrput;
hakusan270 0:b76e4ba14765 26 SPI STSPI(PB_15, PB_14, PB_13); //mosi,miso,clk
hakusan270 0:b76e4ba14765 27 DigitalOut STSPICS(PB_12);
hakusan270 0:b76e4ba14765 28 DigitalOut led(PB_5);
hakusan270 0:b76e4ba14765 29
hakusan270 0:b76e4ba14765 30 int main()
hakusan270 0:b76e4ba14765 31 {
hakusan270 0:b76e4ba14765 32 pc.printf("\nSTM32 ADC internal channels reading example\r\n");
hakusan270 0:b76e4ba14765 33 while(1) {
hakusan270 0:b76e4ba14765 34 pc.printf("ADC Temp = %f\r\n", (adc_temp.read()*100));
hakusan270 0:b76e4ba14765 35 pc.printf("ADC VRef = %f\r\n", adc_vref.read());
hakusan270 0:b76e4ba14765 36 pc.printf("\033[2A");
hakusan270 0:b76e4ba14765 37 led = !led;
hakusan270 0:b76e4ba14765 38 wait(1.0);
hakusan270 0:b76e4ba14765 39 }
hakusan270 0:b76e4ba14765 40 }