repo

Dependencies:   mbed BLE_API nRF51822 X_NUCLEO_IDB0XA1

Committer:
orshefi
Date:
Thu Oct 31 18:50:07 2019 +0000
Revision:
81:b26ba1ec7625
Parent:
80:4fbfa09ac26c
init

Who changed what in which revision?

UserRevisionLine numberNew contents of line
orshefi 80:4fbfa09ac26c 1 #include "mbed.h"
orshefi 80:4fbfa09ac26c 2 #include <stdbool.h>
orshefi 80:4fbfa09ac26c 3 #include <stdint.h>
orshefi 80:4fbfa09ac26c 4 #include "nrf.h"
orshefi 80:4fbfa09ac26c 5 #include "nrf_gpio.h"
orshefi 80:4fbfa09ac26c 6
orshefi 80:4fbfa09ac26c 7
orshefi 80:4fbfa09ac26c 8 DigitalOut measure_led(P0_15);
orshefi 80:4fbfa09ac26c 9 DigitalOut alive_led(P0_17);
orshefi 81:b26ba1ec7625 10 DigitalIn main_power(P0_5);
orshefi 80:4fbfa09ac26c 11 DigitalOut V33ON(P0_20);
orshefi 80:4fbfa09ac26c 12 DigitalOut LCDON(P0_19);
orshefi 80:4fbfa09ac26c 13 DigitalOut scl(P0_22);
orshefi 80:4fbfa09ac26c 14 DigitalOut sda(P0_23);
orshefi 80:4fbfa09ac26c 15 AnalogIn a0(P0_4);//analog input
orshefi 80:4fbfa09ac26c 16 DigitalOut clk(P0_7);//sensor clk
orshefi 80:4fbfa09ac26c 17 AnalogIn ref(P0_6);//serial input flag
orshefi 81:b26ba1ec7625 18 DigitalOut wake_up(P0_24);//wake up button
orshefi 80:4fbfa09ac26c 19 DigitalIn swl(P0_16,PullUp);//secondry click
orshefi 80:4fbfa09ac26c 20
orshefi 80:4fbfa09ac26c 21
orshefi 80:4fbfa09ac26c 22 int reflect_data[] = {0,};
orshefi 80:4fbfa09ac26c 23 int i = 0;
orshefi 80:4fbfa09ac26c 24 float analog_read = 0;
orshefi 80:4fbfa09ac26c 25
orshefi 80:4fbfa09ac26c 26 void wdt_init(void)
orshefi 80:4fbfa09ac26c 27 {
orshefi 80:4fbfa09ac26c 28 NRF_WDT->CONFIG = (WDT_CONFIG_HALT_Pause << WDT_CONFIG_HALT_Pos) | ( WDT_CONFIG_SLEEP_Run << WDT_CONFIG_SLEEP_Pos);
orshefi 80:4fbfa09ac26c 29 NRF_WDT->CRV = 15*32768; //ca 3 sek. timout
orshefi 80:4fbfa09ac26c 30 NRF_WDT->RREN |= WDT_RREN_RR0_Msk; //Enable reload register 0
orshefi 80:4fbfa09ac26c 31 NRF_WDT->TASKS_START = 1;
orshefi 80:4fbfa09ac26c 32 }