Loading...
Searching...
No Matches
baro.c
1/***********************************************************************************
2 * @file launch.c *
3 * @author Matt Ricci *
4 * @addtogroup Shell *
5 * *
6 * @{ *
7 ***********************************************************************************/
8
9#include "baro.h"
10
11static void Baro_exec(Shell *shell, uint8_t *);
12
13static ShellProgramHandle_t registerShellProgram() {
14 return (ShellProgramHandle_t){
15 .name = "baro",
16 .exec = Baro_exec
17 };
18}
19
20__attribute__((section(".shell_baro"), unused))
21static ShellProgramHandle_t (*registerShellProgram_ptr)() = registerShellProgram;
22
23/* =============================================================================== */
30static void Baro_exec(Shell *shell, uint8_t *flags) {
31 BMP581 *baro = DeviceHandle_getHandle("Baro").device;
32 char str[30];
33 if (!strcmp(flags, "read")) {
34 baro->update(baro);
35 snprintf(str, 50, "Ground pressure: %f\n\r", baro->groundPress);
36 shell->usb.print(&shell->usb, str);
37 snprintf(str, 50, "Current pressure: %f\n\r", baro->press);
38 shell->usb.print(&shell->usb, str);
39 snprintf(str, 50, "Current temperature: %f\n\r", baro->temp);
40 shell->usb.print(&shell->usb, str);
41 }
42}
43
void(* print)(struct UART *, char *)
UART print string method.
Definition uart.h:62
Definition shell.h:34
DeviceType device
Enum specifier for device type.
Definition spi.h:50