Skip to content

Commit 5b48135

Browse files
author
Josh Levine
authored
Merge pull request #101 from bigjosh/dev
Dev
2 parents 3ff5694 + 7828ad5 commit 5b48135

12 files changed

Lines changed: 63 additions & 473 deletions

File tree

Getting-started.md

Lines changed: 0 additions & 66 deletions
This file was deleted.

Layers.md

Lines changed: 0 additions & 50 deletions
This file was deleted.

Production.MD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ avrdude -B 4 -D -v -patmega168pb -cusbtiny -Uflash:w:D-TimerFlashX.ino.with_boot
6464
```
6565

6666
`-D` skips erasing the flash before programming it. If you are programming virgin chips then the flash should be blank.
67-
`-B` lowered to 4 slightly increases the programmer clock. Some out of spec chips might fall to program at this speed.
67+
`-B` lowered to 4 slightly increases the programmer clock, which reduces programming time. Note that some units might fail at this increased speed.
6868

6969
Note that these new options are both safe because the verify will fail if anything goes wrong.
7070

README.md

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,65 @@
1-
# Move38 Blinks for the Arduino IDE
2-
An Arduino core for the Blinks gaming tile. More info at...
3-
http://move38.com
1+
# Blinks Software Development Kit (SDK) for Arduino
42

5-
## Roadmap
3+
This SDK includes all the software and configuration files to tell the Arduino IDE how to download programs in a blink along with some examples you can try out and modify.
64

7-
This core requires at least Arduino IDE v1.6.2, where v1.6.5+ is recommended. <br/>
8-
* [Programmers](#programmers)
9-
* **[How to install](#how-to-install)**
10-
* **[Getting started](#getting-started)**
5+
These instructions will get you set up to write your own games for the [Blinks platform](https://move38.com/pages/blinks-collection) using the Arduino IDE.
116

12-
Covers installing this repo so that you can write and download code into a Blinks tile using the Arduino IDE.
7+
Note that you do not need any of this if you just want to *play* blinks games, only if you want to write them.
138

14-
Ends with loading a `HelloBlink` program it a tile.
159

16-
### Writing games
10+
## Getting Started
1711

18-
The best way to start writing games is to work your way though the examples in the "File->Examples->Examples for Blink Tile" menu in the Arduino IDE (after you have installed this repo as described in the Getting Started above).
19-
12+
### Software setup
2013

21-
### [Service Port](Service Port.MD)
14+
1. Download and run the latest version of the[ Arduino IDE](https://www.arduino.cc/en/Main/Software#download)
15+
2. Go into File->Preferences->Settings and add...
16+
`https://github.com/bigjosh/Move38-Arduino-Platform/releases/latest/download/package_move38.com-blinks_index.json`
17+
...under Additional Boards Manager URLs. If you already have something there, you can use a comma to separate the multiple entries
18+
3. Go to Tools->Board->Boards Manager and search for "blinks"
19+
4. Press install on "Blinks by Move38"
20+
5. Pick "Tools->Board->Move38->blink" from the menus
21+
5. Go to "File->Example->Getting Started->Button Press" to load an example program
22+
6. Program the `Button Press` example code into a blink (see below)
2223

23-
Describes the service port connector on each blink. Lets you add `print` statements to your programs, which can be very helpful during development.
2424

25-
## How to install
25+
### Getting your code programmed into a blink
2626

27-
Click on the "Download ZIP" button in the upper right corner of this repo. Extract the ZIP file, and move the extracted files to the location "**~/Documents/Arduino/hardware/Move38-manual/avr**". Create the folder if it doesn't exist. This readme file should be located at "**~/Documents/Arduino/hardware/Move38-manual/avr/README.md**" when you are done.
27+
Each blink can hold a game in its on-board flash memory. Once a blink has a game programmed into it, it can also share to other blinks over the IR links.
2828

