]> git.tdb.fi Git - model-railway-devices.git/commitdiff
Make current and voltage readings public to other modules
authorMikko Rasa <tdb@tdb.fi>
Sun, 3 Nov 2013 17:08:22 +0000 (19:08 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 3 Nov 2013 17:08:22 +0000 (19:08 +0200)
arducontrol/monitor.c
arducontrol/monitor.h

index 7966c3da40eb0e46cac63c4282924b9dc5995c32..920f56ded6ccb579d2a025880449cbe58b2edfc7 100644 (file)
@@ -17,9 +17,6 @@ static volatile uint16_t input_voltage_sum = 0;
 static volatile uint8_t adc_state = 0;
 static volatile uint16_t adc_value = 0;
 
-static uint16_t track_current_milliamps(void);
-static uint16_t input_voltage_millivolts(void);
-
 void monitor_init(void)
 {
        DDRB |= 0x02;
@@ -77,7 +74,7 @@ uint8_t monitor_command(const uint8_t *cmd_buf, uint8_t cmd_length)
                if(cmd_length!=1)
                        return LENGTH_ERROR;
 
-               uint16_t value = track_current_milliamps();
+               uint16_t value = monitor_track_current();
                uint8_t reply[3];
                reply[0] = TRACK_CURRENT;
                reply[1] = value>>8;
@@ -103,7 +100,7 @@ uint8_t monitor_command(const uint8_t *cmd_buf, uint8_t cmd_length)
                if(cmd_length!=1)
                        return LENGTH_ERROR;
 
-               uint16_t value = input_voltage_millivolts();
+               uint16_t value = monitor_input_voltage();
                uint8_t reply[3];
                reply[0] = INPUT_VOLTAGE;
                reply[1] = value>>8;
@@ -116,7 +113,7 @@ uint8_t monitor_command(const uint8_t *cmd_buf, uint8_t cmd_length)
        return COMMAND_OK;
 }
 
-static uint16_t track_current_milliamps(void)
+uint16_t monitor_track_current(void)
 {
        uint16_t value = track_current_sum;
 
@@ -133,7 +130,7 @@ static uint16_t track_current_milliamps(void)
        }
 }
 
-static uint16_t input_voltage_millivolts(void)
+uint16_t monitor_input_voltage(void)
 {
        uint16_t value = input_voltage_sum;
 
index 031d26ec8bb246eb1845c89438482e9fe1e9d50a..c727c9ccf8a2e19cc91bd6099387c2a249f45fbd 100644 (file)
@@ -5,6 +5,8 @@
 
 void monitor_init(void);
 void monitor_check(void);
+uint16_t monitor_track_current(void);
+uint16_t monitor_input_voltage(void);
 uint8_t monitor_command(const uint8_t *, uint8_t);
 
 #endif