Local library

Dependencies:   WakeUp PinDetect

Dependents:   Inductive_Sensor Inductive_Sensor_Jasper Inductive_Sensor_3

Committer:
bobgiesberts
Date:
Wed Sep 21 14:23:19 2016 +0000
Revision:
9:3fe744aca1c0
Parent:
7:0b23995256e7
Libraries loaded in .h (and not double in .cpp)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bobgiesberts 0:17943815800f 1 #ifndef _Bob_H_
bobgiesberts 0:17943815800f 2 #define _Bob_H_
bobgiesberts 0:17943815800f 3
bobgiesberts 0:17943815800f 4 /**
bobgiesberts 0:17943815800f 5 * @file Bob.h
bobgiesberts 0:17943815800f 6 * @brief collection of some functions to communicate
bobgiesberts 0:17943815800f 7 * with the processor board. LEDs, SD, etc.
bobgiesberts 0:17943815800f 8 *
bobgiesberts 0:17943815800f 9 * @author Bob Giesberts
bobgiesberts 0:17943815800f 10 *
bobgiesberts 0:17943815800f 11 * @date 2015-12-18
bobgiesberts 0:17943815800f 12 */
bobgiesberts 0:17943815800f 13
bobgiesberts 0:17943815800f 14 #include "mbed.h"
bobgiesberts 9:3fe744aca1c0 15 #include "mbed_debug.h"
bobgiesberts 6:0e7c0ad0508b 16 #include "PinDetect.h"
bobgiesberts 9:3fe744aca1c0 17 #include "WakeUp.h"
bobgiesberts 0:17943815800f 18
bobgiesberts 0:17943815800f 19 class Bob {
bobgiesberts 0:17943815800f 20 public:
bobgiesberts 0:17943815800f 21
bobgiesberts 6:0e7c0ad0508b 22 /** Construct a new instance of the class Bob
bobgiesberts 6:0e7c0ad0508b 23 * @param process_led Pin connected to the green led, used for processing
bobgiesberts 6:0e7c0ad0508b 24 * @param error_led Pin connected to the red led, used for errors
bobgiesberts 6:0e7c0ad0508b 25 * @param button Pin connected to the I/O button
bobgiesberts 7:0b23995256e7 26 * @param enable Pin connected to the SD card system and the crystal
bobgiesberts 6:0e7c0ad0508b 27 * @param sd_present Pin connected to the SDCardDetect port
bobgiesberts 6:0e7c0ad0508b 28 * @param battery Pin connected to the battery
bobgiesberts 6:0e7c0ad0508b 29 */
bobgiesberts 7:0b23995256e7 30 Bob(PinName process_led, PinName error_led, PinName button, PinName enable, PinName sd_present, PinName battery);
bobgiesberts 6:0e7c0ad0508b 31 ~Bob();
bobgiesberts 6:0e7c0ad0508b 32
bobgiesberts 0:17943815800f 33 bool checkSD(void);
bobgiesberts 4:9c3c8eb56a2b 34
bobgiesberts 7:0b23995256e7 35 void wakeup_periphery(void);
bobgiesberts 7:0b23995256e7 36
bobgiesberts 7:0b23995256e7 37 /** shutdown_periphery
bobgiesberts 7:0b23995256e7 38 * Powers down the SD card system, the crystal and the LDC1614
bobgiesberts 7:0b23995256e7 39 */
bobgiesberts 7:0b23995256e7 40 void shutdown_periphery(void);
bobgiesberts 9:3fe744aca1c0 41 void shutdown_pin(PinName pin, int value = 0, PinMode pull = PullNone );
bobgiesberts 4:9c3c8eb56a2b 42 void sleep(uint32_t ms);
bobgiesberts 6:0e7c0ad0508b 43
bobgiesberts 4:9c3c8eb56a2b 44
bobgiesberts 2:681ecede6dcb 45 float battery(void);
bobgiesberts 5:c2468a69aacb 46
bobgiesberts 9:3fe744aca1c0 47 void flash(int n, int led = 0 );
bobgiesberts 9:3fe744aca1c0 48 void processing( int n = 0 );
bobgiesberts 7:0b23995256e7 49 void no_processing(void);
bobgiesberts 9:3fe744aca1c0 50 void error( int n = 0 );
bobgiesberts 7:0b23995256e7 51 void no_error(void);
bobgiesberts 0:17943815800f 52
bobgiesberts 0:17943815800f 53 private:
bobgiesberts 7:0b23995256e7 54 DigitalOut _led_process; // green led
bobgiesberts 7:0b23995256e7 55 DigitalOut _led_error; // red led
bobgiesberts 7:0b23995256e7 56 PinDetect _button; // button
bobgiesberts 7:0b23995256e7 57 DigitalOut _enable; // pin to power all periphery (SD, crystal, LDC1614)
bobgiesberts 7:0b23995256e7 58
bobgiesberts 2:681ecede6dcb 59 DigitalIn *_sd_card_detect;
bobgiesberts 5:c2468a69aacb 60
bobgiesberts 2:681ecede6dcb 61 AnalogIn *_batt;
bobgiesberts 5:c2468a69aacb 62
bobgiesberts 0:17943815800f 63 };
bobgiesberts 0:17943815800f 64
bobgiesberts 0:17943815800f 65 #endif