| /* |
| * Copyright (c) 2023 Trackunit Corporation |
| * |
| * SPDX-License-Identifier: Apache-2.0 |
| */ |
| |
| #include <stdio.h> |
| #include <zephyr/device.h> |
| #include <zephyr/drivers/gnss.h> |
| |
| static void gnss_data_cb(const struct device *dev, const struct gnss_data *data) |
| { |
| if (data->info.fix_status != GNSS_FIX_STATUS_NO_FIX) { |
| printf("%s has fix!\r\n", dev->name); |
| } |
| } |
| |
| GNSS_DATA_CALLBACK_DEFINE(DEVICE_DT_GET(DT_ALIAS(gnss)), gnss_data_cb); |
| |
| #if CONFIG_GNSS_SATELLITES |
| static void gnss_satellites_cb(const struct device *dev, const struct gnss_satellite *satellites, |
| uint16_t size) |
| { |
| printf("%s reported %u satellites!\r\n", dev->name, size); |
| } |
| #endif |
| |
| GNSS_SATELLITES_CALLBACK_DEFINE(DEVICE_DT_GET(DT_ALIAS(gnss)), gnss_satellites_cb); |
| |
| int main(void) |
| { |
| return 0; |
| } |