mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 01:40:14 +01:00
rp2/machine_bitstream: Implement the machine.bitstream driver.
Timing error is ~20ns at 125MHz, and ~10ns at 250MHz.
This commit is contained in:
@@ -28,6 +28,10 @@
|
||||
#include "py/mpconfig.h"
|
||||
#include "py/ringbuf.h"
|
||||
#include "pico/time.h"
|
||||
#include "hardware/clocks.h"
|
||||
#include "hardware/structs/systick.h"
|
||||
|
||||
#define SYSTICK_MAX (0xffffff)
|
||||
|
||||
extern int mp_interrupt_char;
|
||||
extern ringbuf_t stdin_ringbuf;
|
||||
@@ -59,6 +63,10 @@ static inline mp_uint_t mp_hal_ticks_cpu(void) {
|
||||
return time_us_32();
|
||||
}
|
||||
|
||||
static inline mp_uint_t mp_hal_get_cpu_freq(void) {
|
||||
return clock_get_hz(clk_sys);
|
||||
}
|
||||
|
||||
// C-level pin HAL
|
||||
|
||||
#include "py/obj.h"
|
||||
@@ -110,4 +118,12 @@ static inline void mp_hal_pin_od_high(mp_hal_pin_obj_t pin) {
|
||||
gpio_set_dir(pin, GPIO_IN);
|
||||
}
|
||||
|
||||
static inline void mp_hal_pin_low(mp_hal_pin_obj_t pin) {
|
||||
gpio_clr_mask(1 << pin);
|
||||
}
|
||||
|
||||
static inline void mp_hal_pin_high(mp_hal_pin_obj_t pin) {
|
||||
gpio_set_mask(1 << pin);
|
||||
}
|
||||
|
||||
#endif // MICROPY_INCLUDED_RP2_MPHALPORT_H
|
||||
|
||||
Reference in New Issue
Block a user