[sys_time] cleanup: use sys_time.nb_x instead of old cpu_time_x

This commit is contained in:
Felix Ruess
2013-02-13 18:50:59 +01:00
parent 53c09578a7
commit 281cf58259
14 changed files with 15 additions and 18 deletions
+1 -1
View File
@@ -58,7 +58,7 @@ void baro_init(void) {
}
void baro_periodic(void) {
if (cpu_time_sec > 1) {
if (sys_time.nb_sec > 1) {
if (ms5611_status == MS5611_IDLE) {
/* start D1 conversion */
ms5611_status = MS5611_CONV_D1;
+1 -1
View File
@@ -81,7 +81,7 @@ void baro_init(void) {
}
void baro_periodic(void) {
if (cpu_time_sec > 1) {
if (sys_time.nb_sec > 1) {
if (ms5611_status == MS5611_IDLE) {
/* start D1 conversion */
ms5611_status = MS5611_CONV_D1;
+1 -1
View File
@@ -76,7 +76,7 @@ static inline void main_periodic_task( void ) {
// uint16_t foo = ami601_status;
// DOWNLINK_SEND_BOOT(&foo);
//#endif
// if (cpu_time_sec > 2)
// if (sys_time.nb_sec > 2)
imu_periodic();
}
+1 -1
View File
@@ -28,6 +28,6 @@ static inline void main_init( void ) {
static inline void main_periodic_task( void ) {
LED_TOGGLE(1);
Uart0PrintString("demo3 running since ");
Uart0PrintHex32(cpu_time_sec);
Uart0PrintHex32(sys_time.nb_sec);
Uart0PrintString(" seconds\n");
}
-3
View File
@@ -60,9 +60,6 @@ struct sys_time {
extern struct sys_time sys_time;
//FIXME temporary hack
#define cpu_time_sec sys_time.nb_sec
#define cpu_time_ticks sys_time.nb_sec_rem
extern void sys_time_init(void);
+1 -1
View File
@@ -59,7 +59,7 @@ void dust_gp2y_periodic( void ) {
if (dust_gp2y_status == DUST_GP2Y_IDLE) {
I2CReceive(GP2Y_I2C_DEV, gp2y_trans, GP2Y_SLAVE_ADDR, 2);
}
else if (dust_gp2y_status == DUST_GP2Y_UNINIT && cpu_time_sec > 1) {
else if (dust_gp2y_status == DUST_GP2Y_UNINIT && sys_time.nb_sec > 1) {
dust_gp2y_status = DUST_GP2Y_IDLE;
}
}
+1 -1
View File
@@ -57,7 +57,7 @@ void humid_htm_init(void) {
}
void humid_htm_start( void ) {
if (cpu_time_sec > 1) {
if (sys_time.nb_sec > 1) {
/* measurement request: wake up sensor, sample temperature/humidity */
I2CTransmit(HTM_I2C_DEV, htm_trans, HTM_SLAVE_ADDR, 0);
htm_status = HTM_MR;
+1 -1
View File
@@ -67,7 +67,7 @@ void ir_mlx_init( void ) {
}
void ir_mlx_periodic( void ) {
if (cpu_time_sec > 1) {
if (sys_time.nb_sec > 1) {
if (ir_mlx_status >= IR_MLX_IDLE) {
/* start two byte case temperature */
mlx_trans.buf[0] = MLX90614_TA;
@@ -88,7 +88,7 @@ void baro_ms5611_init(void) {
}
void baro_ms5611_periodic( void ) {
if (cpu_time_sec > 1) {
if (sys_time.nb_sec > 1) {
if (ms5611_status >= MS5611_IDLE) {
/* start D1 conversion */
ms5611_status = MS5611_CONV_D1;
@@ -114,7 +114,7 @@ void baro_ms5611_periodic( void ) {
}
void baro_ms5611_d1( void ) {
if (cpu_time_sec > 1) {
if (sys_time.nb_sec > 1) {
if (ms5611_status == MS5611_CONV_D1_OK) {
/* read D1 adc */
ms5611_status = MS5611_ADC_D1;
@@ -125,7 +125,7 @@ void baro_ms5611_d1( void ) {
}
void baro_ms5611_d2( void ) {
if (cpu_time_sec > 1) {
if (sys_time.nb_sec > 1) {
if (ms5611_status == MS5611_CONV_D2_OK) {
/* read D2 adc */
ms5611_status = MS5611_ADC_D2;
+1 -1
View File
@@ -34,7 +34,7 @@ static void EXTINT_ISR(void) __attribute__((naked));
static void SPI1_ISR(void) __attribute__((naked));
void baro_scp_periodic(void) {
if (baro_scp_status == STA_UNINIT && cpu_time_sec > 1) {
if (baro_scp_status == STA_UNINIT && sys_time.nb_sec > 1) {
baro_scp_start_high_res_measurement();
baro_scp_status = STA_INITIALISING;
}
+1 -1
View File
@@ -48,7 +48,7 @@ void baro_scp_init( void ) {
void baro_scp_periodic( void ) {
if (baro_scp_status == BARO_SCP_UNINIT && cpu_time_sec > 1) {
if (baro_scp_status == BARO_SCP_UNINIT && sys_time.nb_sec > 1) {
baro_scp_start_high_res_measurement();
baro_scp_status = BARO_SCP_IDLE;
+1 -1
View File
@@ -81,7 +81,7 @@ struct GpsState {
uint8_t nb_channels; ///< Number of scanned satellites
struct SVinfo svinfos[GPS_NB_CHANNELS]; ///< holds information from the Space Vehicles (Satellites)
uint32_t last_fix_ticks; ///< cpu time in ticks at last valid fix
uint32_t last_fix_ticks; ///< cpu time ticks at last valid fix
uint32_t last_fix_time; ///< cpu time in sec at last valid fix
uint16_t reset; ///< hotstart, warmstart, coldstart
};
+1 -1
View File
@@ -69,7 +69,7 @@ extern struct GpsNmea gps_nmea;
nmea_parse_msg(); \
if (gps_nmea.pos_available) { \
if (gps.fix == GPS_FIX_3D) { \
gps.last_fix_ticks = cpu_time_ticks; \
gps.last_fix_ticks = sys_time.nb_sec_rem; \
gps.last_fix_time = sys_time.nb_sec; \
} \
_sol_available_callback(); \
+1 -1
View File
@@ -71,7 +71,7 @@ static inline void main_init( void ) {
static inline void main_periodic_task( void ) {
if (cpu_time_sec > 1) imu_periodic();
if (sys_time.nb_sec > 1) imu_periodic();
RunOnceEvery(10, { LED_PERIODIC();});
main_report();
}