Phyduino Board Support
v0.1.1-rc.1
Physics
›
Electronic Support Services
›
Introduction to Electronics
›
Phyduino Board Support
›
API reference
Toggle main menu visibility
Loading...
Searching...
No Matches
RP2040.h
Go to the documentation of this file.
1
14
#pragma once
15
16
#include <stddef.h>
17
#include <stdint.h>
18
19
#include "pico/util/queue.h"
20
38
class
RP2040FifoClass
{
39
public
:
41
static
constexpr
unsigned
kDepth
= 16;
42
47
void
push
(uint32_t value);
48
54
bool
push_nb
(uint32_t value);
55
60
uint32_t
pop
();
61
67
bool
pop_nb
(uint32_t* value);
68
73
int
available
();
74
76
void
begin();
77
78
private
:
79
queue_t queues_[2];
// queues_[c] holds the values sent to core c
80
bool
started_ =
false
;
81
};
82
87
class
RP2040Class
{
88
public
:
90
RP2040FifoClass
fifo
;
91
105
void
idleOtherCore
();
106
108
void
resumeOtherCore
();
109
116
void
restartCore1
();
117
122
int
cpuid
();
123
128
uint32_t
f_cpu
();
129
134
int
getTotalHeap
();
135
140
int
getUsedHeap
();
141
147
int
getFreeHeap
();
148
149
private
:
150
bool
idling_other_ =
false
;
151
};
152
155
extern
RP2040Class
rp2040
;
156
157
extern
"C"
{
165
void
setup1
(
void
) __attribute__((weak));
166
171
void
loop1
(
void
) __attribute__((weak));
172
}
RP2040Class
The second core and the chip: rp2040.
Definition
RP2040.h:87
RP2040Class::resumeOtherCore
void resumeOtherCore()
Lets the core stopped by idleOtherCore() carry on. Does nothing if none is stopped.
RP2040Class::idleOtherCore
void idleOtherCore()
Stops the other core until resumeOtherCore(), and returns once it has stopped.
RP2040Class::restartCore1
void restartCore1()
Resets core 1 and starts it again from setup1().
RP2040Class::getTotalHeap
int getTotalHeap()
Size of the heap (memory for new, malloc(), String and, with FreeRTOS, tasks and queues).
RP2040Class::getFreeHeap
int getFreeHeap()
Heap memory still free: getTotalHeap() - getUsedHeap().
RP2040Class::f_cpu
uint32_t f_cpu()
CPU clock (Tools > CPU Speed).
RP2040Class::getUsedHeap
int getUsedHeap()
Heap memory in use.
RP2040Class::fifo
RP2040FifoClass fifo
Inter-core FIFO: see RP2040FifoClass.
Definition
RP2040.h:90
RP2040Class::cpuid
int cpuid()
Which core the calling code runs on.
RP2040FifoClass
Passes 32-bit values between the two cores: rp2040.fifo.
Definition
RP2040.h:38
RP2040FifoClass::push_nb
bool push_nb(uint32_t value)
Sends a value to the other core if there is room, without waiting.
RP2040FifoClass::push
void push(uint32_t value)
Sends a value to the other core, waiting while its queue is full.
RP2040FifoClass::kDepth
static constexpr unsigned kDepth
Values each direction can hold before push() waits.
Definition
RP2040.h:41
RP2040FifoClass::pop
uint32_t pop()
Takes the next value sent by the other core, waiting until there is one.
RP2040FifoClass::available
int available()
Number of values the other core has sent that this core has not popped yet.
RP2040FifoClass::pop_nb
bool pop_nb(uint32_t *value)
Takes the next value sent by the other core if there is one, without waiting.
setup1
void setup1(void) __attribute__((weak))
Written by the sketch (optional): runs once on core 1, at the same time as setup() on core 0.
rp2040
RP2040Class rp2040
loop1
void loop1(void) __attribute__((weak))
Written by the sketch (optional): runs over and over on core 1 after setup1().
platform
cores
phyduino
RP2040.h
Generated by
1.17.0