Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 0 additions & 78 deletions baro/baro.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,66 +353,6 @@ return baro_status;
} /* baro_get_device_id */


/*******************************************************************************
* *
* PROCEDURE: *
* baro_get_pressure *
* *
* DESCRIPTION: *
* retrieves a pressure reading from the sensor *
* *
*******************************************************************************/
BARO_STATUS baro_get_pressure
(
float* pressure_ptr /* Out: Baro pressure */
)
{
/*------------------------------------------------------------------------------
Local variables
------------------------------------------------------------------------------*/
uint8_t pressure_bytes[3]; /* Pressure raw readout bytes, LSB first */
uint32_t raw_pressure; /* Pressure raw readout in uint32_t format */
float comp_temp; /* Compensation temperature */
BARO_STATUS baro_status; /* Return codes for baro API calls */


/*------------------------------------------------------------------------------
Initializations
------------------------------------------------------------------------------*/
raw_pressure = 0;
comp_temp = 0;
baro_status = BARO_OK;
memset( &pressure_bytes[0], 0, sizeof( pressure_bytes ) );


/*------------------------------------------------------------------------------
API function implementation
------------------------------------------------------------------------------*/

/* Read 3 consecutive pressure data registers */
baro_status = read_regs( BARO_REG_PRESS_DATA,
sizeof( pressure_bytes ),
&pressure_bytes[0] );
if ( baro_status != BARO_OK )
{
return BARO_I2C_ERROR;
}

/* Combine all bytes value to 24 bit value */
raw_pressure = ( ( (uint32_t) pressure_bytes[2] << 16 ) |
( (uint32_t) pressure_bytes[1] << 8 ) |
( (uint32_t) pressure_bytes[0] ) );

/* Get compensation temperature for pressure compensation calculation */
baro_status = baro_get_temp( &comp_temp );

/* Compensate using calibration data */
*pressure_ptr = press_compensate( raw_pressure );

return BARO_OK;
} /* baro_get_pressure */


/*******************************************************************************
* *
* PROCEDURE: *
Expand Down Expand Up @@ -469,24 +409,6 @@ return BARO_OK;
} /* baro_get_temp */


/*******************************************************************************
* *
* PROCEDURE: *
* baro_get_altitude *
* *
* DESCRIPTION: *
* gets the altitude of the rocket from the sensor readouts *
* *
*******************************************************************************/
BARO_STATUS baro_get_altitude
(
void
)
{
return BARO_OK;
} /* baro_get_altitude */


/*------------------------------------------------------------------------------
Internal procedures
------------------------------------------------------------------------------*/
Expand Down
13 changes: 0 additions & 13 deletions baro/baro.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,25 +263,12 @@ BARO_STATUS baro_get_device_id
uint8_t* baro_id
);


/* gets pressure data from sensor */
BARO_STATUS baro_get_pressure
(
float* pressure_ptr
);

/* gets temp data from sensor */
BARO_STATUS baro_get_temp
(
float* temp_ptr
);

/* converts pressure and temp data into altitude --> do research on formula */
BARO_STATUS baro_get_altitude
(
void
);

/* returns the baro_data_ready flag */
bool baro_get_baro_data_ready
(
Expand Down
118 changes: 0 additions & 118 deletions buzzer/buzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,124 +153,6 @@ for ( uint8_t i = 0; i < num_beeps; i++ )
}


/*******************************************************************************
* *
* PROCEDURE: *
* buzzer_num_beeps *
* *
* DESCRIPTION: *
* Beep the flight computer buzzer specified number of times *
* *
*******************************************************************************/
BUZZ_STATUS buzzer_num_beeps
(
uint8_t num_beeps /* Number of beeps */
)
{
/* This function is implemented as a non-blocking function that uses the
sysClock to detemine when to take an action. The function is meant to be
used to loops with processing times less than the beep and intermittent
durations. The static variable num_calls is used to maintain memory of
how many times the function has been called. The static variables
init_beep_time and stop_beep_time are used to keep track of the time of
starting and stopping a beep between subsequenct function calls. The static
variable last_end_time is used to add a delay between subsequent sequences
of beeps so the beep count can be discerned */
static uint8_t num_calls = 0;
static uint32_t init_beep_time = 0;
static uint32_t stop_beep_time = 0;
static uint32_t last_end_time = 0;

/*------------------------------------------------------------------------------
Local variables
------------------------------------------------------------------------------*/
HAL_StatusTypeDef hal_status; /* Return codes from HAL API */
uint8_t total_num_calls; /* Number of times the function must be
called to beep num_beeps times */
uint8_t is_odd; /* 1 when num_calls is odd */
uint32_t current_tick; /* Current Sys tick */


/*------------------------------------------------------------------------------
Initializations
------------------------------------------------------------------------------*/
hal_status = HAL_OK;
total_num_calls = 2*num_beeps;
is_odd = num_calls%2;
current_tick = HAL_GetTick();


/*------------------------------------------------------------------------------
API Function Implementation
------------------------------------------------------------------------------*/

/* Check that enough time has elapsed since last beep sequence */
if ( ( current_tick - last_end_time ) <= BUZZ_SEQUENCE_DELAY )
{
return BUZZ_OK;
}

/* Check for 0 beeps */
if ( num_beeps == 0 )
{
return BUZZ_OK;
}

/* Remaining beeps */
if ( is_odd )
{
/* Stop Beep */
if ( ( ( current_tick - init_beep_time ) >= BUZZ_BEEP_DURATION ) )
{
hal_status = HAL_TIM_PWM_Stop( &( BUZZ_TIM ), BUZZ_TIM_CHANNEL );
if ( hal_status != HAL_OK )
{
return BUZZ_HAL_ERROR;
}
else
{
stop_beep_time = current_tick;
num_calls++;
/* Termination condition */
if ( num_calls == total_num_calls )
{
num_calls = 0;
last_end_time = current_tick;
}
return BUZZ_OK;
}
}
else
{
return BUZZ_OK;
}

}
else
{
/* Start beep */
if ( ( ( current_tick - stop_beep_time ) >= BUZZ_STOP_DURATION ) )
{
hal_status = HAL_TIM_PWM_Start( &(BUZZ_TIM), BUZZ_TIM_CHANNEL );
if ( hal_status != HAL_OK )
{
return BUZZ_HAL_ERROR;
}
else
{
init_beep_time = current_tick;
num_calls++;
return BUZZ_OK;
}
}
else
{
return BUZZ_OK;
}
}
} /* buzzer_num_beeps */


/*------------------------------------------------------------------------------
Internal procedures
------------------------------------------------------------------------------*/
Expand Down
Loading