#ifndef __GPS_H__ #define __GPS_H__ #include "f41x_rtc.h" /* * u-block GPS => Little Endian!! * sdcc => Little Endian * */ #define GPS_MAX_TIME (60UL * 60 * 24 * 7) // seconds #define GPS_MAX_SAT 16 void gps_init(void); void gps_polling(); void send_fake_ubx_rxm_raw(u32 *itow); extern volatile bit gps_ms_modified; extern u8 xdata gps_num_of_sat; extern u32 xdata gps_ms_next_1pps; #define CRITICAL_GPS_1PPS(func) \ { \ IE0 = 0; \ { \ func; \ } \ IE0 = 1; \ } #ifdef MAIN_C void interrupt_int0(void) interrupt 0 { if(gps_ms_modified){ gps_ms_modified = FALSE; rtc_set_seconds_now(); global_ms = gps_ms_next_1pps; // Disable Alarm rtc_write(RTC_RTC0CN, (rtc_read(RTC_RTC0CN) & (~0x08))); global_ms_update_before_n_seconds = 0; } P1 ^= 0x40; } #endif #endif /* __GPS_H__ */