Skip to content
Permalink
Browse files

replace tele_input_state with tele_get_input_state, remove global var

  • Loading branch information
samdoshi committed Apr 30, 2016
1 parent c81a120 commit a1efe9202d6b48395699dd13f48bf92bffb5e53b
Showing with 8 additions and 15 deletions.
  1. +2 −1 simulator/tt.c
  2. +2 −4 src/main.c
  3. +1 −5 src/teletype.c
  4. +0 −3 src/teletype.h
  5. +2 −1 src/teletype_io.h
  6. +1 −1 tests/main.c
@@ -76,9 +76,10 @@ void tele_mute(uint8_t i, uint8_t s) {
printf("\n");
}

void tele_input_state(uint8_t n) {
bool tele_get_input_state(uint8_t n) {
printf("INPUT_STATE n:%" PRIu8, n);
printf("\n");
return false;
}

int main() {
@@ -90,8 +90,6 @@ typedef struct {

aout_t aout[4];

volatile uint8_t input_states[8];

u8 mutes[8];

error_t status;
@@ -2354,8 +2352,8 @@ void tele_mem_clear(void) {
memset(&scene_text, 0, sizeof(scene_text));
}

void tele_input_state(uint8_t n) {
input_states[n] = gpio_get_pin_value(A00 + n);
bool tele_get_input_state(uint8_t n) {
return gpio_get_pin_value(A00 + n) > 0;
}


@@ -60,9 +60,6 @@ static char condition;
static tele_command_t tele_stack[TELE_STACK_SIZE];
static uint8_t tele_stack_top;


volatile uint8_t input_states[8];

const char *to_v(int16_t);

void copy_command(tele_command_t *dst, tele_command_t *src);
@@ -1660,8 +1657,7 @@ static void op_STATE(const void *NOTUSED(data), scene_state_t *NOTUSED(ss),
else if (a > 7)
a = 7;

tele_input_state(a);
cs_push(cs, input_states[a]);
cs_push(cs, tele_get_input_state(a));
}

static void op_ER(const void *NOTUSED(data), scene_state_t *NOTUSED(ss),
@@ -102,9 +102,6 @@ const char *to_v(int16_t);

extern tele_pattern_t tele_patterns[4];


extern char error_detail[16];

extern volatile uint8_t input_states[8];

#endif
@@ -1,6 +1,7 @@
#ifndef _TELETYPE_IO_H_
#define _TELETYPE_IO_H_

#include <stdbool.h>
#include <stdint.h>

// These functions are for interacting with the teletype hardware, each target
@@ -19,6 +20,6 @@ extern void tele_pi(void);
extern void tele_script(uint8_t a);
extern void tele_kill(void);
extern void tele_mute(uint8_t, uint8_t);
extern void tele_input_state(uint8_t);
extern bool tele_get_input_state(uint8_t);

#endif
@@ -21,7 +21,7 @@ void tele_pi() {}
void tele_script(uint8_t a) {}
void tele_kill() {}
void tele_mute(uint8_t i, uint8_t s) {}
void tele_input_state(uint8_t n) {}
bool tele_get_input_state(uint8_t n) { return false; }

GREATEST_MAIN_DEFS();

0 comments on commit a1efe92

Please sign in to comment.