PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Cogc_Demo.cpp

Blink two LEDs, one from a "standard" cog invoking instructions from HUB RAM, and another cog invoking instruction natively from COG RAM

cmake_minimum_required(VERSION 3.12)
find_package(PropWare 2.0.0 REQUIRED)
project(Cogc_Demo CXX COGCXX)
create_simple_executable(${PROJECT_NAME}
Cogc_Demo.cpp
blinky.cogcpp)
_NAKED int main () {
PropWare::Pin led(PropWare::Port::Mask::P23, PropWare::Port::Dir::OUT);
while (1) {
led.toggle();
waitcnt(MILLISECOND * 100 + CNT);
}
}
int main () {
extern unsigned int _load_start_blinky_cog[];
cognew(_load_start_blinky_cog, NULL);
Pin led(Port::P16, Pin::Dir::OUT);
while (1) {
led.toggle();
waitcnt(MILLISECOND * 100 + CNT);
}
}
_NAKED
#define _NAKED
Can be used in per-function declarations to tell compiler that function will not have an epilogue or ...
Definition: cog.h:62
cognew
#define cognew(code, param)
Start a new Propeller PASM COG.
Definition: propeller.h:94
led
void led(int n, int state)
Set a blue LED (from 0 to 5) to a state (ON or OFF). Examples: led(1, ON) turns the blue LED next to ...
Definition: leds_led.c:9
PropWare::Pin
Utility class to handle general purpose I/O pins.
Definition: pin.h:36
PropWare::Port::Dir::OUT
@ OUT
PropWare::Port
Flexible port that can have any pin enabled or disabled. Pins are independent of each other.
Definition: port.h:38
main
int main(void)
Definition: GraphicsTest.c:20
waitcnt
#define waitcnt(a)
Wait until system counter reaches a value.
Definition: propeller.h:176
CNT
#define CNT
The system clock count.
Definition: propeller1.h:151
pin.h
PropWare
Generic definitions and functions for the Parallax Propeller.
Definition: runnable.h:33