• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pybricks / pybricks-micropython / 5051207275

pending completion
5051207275

Pull #169

github

GitHub
Merge 9198918d3 into 6b759d786
Pull Request #169: Refactor src/uartdev for async and code size

60 of 265 new or added lines in 14 files covered. (22.64%)

7 existing lines in 7 files now uncovered.

3158 of 5971 relevant lines covered (52.89%)

33081554.43 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/lib/pbio/include/pbio/uartdev.h
1
// SPDX-License-Identifier: MIT
2
// Copyright (c) 2018-2023 The Pybricks Authors
3

4
#ifndef _PBIO_UARTDEV_H_
5
#define _PBIO_UARTDEV_H_
6

7
#include <stddef.h>
8
#include <stdint.h>
9

10
#include <pbio/config.h>
11
#include <pbio/error.h>
12
#include <pbio/iodev.h>
13

14
typedef struct {
15
    uint8_t uart_id;    /**< The ID of a UART device used by this uartdev */
16
} pbio_uartdev_platform_data_t;
17

18
#if PBIO_CONFIG_UARTDEV
19

20
/** @cond INTERNAL */
21
pbio_error_t pbio_uartdev_get(uint8_t id, pbio_iodev_t **iodev);
22
void pbio_uartdev_ready(uint8_t id);
23
/** @endcond */
24

25
pbio_error_t pbio_uartdev_is_ready(pbio_iodev_t *iodev);
26
pbio_error_t pbio_uartdev_set_mode(pbio_iodev_t *iodev, uint8_t mode);
27
pbio_error_t pbio_uartdev_set_mode_with_data(pbio_iodev_t *iodev, uint8_t mode, const void *data);
28
pbio_error_t pbio_uartdev_get_data(pbio_iodev_t *iodev, uint8_t mode, void **data);
29

30
#if !PBIO_CONFIG_UARTDEV_NUM_DEV
31
#error Must define PBIO_CONFIG_UARTDEV_NUM_DEV
32
#endif
33

34
extern const pbio_uartdev_platform_data_t pbio_uartdev_platform_data[PBIO_CONFIG_UARTDEV_NUM_DEV];
35

36
#else // PBIO_CONFIG_UARTDEV
37

38
static inline pbio_error_t pbio_uartdev_get(uint8_t id, pbio_iodev_t **iodev) {
39
    *iodev = NULL;
40
    return PBIO_ERROR_NOT_SUPPORTED;
41
}
42

43
static inline void pbio_uartdev_ready(uint8_t id) {
44
}
45

46
static inline pbio_error_t pbio_uartdev_is_ready(pbio_iodev_t *iodev) {
47
    return PBIO_ERROR_NOT_SUPPORTED;
48
}
49

50
static inline pbio_error_t pbio_uartdev_set_mode(pbio_iodev_t *iodev, uint8_t mode) {
51
    return PBIO_ERROR_NOT_SUPPORTED;
52
}
53

54
static inline pbio_error_t pbio_uartdev_set_mode_with_data(pbio_iodev_t *iodev, uint8_t mode, const void *data) {
55
    return PBIO_ERROR_NOT_SUPPORTED;
56
}
57

58
static inline pbio_error_t pbio_uartdev_get_data(pbio_iodev_t *iodev, uint8_t mode, void **data) {
NEW
59
    *data = NULL;
×
60
    return PBIO_ERROR_NOT_SUPPORTED;
61
}
62

63
#endif // PBIO_CONFIG_UARTDEV
64

65
#endif // _PBIO_UARTDEV_H_
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc