summaryrefslogtreecommitdiff
path: root/robot/sim.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-05-26 18:37:54 +0200
committerlonkaars <loek@pipeframe.xyz>2022-05-26 18:37:54 +0200
commit515ea1b4db5528a08deed32463f77cd03a7f7139 (patch)
treedae066d2dc8c895c7997e5191686bf4642c4db9d /robot/sim.c
parente4b0a76f56e290b7b052b4d5dad7ebb710f12c98 (diff)
finish merge of io module
Diffstat (limited to 'robot/sim.c')
-rw-r--r--robot/sim.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/robot/sim.c b/robot/sim.c
index ddc208a..0f1c7e6 100644
--- a/robot/sim.c
+++ b/robot/sim.c
@@ -126,3 +126,35 @@ void w2_sim_print_serial(w2_s_bin *data) {
void set_motors(int left, int right) {
simprintfunc("set_motors", "%i, %i", left, right);
}
+
+static const char* const W2_BUTTON_NAMES[] = {
+ "BUTTON_A",
+ "BUTTON_B",
+ "BUTTON_C",
+ "TOP_BUTTON",
+ "BOTTOM_BUTTON",
+};
+
+unsigned char get_single_debounced_button_press(unsigned char buttons) {
+ simprintfunc("get_single_debounced_button_press", "%s", W2_BUTTON_NAMES[buttons]);
+ return false;
+}
+
+void qtr_read(unsigned int* sensor_values, unsigned char read_mode) {
+ simprintfunc("qtr_read", "0x%016lx, %s", (uint64_t) sensor_values, read_mode == QTR_EMITTERS_ON ? "QTR_EMITTERS_ON" : "???");
+ sensor_values[0] = 0;
+ sensor_values[1] = 0;
+ sensor_values[2] = 0;
+ sensor_values[3] = 0;
+ sensor_values[4] = 0;
+}
+
+unsigned int analog_read(unsigned char channel) {
+ simprintfunc("analog_read", "ADC%i", channel);
+ return 0;
+}
+
+void print(const char* str) {
+ simprintfunc("print", "\"%s\"", str);
+}
+