test

Dependencies:   BLE_API nRF51822 mbed

Fork of KS7 by masaaki makabe

Branch:
KS3
Revision:
31:b5e19d153db4
Parent:
30:f67850cc3cfe
--- a/io.h	Mon May 23 05:15:58 2016 +0000
+++ b/io.h	Thu Jul 28 07:46:56 2016 +0000
@@ -2,13 +2,14 @@
 #define io_H_
 
 #include "mbed.h"
+#include "common.h"
 
 //#define UART_DEBUG
 
 //#define PCB_VER1 // define for ver1 board (P0_26/27 -> P0_24/25) & ADC
 //#define PCB_VER2
 //#define PCB_VER3 // default
-#define PCB_VER4 // with HX711
+//#define PCB_VER4 // with HX711
 
 //#define USE_JOYSTICK // define for using joystick as power switch in PCB_VER1
 
@@ -38,15 +39,15 @@
     int display_value; // 4-digit integer to display
     void display(float f); // set display brightness (0.0 - 1.0)
 
-    float get_weight(); // get (calibrated) weight [g]
+    virtual float get_weight(); // get (calibrated) weight [g]
 #ifdef PCB_VER4
-    uint32_t get_weight_raw(); // ADC raw value of weight gauage
+    virtual uint32_t get_weight_raw(); // ADC raw value of weight gauage
 #else
     uint16_t get_weight_raw(); // ADC raw value of weight gauage
 #endif
-    uint8_t get_switch(); // get switch status (1=pressed, 0=released)
+    virtual uint8_t get_switch(); // get switch status (1=pressed, 0=released)
 
-    void calibrate_weight(); // calibrate weight gauage
+    virtual void calibrate_weight(); // calibrate weight gauage
     void analog_pow(uint8_t f); // turn on/off analog power
 
 #ifdef PCB_VER4
@@ -61,7 +62,7 @@
     void power_save_mode(uint8_t f); // f=1 for power-save mode during sleep
 #endif
 
- private:
+ protected:
 #ifdef PCB_VER4
 #endif
     uint8_t _seg[4];
@@ -94,7 +95,11 @@
     uint8_t _fDisplaying;
 #endif
 #ifdef PCB_VER4
+/*S------------------------------------------------------------------*/
+protected:
     DigitalIn *_sw;
+    virtual void display_unit(void){}
+/*E------------------------------------------------------------------*/
 //    DigitalOut *_adc_ck; // for software SPI
 //    DigitalIn *_adc_di; // for software SPI
     DigitalOut *_reg_ps;