diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-06-20 22:28:41 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-06-20 22:28:41 +0200 |
commit | 583b44cac7915070bdbeffd94a7073ffb5dbee3f (patch) | |
tree | 53d7874ed7f4a01c0ab30025ac8494babfe748d1 | |
parent | c1aafe32fa2b6493b4c2658afc8c82866e25bfee (diff) | |
download | glutte-o-matic-583b44cac7915070bdbeffd94a7073ffb5dbee3f.tar.gz glutte-o-matic-583b44cac7915070bdbeffd94a7073ffb5dbee3f.tar.bz2 glutte-o-matic-583b44cac7915070bdbeffd94a7073ffb5dbee3f.zip |
Replace LED_BLUE by GPS EPPS
-rw-r--r-- | src/common/includes/GPIO/pio.h | 2 | ||||
-rw-r--r-- | src/common/src/Core/main.c | 24 | ||||
-rw-r--r-- | src/glutt-o-logique/pio.c | 13 | ||||
-rw-r--r-- | src/simulator/src/GPIO/pio.c | 4 |
4 files changed, 32 insertions, 11 deletions
diff --git a/src/common/includes/GPIO/pio.h b/src/common/includes/GPIO/pio.h index 10b83bf..6f047f9 100644 --- a/src/common/includes/GPIO/pio.h +++ b/src/common/includes/GPIO/pio.h @@ -39,6 +39,8 @@ void pio_set_tx(int on); void pio_set_mod_off(int mod_off); void pio_set_qrp(int on); +void pio_set_gps_epps(int on); + void pio_set_fsm_signals(struct fsm_input_signals_t* sig); int pio_read_button(void); diff --git a/src/common/src/Core/main.c b/src/common/src/Core/main.c index c3b79b9..f3c1057 100644 --- a/src/common/src/Core/main.c +++ b/src/common/src/Core/main.c @@ -300,7 +300,7 @@ static void audio_callback(void __attribute__ ((unused))*context, int select_buf static struct tm gps_time; static void gps_monit_task(void __attribute__ ((unused))*pvParameters) { - leds_turn_on(LED_BLUE); + pio_set_gps_epps(1); int t_gps_print_latch = 0; int t_gps_hours_handeled = 0; @@ -313,11 +313,11 @@ static void gps_monit_task(void __attribute__ ((unused))*pvParameters) { int derived_mode = 0; if (time_valid) { - if (time.tm_sec % 4 >= 2) { - leds_turn_on(LED_BLUE); + if (time.tm_sec % 2) { + pio_set_gps_epps(1); } else { - leds_turn_off(LED_BLUE); + pio_set_gps_epps(0); } // Even hours: tm_trigger=1, odd hours: tm_trigger=0 @@ -325,16 +325,17 @@ static void gps_monit_task(void __attribute__ ((unused))*pvParameters) { derived_mode = 0; - } else { + } + else { time_valid = local_derived_time(&time); if (time_valid) { - if (time.tm_sec % 2) { - leds_turn_on(LED_BLUE); + if (time.tm_sec % 4 >= 2) { + pio_set_gps_epps(1); } else { - leds_turn_off(LED_BLUE); + pio_set_gps_epps(0); } derived_mode = 1; @@ -358,7 +359,8 @@ static void gps_monit_task(void __attribute__ ((unused))*pvParameters) { if (derived_mode) { mode = "Derived"; - } else { + } + else { mode = "GPS"; } @@ -386,8 +388,8 @@ static void gps_monit_task(void __attribute__ ((unused))*pvParameters) { if (last_hour_timestamp == 0) { usart_debug("DERIV INIT TS=%lld\r\n", current_timestamp); - } else { - + } + else { usart_debug("DERIV TS=%lld Excepted=%lld Delta=%lld\r\n", current_timestamp, last_hour_timestamp + 3600000, diff --git a/src/glutt-o-logique/pio.c b/src/glutt-o-logique/pio.c index e7c2a29..003b50b 100644 --- a/src/glutt-o-logique/pio.c +++ b/src/glutt-o-logique/pio.c @@ -38,12 +38,14 @@ #define GPIO_PIN_D GPIO_Pin_11 #define GPIO_PIN_REPLIE_n GPIO_Pin_13 #define GPIO_PIN_FAX GPIO_Pin_14 +#define GPIO_PIN_GPS_EPPS GPIO_Pin_15 #define GPIOC_OUTPUT_PINS ( \ GPIO_PIN_TX | \ GPIO_PIN_MOD_OFF | \ GPIO_PIN_QRP_out | \ + GPIO_PIN_GPS_EPPS | \ 0) #undef GPIOC_OPENDRAIN_PINS @@ -186,3 +188,14 @@ void pio_set_mod_off(int mod_off) int pio_read_button() { return GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_0) == Bit_SET; } + +void pio_set_gps_epps(int on) +{ + if (on) { + GPIO_SetBits(GPIOC, GPIO_PIN_GPS_EPPS); + } + else { + GPIO_ResetBits(GPIOC, GPIO_PIN_GPS_EPPS); + } +} + diff --git a/src/simulator/src/GPIO/pio.c b/src/simulator/src/GPIO/pio.c index cc16f73..753cb1f 100644 --- a/src/simulator/src/GPIO/pio.c +++ b/src/simulator/src/GPIO/pio.c @@ -53,6 +53,10 @@ void pio_set_qrp(int on) { gui_out_qrp = on; } +void pio_set_gps_epps(int on) { + // TODO +} + void pio_set_fsm_signals(struct fsm_input_signals_t* sig) { sig->qrp = gui_in_qrp_n ? 0 : 1; |