Skip to content

Commit 5802baf

Browse files
committed
Merge branch 'release-2.0-nightly' into release-2.0
2 parents d997e35 + f878a82 commit 5802baf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3919
-4236
lines changed

Examples/Concurrency/Concurrency_Demo.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,27 @@
1111

1212
volatile int lock = locknew();
1313

14-
const PropWare::Pin g_pin1(PropWare::Pin::P23, PropWare::Pin::OUT);
15-
const PropWare::Pin g_pin2(PropWare::Pin::P16, PropWare::Pin::OUT);
14+
// NOTE!!! The direction of a pin (or port) is not a member variable of the pin
15+
// or port. Therefore, if you're going to declare a pin (or port) in one cog
16+
// and use it in another, you MUST set the direction in the new port. Look at
17+
// how g_pin2.set_dir() is called within blinkAnLEDSome() instead of the
18+
// direction being set in the constructor
19+
PropWare::Pin g_pin1(PropWare::Port::P16, PropWare::Port::OUT);
20+
PropWare::Pin g_pin2(PropWare::Port::P17);
1621
const int g_someStackSpace = 64;
1722

1823
// Main function
1924
int main () {
2025

2126
cog_run((void (*) (void *)) &blinkAnLEDSome, g_someStackSpace);
2227

28+
waitcnt(20*MICROSECOND + CNT);
29+
2330
while(lockset(lock));
2431

2532
for (int i = 0; i < 40; ++i) {
2633
waitcnt(50 * MILLISECOND + CNT);
27-
g_pin2.toggle();
34+
g_pin1.toggle();
2835
}
2936

3037
lockclr(lock);
@@ -35,9 +42,11 @@ int main () {
3542
void blinkAnLEDSome (void) {
3643
while(lockset(lock));
3744

45+
g_pin2.set_dir(PropWare::Port::OUT);
46+
3847
for (int i = 0; i < 40; ++i) {
3948
waitcnt(50 * MILLISECOND + CNT);
40-
g_pin1.toggle();
49+
g_pin2.toggle();
4150
}
4251

4352
lockclr(lock);

Examples/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ all:
2929
$(shell mkdir $(MKDIR_FLAG) PropWare_SPI$(DIR_DIV)Debug $(NULL))
3030
$(MAKE) -C PropWare_SPI/Debug -f ../Makefile
3131

32+
$(shell mkdir $(MKDIR_FLAG) PropWare_I2C_HD44780$(DIR_DIV)Debug $(NULL))
33+
$(MAKE) -C Concurrency/Debug -f ../Makefile
34+
3235
$(shell mkdir $(MKDIR_FLAG) PropWare$(DIR_DIV)Debug $(NULL))
3336
$(MAKE) -C PropWare/Debug -f ../Makefile
3437

@@ -60,6 +63,9 @@ clean:
6063
$(shell mkdir $(MKDIR_FLAG) PropWare_SPI$(DIR_DIV)Debug $(NULL))
6164
$(MAKE) -C PropWare_SPI/Debug -f ../Makefile clean
6265

66+
$(shell mkdir $(MKDIR_FLAG) PropWare_I2C_HD44780$(DIR_DIV)Debug $(NULL))
67+
$(MAKE) -C Concurrency/Debug -f ../Makefile clean
68+
6369
$(shell mkdir $(MKDIR_FLAG) PropWare$(DIR_DIV)Debug $(NULL))
6470
$(MAKE) -C PropWare/Debug -f ../Makefile clean
6571

Examples/PropWare/PropWare_Demo.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ int main (int argc, char* argv[]) {
2020
int8_t cog;
2121
PropWare::Pin pin;
2222
static volatile PropWare::Pin::Mask pins[] = {
23-
PropWare::Pin::P16,
24-
PropWare::Pin::P17,
25-
PropWare::Pin::P18,
26-
PropWare::Pin::P19,
27-
PropWare::Pin::P20,
28-
PropWare::Pin::P21,
29-
PropWare::Pin::P22,
30-
PropWare::Pin::P23 };
23+
PropWare::Port::P16,
24+
PropWare::Port::P17,
25+
PropWare::Port::P18,
26+
PropWare::Port::P19,
27+
PropWare::Port::P20,
28+
PropWare::Port::P21,
29+
PropWare::Port::P22,
30+
PropWare::Port::P23 };
3131
uint32_t nextcnt;
3232

3333
wait_time = 50 * MILLISECOND;

Examples/PropWare_HD44780/HD44780_Demo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ int main () {
4545
}
4646

4747
void error (const PropWare::ErrorCode err) {
48-
PropWare::SimplePort debugLEDs(PropWare::Pin::P16, 8, PropWare::Pin::OUT);
48+
PropWare::SimplePort debugLEDs(PropWare::Port::P16, 8, PropWare::Pin::OUT);
4949

5050
PropWare::HD44780::print_error_str((PropWare::HD44780::ErrorCode) err);
5151

Examples/PropWare_HD44780/HD44780_Demo.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@
4242
#include <PropWare/PropWare.h>
4343
#include <PropWare/hd44780.h>
4444

45-
#define RS PropWare::Pin::P14
46-
#define RW PropWare::Pin::P12
47-
#define EN PropWare::Pin::P10
45+
#define RS PropWare::Port::P14
46+
#define RW PropWare::Port::P12
47+
#define EN PropWare::Port::P10
4848

49-
#define FIRST_DATA_PIN PropWare::Pin::P19
49+
#define FIRST_DATA_PIN PropWare::Port::P19
5050
#define BITMODE PropWare::HD44780::BM_8
5151
#define DIMENSIONS PropWare::HD44780::DIM_16x2
5252

Examples/PropWare_L3G/L3G_Demo.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727

2828
// Includes
29-
#include <tinyio.h>
29+
#include <simpletools.h>
3030
#include "L3G_Demo.h"
3131

3232
// Main function
@@ -36,7 +36,9 @@ int main () {
3636
PropWare::SPI *spi = PropWare::SPI::getInstance();
3737
PropWare::L3G gyro(spi);
3838

39-
if ((err = gyro.start(MOSI, MISO, SCLK, CS, PropWare::L3G::DPS_2000)))
39+
if ((err = gyro.start(MOSI, MISO, SCLK, CS)))
40+
error(err);
41+
if ((err = gyro.set_dps(PropWare::L3G::DPS_500)))
4042
error(err);
4143

4244
// Though this functional call is not necessary (default value is 0), I
@@ -49,17 +51,20 @@ int main () {
4951
while (1) {
5052
if ((err = gyro.read_all(gyroVals)))
5153
error(err);
52-
printf("Gyro vals... X: %i\tY: %i\tZ: %i\n", gyroVals[0], gyroVals[1],
53-
gyroVals[2]);
54-
waitcnt(CLKFREQ/20 + CNT);
54+
print("Gyro vals DPS... X: %2.3f\tY: %2.3f\tZ: %2.3f\n",
55+
gyro.convert_to_dps(gyroVals[0]),
56+
gyro.convert_to_dps(gyroVals[1]),
57+
gyro.convert_to_dps(gyroVals[2]));
58+
59+
// waitcnt(50*MILLISECOND + CNT);
5560
}
5661

5762
return 0;
5863
}
5964

6065
void error (const PropWare::ErrorCode err) {
6166
// Set the Quickstart LEDs for output (used to display the error code)
62-
PropWare::SimplePort debugLEDs(PropWare::Pin::P16, 8, PropWare::Pin::OUT);
67+
PropWare::SimplePort debugLEDs(PropWare::Port::P16, 8, PropWare::Pin::OUT);
6368

6469
while (1) {
6570
debugLEDs.write(err);

Examples/PropWare_L3G/L3G_Demo.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@
4545
#include <PropWare/port.h>
4646

4747
/** Pin number for MOSI (master out - slave in) */
48-
#define MOSI PropWare::Pin::P0
48+
#define MOSI PropWare::Port::P0
4949
/** Pin number for MISO (master in - slave out) */
50-
#define MISO PropWare::Pin::P1
50+
#define MISO PropWare::Port::P1
5151
/** Pin number for the clock signal */
52-
#define SCLK PropWare::Pin::P2
52+
#define SCLK PropWare::Port::P2
5353
/** Pin number for chip select */
54-
#define CS PropWare::Pin::P4
54+
#define CS PropWare::Port::P6
5555
/** Frequency (in Hertz) to run the SPI protocol */
5656
#define FREQ 10000
5757

Examples/PropWare_MAX6675/MAX6675_Demo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ int main () {
7070

7171
void error (const PropWare::ErrorCode err) {
7272
// Set the Quickstart LEDs for output (used to display the error code)
73-
PropWare::SimplePort debugLEDs(PropWare::Pin::P16, 8, PropWare::Pin::OUT);
73+
PropWare::SimplePort debugLEDs(PropWare::Port::P16, 8, PropWare::Pin::OUT);
7474

7575
while (1) {
7676
debugLEDs.write(err);

Examples/PropWare_MAX6675/MAX6675_Demo.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,22 @@
4444
#include <PropWare/spi.h>
4545

4646
/** Pin number for MOSI (master out - slave in) */
47-
#define MOSI PropWare::Pin::P0
47+
#define MOSI PropWare::Port::P0
4848
/** Pin number for MISO (master in - slave out) */
49-
#define MISO PropWare::Pin::P1
49+
#define MISO PropWare::Port::P1
5050
/** Pin number for the clock signal */
51-
#define SCLK PropWare::Pin::P2
51+
#define SCLK PropWare::Port::P2
5252
/** Pin number for chip select */
53-
#define CS PropWare::Pin::P5
53+
#define CS PropWare::Port::P5
5454
#define FREQ 10000
5555

5656
#define DEBUG_LEDS PropWare::BYTE_2
5757

58-
#define RS PropWare::Pin::P14
59-
#define RW PropWare::Pin::P12
60-
#define EN PropWare::Pin::P10
58+
#define RS PropWare::Port::P14
59+
#define RW PropWare::Port::P12
60+
#define EN PropWare::Port::P10
6161

62-
#define FIRST_DATA_PIN PropWare::Pin::P19
62+
#define FIRST_DATA_PIN PropWare::Port::P19
6363
#define BITMODE PropWare::HD44780::BM_8
6464

6565
#define DIMENSIONS PropWare::HD44780::DIM_16x2

Examples/PropWare_MCP3000/MCP3000_Demo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ int main () {
3939
PropWare::MCP3000 adc(spi, PART_NUMBER);
4040

4141
// Set the Quickstart LEDs for output (used as a secondary display)
42-
PropWare::SimplePort scale(PropWare::Pin::P16, 8, PropWare::Pin::OUT);
42+
PropWare::SimplePort scale(PropWare::Port::P16, 8, PropWare::Pin::OUT);
4343

4444
if ((err = adc.start(MOSI, MISO, SCLK, CS)))
4545
error(err);
@@ -80,7 +80,7 @@ int main () {
8080
}
8181

8282
void error (const PropWare::ErrorCode err) {
83-
PropWare::SimplePort debugLEDs(PropWare::Pin::P16, 8, PropWare::Pin::OUT);
83+
PropWare::SimplePort debugLEDs(PropWare::Port::P16, 8, PropWare::Pin::OUT);
8484

8585
while (1) {
8686
debugLEDs.write(err);

0 commit comments

Comments
 (0)