BresserWeatherSensorLW
Bresser 868 MHz Weather Sensor Radio Receiver based on ESP32/RP2040 and SX1262/SX1276/LR1121 - sends data to a LoRaWAN Network
Loading...
Searching...
No Matches
pico_rosc.h
1/*
2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6#if defined(ARDUINO_ARCH_RP2040)
7
8#ifndef _HARDWARE_ROSC_H_
9#define _HARDWARE_ROSC_H_
10
11#include "pico.h"
12#include "hardware/structs/rosc.h"
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
29
35void rosc_set_freq(uint32_t code);
36
45void rosc_set_range(uint range);
46
51void rosc_disable(void);
52
57void rosc_enable(void);
58
68void rosc_set_dormant(void);
69
70// FIXME: Add doxygen
71
72uint32_t next_rosc_code(uint32_t code);
73
74uint rosc_find_freq(uint32_t low_mhz, uint32_t high_mhz);
75
76void rosc_set_div(uint32_t div);
77
78inline static void rosc_clear_bad_write(void) {
79 hw_clear_bits(&rosc_hw->status, ROSC_STATUS_BADWRITE_BITS);
80}
81
82inline static bool rosc_write_okay(void) {
83 return !(rosc_hw->status & ROSC_STATUS_BADWRITE_BITS);
84}
85
86inline static void rosc_write(io_rw_32 *addr, uint32_t value) {
87 rosc_clear_bad_write();
88 assert(rosc_write_okay());
89 *addr = value;
90 assert(rosc_write_okay());
91};
92
93#ifdef __cplusplus
94}
95#endif
96
97#endif
98#endif /* ARDUINO_ARCH_RP2040 */