Files
@ 48ae84f03494
Branch filter:
Location: protofuse-firmware/src/main.c - annotation
48ae84f03494
1.2 KiB
text/plain
Update to new HAL library, add some ADC code
ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d 47fdd16b7231 48ae84f03494 ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d 47fdd16b7231 47fdd16b7231 47fdd16b7231 47fdd16b7231 47fdd16b7231 7e9d097bfe72 7e9d097bfe72 47fdd16b7231 48ae84f03494 7e9d097bfe72 ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d 48ae84f03494 ad3725832a9d ad3725832a9d ad3725832a9d 7e9d097bfe72 ad3725832a9d 7e9d097bfe72 48ae84f03494 48ae84f03494 48ae84f03494 7e9d097bfe72 7e9d097bfe72 7e9d097bfe72 ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d | //
// STM32F103 Template Firmware
// Copyright 2016 SeaLandAire Technologies
// Author(s): Ethan Zonca
//
#include "stm32f3xx_hal.h"
#include "config.h"
#include "watchdog.h"
#include "system.h"
#include "gpio.h"
#include "error.h"
#include "flash.h"
#include "ssd1306.h"
#include "stdio.h"
int main(void)
{
sysclock_init();
hal_init();
gpio_init();
ssd1306_init();
ssd1306_drawlogo();
ssd1306_clearscreen();
// ssd1306_drawstring(const char *dataPtr, unsigned char row, unsigned char xPos)
ssd1306_drawstring("[ ProtoFuse ]", 0, 0);
ssd1306_drawstring("HW v1.0 SW v0.1", 1, 0);
uint16_t battery_adc_count = 0;
flash_init();
watchdog_init();
// Software timers
uint32_t last_blink_time = HAL_GetTick();
while (1)
{
// Grab and transmit data
if(HAL_GetTick() - last_blink_time > 1000)
{
char buffer[256];
// added stdio.h to fix implicit declaration error
// changed battery_adc_count from int32_t to int
snprintf(buffer, 256, "My Variable: %u", battery_adc_count);
ssd1306_drawstring(buffer, 2, 0);
// HAL_GPIO_TogglePin(LED_RED);
battery_adc_count++;
last_blink_time = HAL_GetTick();
}
watchdog_feed();
}
}
|