29-
Open Arduino IDE, and a new category in the boards menu called "Move38-manual" will show up.
29+
You will need a programmer, a cable, and a connector to get your code from the Arduino IDE into a blink's flash.
30+
31+
The [Blinks Developer Kit](https://move38.com/products/bare-bones-dev-kit) that includes everything you need to start programming your own games, including a a special blink that connects to an included USB programmer to make downloading your code as easy as pushing the "upload" button in the Ardunio IDE. If you have the dev kit, follow the enclosed instructions to select the correct programmer in the IDE and everything should just work.
32+
33+
But you do not need the dev kit to write your own games. Blinks can be programmed with any Arduino-compatible "AVR ISP" programmer and there are hundreds of these available everywhere. You can even use an[ Arduino UNO board plus a few wires](https://www.arduino.cc/en/Tutorial/ArduinoISP#toc2) to program any blink though the 6-pin In System Programming (ISP) connector inside the battery compartment (the arrow marks pin #1).
3034

31-
In the future, we'll offer a simplified Arduino Boards Manager install path.
35+
## What is Arduino?
3236

33-
### Notes
37+
The Arduino IDE is an an integrated development environment that makes it easy to write and download code to compatible microcontroller boards - and every blink is an Arduino compatible board.
3438

35-
* We called the "vendor/maintainer" folder `Move38-manual` so that you can also use the boards manager and you will be able to tell the two apart in the boards menu.
39+
We write a program in the IDE using Arduino programming language (basically the C/C++) and then we use a programmer to download the compiled program into a blink.
3640

37-
* You must manually create the `avr` folder and you must also manually move the files out from this repo into this folder. We could not automatically have the folds inside the repo match the Arduino required folder layout because in in the boards manager, the architecture is in the JSON file rather than the folder structure. Arg.
41+
## The `blinklib` library
3842

39-
* The "**~/Documents/Arduino/hardware/Move38-manual/avr**" folder is a Git repo and is also set up for easy editing in Atmel Studio with a solution inside the `\AS7` sub-folder.
43+
When you pick "blink" from the boards menu, you configure the Arduino IDE to automatically include a set of binks-specific functions whenever it compiles your code. You use these functions to set the colors on the blink's LEDs and check for button presses and send messages over the IR links and everything else a blink can do. You can see all the available `blinklib` functions [here](cores/blinklib/blinklib.h).
4044

41-
### API Layers
45+
## Serial support
4246

43-
The blinks hardware can do incredible things, and you can have unfettered access to it at any level you want. This documents describes those layers from bare metal up.
47+
Each blink also has a built in serial port so you can add `printf` statements to your code and view the resulting output on a computer running a serial terminal program. Again, each blink dev kit includes a cable and a USB serial board to make this plug and play, but you can also connect the wires yourself to any serial port than can accept 3.3 - 5 volt signals. More info on serial [here](Service Port.MD).
4448

49+
## Making changes to the open source `blinklib` library
4550

51+
You can make a fork of this repo and then clone it you the machine that you have the Arduino IDE installed on. Then add a symbolic link called `avr` to the top directory of the cloned repo (the directory with this readme in it) to the `Arduino/hardware/move38` directory. So, for example, on my windows machine I made the symbolic link with the commands...
4652

47-
#### Hardware Abstraction Layer
53+
```
54+
d:
55+
cd D:\Documents\Arduino\hardware
56+
mkdir move38
57+
cd move38
58+
mklink /D avr D:\Github\Move38-Arduino-Platform
59+
```
4860

49-
Most programmers will want to use the high level `blinks` API, but if you want to get closer to the hardware you can directly call into the `HAL` (Hardware Abstraction Layer) that the `blinks` API is built on top of. Documentation for this layer is in the [README.md](cores/blinkcore/README.md) in the `cores/blinkscore` folder.
61+
Quit out of the IDE and reload and you should see a new choice under the `boards` menu.
62+
63+
We are always grateful for pull requests with bug fixes. For new features, best to discuss first [in the forums](https://forum.move38.com/c/softwareresources/9) to see what other think and if anyone is already working on something similar.
64+
65+
###

Tools.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

bootloaders/readme.MD

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
This folder contains the BlinkBIOS bootloader HEX file. This file is created by the BlinkBIOS repo...
1+
This folder contains the BlinkBIOS bootloader HEX file. The BlinkBIOS is a hardware abstraction layer that is loaded into the bootloader area of flash.
22

3-
https://github.com/bigjosh/Move38-BlinkBIOS
4-
5-
..and then copied here after each compile by an Atmel Studio post-build event. Note that the this bootloader directory is hardcoded into the text of that event.
3+
The blinkBIOS is an abstraction layer that provides access to the blinks hardware and is defined by the `blinkbios_*.h` files in the `cores/blinklib/shared` directory.
64

5+
Ideally we would like to program the BIOS once into each blink when it is manufactured and then only update the application section of the flash thereafter, but unfortunately on this chip the entire flash is always erased on each hardware programming cycle, so we must reprogram the bootloader each time. That is why this HEX file must be included here.
6+
77
This file is used by...
88

9-
1. The `upload` and `program` recipes to download a new sketch to a blink. Note that we could make upload only update the actual program and not the BIOS for faster turnaround during development, but I do not want to change this behavior now. The path to the bootloader is hardcoded into the recipes but is relative to the platform folder.
10-
2. The `Export Binary` function which creates a single HEX file with both the current sketch and the BIOS. In this case, the folder name must be `bootloader` as this is hardcoded into the IDE.
9+
1. The `program` recipe in `platform.txt` that downloads a new sketch to a blink.
10+
2. The `Export Binary` function which creates a single HEX file with both the current sketch and the BIOS. Note that this folder must be named `bootloader` as this is hardcoded into the Arduino IDE.
1111

1212

1313

cores/blinklib/blinklib.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,9 +1322,6 @@ byte sin8_C( byte theta)
13221322

13231323
#endif
13241324

1325-
uint8_t __attribute__((weak)) sterileFlag = 0; // Set to 1 to make this game sterile. Hopefully LTO will compile this away for us? (update: Whooha yes! )
1326-
// We make `weak` so that the user program can override it
1327-
13281325
// This is the main event loop that calls into the arduino program
13291326
// (Compiler is smart enough to jmp here from main rather than call!
13301327
// It even omits the trailing ret!
@@ -1342,6 +1339,7 @@ void __attribute__((noreturn)) run(void) {
13421339
statckwatcher_init(); // Set up the sentinel byte at the top of RAM used by variables so we can tell if stack clobbered it
13431340

13441341
setup();
1342+
13451343

13461344
while (1) {
13471345

@@ -1356,7 +1354,7 @@ void __attribute__((noreturn)) run(void) {
13561354
// Note that we directly read the shared block rather than our snapshot. This lets the 6 second flag latch and
13571355
// so to the user program if we do not enter seed mode because we have neighbors. See?
13581356

1359-
if (( blinkbios_button_block.bitflags & BUTTON_BITFLAG_3SECPRESSED) && isAlone() && !sterileFlag ) {
1357+
if (( blinkbios_button_block.bitflags & BUTTON_BITFLAG_3SECPRESSED) && isAlone() ) {
13601358

13611359
// Button has been down for 6 seconds and we are alone...
13621360
// Signal that we are about to go into seed mode with full blue...

cores/blinklib/blinklib.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -356,24 +356,6 @@ uint8_t hasWoken(void);
356356

357357
uint8_t startState(void);
358358

359-
// Make the current game sterile so that it can not be propagated to other blinks (niche)
360-
// If sterileFlag==1 then holding the button down will never enter seed mode, it will just eventually sleep.
361-
// This essentially means that once this built-in game is programmed into a blink it will not transfer to other blinks.
362-
363-
// There are two ways you can use this. If you statically want a game to be sterile, you can add...
364-
// uint8_t sterileFlag=1; // Make this game sterile.
365-
// outside of any function block. This will completely disable all seeding and also give you some
366-
// extra flash memory since the seeding code does not even get linked into the executable (thanks gcc LTO!)
367-
// Alternately, you can use..
368-
// sterileFlag=1;
369-
// ...and...
370-
// sterileFlag=0;
371-
// inside your code to dynamically enable and disable seeding at any time.
372-
// NB: setting sterileFlag only suppress button-initiated seeds.
373-
374-
extern uint8_t sterileFlag; // Set to 1 to make this game sterile.
375-
376-
377359
/*
378360
379361
These hook functions are filled in by the sketch

0 commit comments

Comments
 (0)