Changeset - 34a13647cf13
[Not reviewed]
default
0 4 0
Ethan Zonca (ethanzonca) - 9 years ago 2017-01-03 16:23:50
e@ethanzonca.com
Pressure reading now works! Needs pullups added...
4 files changed with 19 insertions and 3 deletions:
0 comments (0 inline, 0 general)
Include/system/stm32f0xx_hal_conf.h
Show inline comments
 
@@ -15,13 +15,13 @@
 
//#define HAL_CEC_MODULE_ENABLED   
 
//#define HAL_COMP_MODULE_ENABLED   
 
//#define HAL_CRC_MODULE_ENABLED   
 
//#define HAL_CRYP_MODULE_ENABLED   
 
//#define HAL_TSC_MODULE_ENABLED   
 
//#define HAL_DAC_MODULE_ENABLED   
 
//#define HAL_I2C_MODULE_ENABLED
 
#define HAL_I2C_MODULE_ENABLED
 
//#define HAL_I2S_MODULE_ENABLED   
 
#define HAL_IWDG_MODULE_ENABLED
 
//#define HAL_LCD_MODULE_ENABLED   
 
//#define HAL_LPTIM_MODULE_ENABLED   
 
//#define HAL_RNG_MODULE_ENABLED   
 
//#define HAL_RTC_MODULE_ENABLED   
Libraries/aprs/aprs.c
Show inline comments
 
@@ -21,12 +21,13 @@
 
 */
 

	
 
#include <string.h>
 
#include <stdlib.h>
 

	
 
#include "config.h"
 
#include "pressure.h"
 
#include "aprs.h"
 
#include "gps.h"
 
//#include "gps.h"
 
//#include "adc.h"
 
#include "ax25.h"
 

	
 
@@ -75,17 +76,17 @@ void aprs_send(void)
 

	
 
  // Altitude
 
  snprintf(tmpBuffer, 128, "%d,", gps_getdata()->altitude);
 
  ax25_send_string(tmpBuffer);
 

	
 
  // Pressure
 
  snprintf(tmpBuffer, 128, "%d,", 23);
 
  snprintf(tmpBuffer, 128, "%d,", pressure_getpressure());
 
  ax25_send_string(tmpBuffer);
 
  
 
  // Temperature
 
  snprintf(tmpBuffer, 128, "%d,", 77);
 
  snprintf(tmpBuffer, 128, "%d,", pressure_gettemp());
 
  ax25_send_string(tmpBuffer);
 

	
 
  // HDOP
 
  snprintf(tmpBuffer, 128, "%u,", gps_getdata()->pdop);
 
  ax25_send_string(tmpBuffer);
 

	
Source/main.c
Show inline comments
 
@@ -10,12 +10,13 @@
 
#include "system/watchdog.h"
 
#include "system/uart.h"
 
#include "stm32f0xx_hal.h"
 
#include "si446x/si446x.h"
 
#include "aprs/aprs.h"
 
#include "aprs/afsk.h"
 
#include "pressure.h"
 
#include "gps.h"
 
 
 
int main(void)
 
{
 
  hal_init();
 
@@ -23,23 +24,25 @@ int main(void)
 
  gpio_init();
 
 
 
  afsk_init();
 
  si446x_init();
 
  gps_poweron();
 
  pressure_init();
 
 
  // Software timers
 
  uint32_t last_transmission = HAL_GetTick();
 
  uint32_t last_led = HAL_GetTick();
 
 
  while (1)
 
  {
 
	  // Blink LEDs
 
	  if(HAL_GetTick() - last_transmission > 700)
 
	  {
 
		  gps_update_data(); // Will always return at 1hz rate (default measurement rate)
 
		  pressure_read();
 
		  aprs_send();
 
		  //while(afsk_busy());
 
 
		  last_transmission = HAL_GetTick();
 
	  }
 
Source/system/interrupts.c
Show inline comments
 
@@ -5,12 +5,13 @@
 
#include <system/gpio.h>
 
#include <system/stm32f0xx_it.h>
 
#include "stm32f0xx_hal.h"
 
#include "stm32f0xx.h"
 
#include "system/gpio.h"
 
#include "aprs/afsk.h"
 
#include "pressure.h"
 
 
// Systick
 
void SysTick_Handler(void)
 
{
 
  HAL_IncTick();
 
  HAL_SYSTICK_IRQHandler();
 
@@ -23,6 +24,17 @@ void TIM1_CC_IRQHandler(void)
 
}
 
 
void TIM1_BRK_UP_TRG_COM_IRQHandler(void)
 
{
 
  HAL_TIM_IRQHandler(afsk_timer_gethandle());
 
}
 
 
 
// Handle I2C interrupts
 
void I2C1_IRQHandler(void)
 
{
 
	if (pressure_get_i2c_handle()->Instance->ISR & (I2C_FLAG_BERR | I2C_FLAG_ARLO | I2C_FLAG_OVR)) {
 
		HAL_I2C_ER_IRQHandler(pressure_get_i2c_handle());
 
	} else {
 
		HAL_I2C_EV_IRQHandler(pressure_get_i2c_handle());
 
	}
 
}
0 comments (0 inline, 0 general)