UoS³ Flight Computer Firmware
 All Data Structures Files Functions Groups Pages
demo_tempsensors.c
1 /* firmware.h contains all relevant headers */
2 #include "../firmware.h"
3 
4 #include <stdio.h>
5 
6 #define UART_INTERFACE UART_CAMERA
7 
8 int main(void)
9 {
10  char output[100];
11 
12  Board_init();
13 
14  LED_on(LED_B);
15 
16  UART_init(UART_INTERFACE, 9600);
17  UART_puts(UART_INTERFACE, "\r\nTemperature Sensors Demo\r\n");
18 
19  while(1)
20  {
21  LED_on(LED_B);
22 
23  sprintf(output,"PCT2075: %+.1f°C, TMP100: %+.1f°C\r\n",
24  ((double)Temperature_read_pct2075()/10),
25  ((double)Temperature_read_tmp100()/10)
26  );
27  UART_puts(UART_INTERFACE, output);
28 
29  LED_off(LED_B);
30 
31  Delay_ms(200);
32  }
33 }
void Delay_ms(uint32_t milliseconds)
Definition: delay.c:19
void UART_init(uint8_t uart_num, uint32_t baudrate)
Definition: uart.c:78
void LED_off(uint8_t led_num)
Definition: led.c:20
int16_t Temperature_read_pct2075(void)
int main(void)
Runs all module tests.
Definition: test.c:19
int16_t Temperature_read_tmp100(void)
void UART_puts(uint8_t uart_num, char *str)
Definition: uart.c:129
void Board_init(void)
Definition: board.c:13
void LED_on(uint8_t led_num)
Definition: led.c:15