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.
LambdaController.h
- Committer:
- gakuburu
- Date:
- 2016-08-24
- Revision:
- 4:c35227d14896
- Parent:
- 3:9f80eee7aa78
- Child:
- 5:57c6d5db3d52
File content as of revision 4:c35227d14896:
#ifndef LAMBDA_CONTROLLER_H
#define LAMBDA_CONTROLLER_H
#include "mbed.h"
class LambdaController {
public:
LambdaController(PinName tx, PinName rx);
uint8_t get_all_switch(void);
bool get_switch(int num);
enum AxisId {
Stick0X, Stick0Y, Stick1X, Stick1Y
};
int get_raw_axis(AxisId id);
double get_axis(AxisId id);
void initialize_axis(void);
void initialize_axis(AxisId id);
enum ErrorFactor {
NoError, NoDataError, TimeoutError, InvalidDataError, SerialBusyError
};
ErrorFactor get_error();
void debug(const char *format, ...);
private:
Serial twe_lite;
void data_receive_isr();
int buffer_head;
uint8_t received_data[10];
uint8_t received_buffer[10];
bool is_axis_initialized;
int axis_center[4];
static const double axis_threshold = 0.012;
Ticker error_detection_timer;
void error_detection_isr();
int error_count;
ErrorFactor error_id;
static const int error_threshold = 5;
static const double timeout_time = 0.5;
};
#endif