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-09-13
- Revision:
- 6:c4e901c6001a
- Parent:
- 5:57c6d5db3d52
- Child:
- 7:5b74ff881644
File content as of revision 6:c4e901c6001a:
#ifndef LAMBDA_CONTROLLER_H
#define LAMBDA_CONTROLLER_H
#include "mbed.h"
class LambdaController {
public:
LambdaController(PinName tx, PinName rx);
uint16_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();
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;
Timer error_timer;
int error_count;
ErrorFactor error_id;
static const int error_threshold = 5;
static const double timeout_time = 0.5;
};
#endif