Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: fll mbed-rtos mbed
fll.h
- Committer:
- sierra
- Date:
- 2015-02-14
- Revision:
- 3:edbf31a8589f
- Parent:
- 2:165723d41023
- Child:
- 5:130721ce29f7
File content as of revision 3:edbf31a8589f:
// Frame Level Language
// header
#include "mbed.h"
#include "rtos.h"
#include <stdint.h>
#include <vector>
#define R1 0x0001
#define B_TRIANGLE 0x0002
#define B_CIRCLE 0x0004
#define B_CROSS 0x0008
#define B_SQUARE 0x0010
#define B_R2 0x0020
#define B_START 0x0040
#define B_ANALOG 0x0080
#define B_SELECT 0x0100
#define B_L2 0x0200
#define B_UP 0x0400
#define B_DOWN 0x0800
#define B_LEFT 0x1000
#define B_RIGHT 0x2000
#define B_L1 0x4000
#define MAIL_BOX_SIZE 16
typedef uint16_t button_t;
class Source
{
private:
int i;
button_t* button_t_seq;
int size;
bool loop;
public:
Source(button_t *bs, int s, bool l);
virtual button_t await();
};
class Flow : Source
{
private:
vector<Source*>& sources;
public:
Flow(vector<Source*> &srcs);
virtual button_t fold(vector<button_t> &bs);
virtual button_t await();
};
// ストリームの終端になっていて、キー入力をするスレッドに向けてキーを送る
class Sink
{
private:
Source* source;
rtos::Mail<button_t, MAIL_BOX_SIZE>* mail_box;
Mutex* mutex;
public:
Sink(Source* src, rtos::Mail<button_t, MAIL_BOX_SIZE>* box, Mutex* mut);
void run();
void reset(Source* src);
};
class Output
{
private:
rtos::Mail<button_t, MAIL_BOX_SIZE>* mail_box;
public:
Output(rtos::Mail<button_t, MAIL_BOX_SIZE>* box);
void run();
};
void press(button_t btn);
