Loading...
Searching...
No Matches
RP2040Class Class Reference

The second core and the chip: rp2040. More...

#include <RP2040.h>

Public Member Functions

void idleOtherCore ()
 Stops the other core until resumeOtherCore(), and returns once it has stopped.
void resumeOtherCore ()
 Lets the core stopped by idleOtherCore() carry on. Does nothing if none is stopped.
void restartCore1 ()
 Resets core 1 and starts it again from setup1().
int cpuid ()
 Which core the calling code runs on.
uint32_t f_cpu ()
 CPU clock (Tools > CPU Speed).
int getTotalHeap ()
 Size of the heap (memory for new, malloc(), String and, with FreeRTOS, tasks and queues).
int getUsedHeap ()
 Heap memory in use.
int getFreeHeap ()
 Heap memory still free: getTotalHeap() - getUsedHeap().

Public Attributes

RP2040FifoClass fifo
 Inter-core FIFO: see RP2040FifoClass.

Detailed Description

The second core and the chip: rp2040.

Member Function Documentation

◆ cpuid()

int RP2040Class::cpuid ( )

Which core the calling code runs on.

Returns
0 or 1.

◆ f_cpu()

uint32_t RP2040Class::f_cpu ( )

CPU clock (Tools > CPU Speed).

Returns
Frequency in Hz, e.g. 133000000.

◆ getFreeHeap()

int RP2040Class::getFreeHeap ( )

Heap memory still free: getTotalHeap() - getUsedHeap().

Returns
Bytes. Not necessarily one block: a single allocation of this size can still fail.

◆ getTotalHeap()

int RP2040Class::getTotalHeap ( )

Size of the heap (memory for new, malloc(), String and, with FreeRTOS, tasks and queues).

Returns
Bytes.

◆ getUsedHeap()

int RP2040Class::getUsedHeap ( )

Heap memory in use.

Returns
Bytes.

◆ idleOtherCore()

void RP2040Class::idleOtherCore ( )

Stops the other core until resumeOtherCore(), and returns once it has stopped.

The other core waits with its interrupts off, so it cannot touch anything in the meantime: use this around code that must not be disturbed (for example writing to flash, which the other core may be running code from). Keep the time short. Does nothing if the other core is not running a sketch (no setup1()/loop1() without FreeRTOS) or is already stopped.

With FreeRTOS, the calling task also stays on its core and is not pre-empted until resumeOtherCore().

◆ restartCore1()

void RP2040Class::restartCore1 ( )

Resets core 1 and starts it again from setup1().

Only without FreeRTOS, and only if the sketch defines setup1() or loop1(); does nothing otherwise. Call it from core 0.


The documentation for this class was generated from the following file: