Skip to content

Commit

Permalink
clang-format (monome#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
scanner-darkly authored May 3, 2023
1 parent 29f5445 commit 7041e67
Show file tree
Hide file tree
Showing 20 changed files with 979 additions and 936 deletions.
2 changes: 1 addition & 1 deletion module/flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void flash_prepare() {

flashc_memcpy((void *)&f.cal, &blank_cal_data, sizeof(blank_cal_data),
true);
device_config_t device_config = {.flip = 0 };
device_config_t device_config = { .flip = 0 };
flashc_memcpy((void *)&f.device_config, &device_config,
sizeof(device_config), true);
flash_update_last_saved_scene(0);
Expand Down
4 changes: 3 additions & 1 deletion module/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ typedef enum {
} tele_mode_t;

// device config
typedef struct { uint8_t flip; } device_config_t;
typedef struct {
uint8_t flip;
} device_config_t;

void set_mode(tele_mode_t mode);
void set_last_mode(void);
Expand Down
1 change: 1 addition & 0 deletions module/grid.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "grid.h"

#include "edit_mode.h"
#include "flash.h"
#include "font.h"
Expand Down
48 changes: 25 additions & 23 deletions module/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ void tele_profile_delay(uint8_t d) {
scene_state_t scene_state;
char scene_text[SCENE_TEXT_LINES][SCENE_TEXT_CHARS];
uint8_t preset_select;
region line[8] = {
{.w = 128, .h = 8, .x = 0, .y = 0 }, {.w = 128, .h = 8, .x = 0, .y = 8 },
{.w = 128, .h = 8, .x = 0, .y = 16 }, {.w = 128, .h = 8, .x = 0, .y = 24 },
{.w = 128, .h = 8, .x = 0, .y = 32 }, {.w = 128, .h = 8, .x = 0, .y = 40 },
{.w = 128, .h = 8, .x = 0, .y = 48 }, {.w = 128, .h = 8, .x = 0, .y = 56 }
};
region line[8] = { { .w = 128, .h = 8, .x = 0, .y = 0 },
{ .w = 128, .h = 8, .x = 0, .y = 8 },
{ .w = 128, .h = 8, .x = 0, .y = 16 },
{ .w = 128, .h = 8, .x = 0, .y = 24 },
{ .w = 128, .h = 8, .x = 0, .y = 32 },
{ .w = 128, .h = 8, .x = 0, .y = 40 },
{ .w = 128, .h = 8, .x = 0, .y = 48 },
{ .w = 128, .h = 8, .x = 0, .y = 56 } };
char copy_buffer[SCENE_TEXT_LINES][SCENE_TEXT_CHARS];
uint8_t copy_buffer_len = 0;

Expand Down Expand Up @@ -122,17 +124,17 @@ static uint64_t last_adc_tick = 0;
static midi_behavior_t midi_behavior;

// timers
static softTimer_t clockTimer = {.next = NULL, .prev = NULL };
static softTimer_t refreshTimer = {.next = NULL, .prev = NULL };
static softTimer_t keyTimer = {.next = NULL, .prev = NULL };
static softTimer_t cvTimer = {.next = NULL, .prev = NULL };
static softTimer_t adcTimer = {.next = NULL, .prev = NULL };
static softTimer_t hidTimer = {.next = NULL, .prev = NULL };
static softTimer_t metroTimer = {.next = NULL, .prev = NULL };
static softTimer_t monomePollTimer = {.next = NULL, .prev = NULL };
static softTimer_t monomeRefreshTimer = {.next = NULL, .prev = NULL };
static softTimer_t gridFaderTimer = {.next = NULL, .prev = NULL };
static softTimer_t midiScriptTimer = {.next = NULL, .prev = NULL };
static softTimer_t clockTimer = { .next = NULL, .prev = NULL };
static softTimer_t refreshTimer = { .next = NULL, .prev = NULL };
static softTimer_t keyTimer = { .next = NULL, .prev = NULL };
static softTimer_t cvTimer = { .next = NULL, .prev = NULL };
static softTimer_t adcTimer = { .next = NULL, .prev = NULL };
static softTimer_t hidTimer = { .next = NULL, .prev = NULL };
static softTimer_t metroTimer = { .next = NULL, .prev = NULL };
static softTimer_t monomePollTimer = { .next = NULL, .prev = NULL };
static softTimer_t monomeRefreshTimer = { .next = NULL, .prev = NULL };
static softTimer_t gridFaderTimer = { .next = NULL, .prev = NULL };
static softTimer_t midiScriptTimer = { .next = NULL, .prev = NULL };
static softTimer_t trPulseTimer[TR_COUNT];


Expand Down Expand Up @@ -255,32 +257,32 @@ void cvTimer_callback(void* o) {
}

void clockTimer_callback(void* o) {
event_t e = {.type = kEventTimer, .data = 0 };
event_t e = { .type = kEventTimer, .data = 0 };
event_post(&e);
}

void refreshTimer_callback(void* o) {
event_t e = {.type = kEventScreenRefresh, .data = 0 };
event_t e = { .type = kEventScreenRefresh, .data = 0 };
event_post(&e);
}

void keyTimer_callback(void* o) {
event_t e = {.type = kEventKeyTimer, .data = 0 };
event_t e = { .type = kEventKeyTimer, .data = 0 };
event_post(&e);
}

void adcTimer_callback(void* o) {
event_t e = {.type = kEventPollADC, .data = 0 };
event_t e = { .type = kEventPollADC, .data = 0 };
event_post(&e);
}

void hidTimer_callback(void* o) {
event_t e = {.type = kEventHidTimer, .data = 0 };
event_t e = { .type = kEventHidTimer, .data = 0 };
event_post(&e);
}

void metroTimer_callback(void* o) {
event_t e = {.type = kEventAppCustom, .data = 0 };
event_t e = { .type = kEventAppCustom, .data = 0 };
event_post(&e);
}

Expand Down
6 changes: 3 additions & 3 deletions src/chaos.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ static const float chaos_henon_b = 0.3;
static const int chaos_cell_count = 8;
static const int chaos_cell_max = 0xff;

static chaos_state_t chaos_state = {
.ix = 5000, .ir = 5000, .alg = CHAOS_ALGO_LOGISTIC
};
static chaos_state_t chaos_state = { .ix = 5000,
.ir = 5000,
.alg = CHAOS_ALGO_LOGISTIC };

void chaos_init() {
chaos_scale_values(&chaos_state);
Expand Down
1 change: 1 addition & 0 deletions src/command.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "command.h"

#include <string.h> // memcpy

#include "helpers.h"
#include "ops/op.h"
#include "util.h"
Expand Down
2 changes: 2 additions & 0 deletions src/helpers.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "helpers.h"

#include <string.h>

#include "table.h"
#include "util.h"

Expand Down
1 change: 1 addition & 0 deletions src/ops/disting.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "ops/disting.h"

#include "helpers.h"
#include "ii.h"
#include "teletype.h"
Expand Down
1 change: 1 addition & 0 deletions src/ops/grid_ops.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "ops/grid_ops.h"

#include "helpers.h"
#include "teletype.h"
#include "teletype_io.h"
Expand Down
16 changes: 8 additions & 8 deletions src/ops/i2c2midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1321,19 +1321,19 @@ static void op_I2M_B_MODE_get(const void *data, scene_state_t *ss,
}

static void op_I2M_MUTE_get(const void *data, scene_state_t *ss,
exec_state_t *es, command_state_t *cs) {
exec_state_t *es, command_state_t *cs) {
SEND_B1(13, midi_channel + 1);
RECEIVE_AND_PUSH_S8;
}

static void op_I2M_MUTE_set(const void *data, scene_state_t *ss,
exec_state_t *es, command_state_t *cs) {
exec_state_t *es, command_state_t *cs) {
s16 value = cs_pop(cs);
SEND_B2(14, midi_channel + 1, value);
}

static void op_I2M_MUTE_POUND_get(const void *data, scene_state_t *ss,
exec_state_t *es, command_state_t *cs) {
exec_state_t *es, command_state_t *cs) {
s16 channel = cs_pop(cs);
if (channel < 1 || channel > MAX_CHANNEL) {
cs_push(cs, 0);
Expand All @@ -1344,7 +1344,7 @@ static void op_I2M_MUTE_POUND_get(const void *data, scene_state_t *ss,
}

static void op_I2M_MUTE_POUND_set(const void *data, scene_state_t *ss,
exec_state_t *es, command_state_t *cs) {
exec_state_t *es, command_state_t *cs) {
s16 channel = cs_pop(cs);
s16 value = cs_pop(cs);
RETURN_IF_OUT_OF_RANGE(channel, 0, MAX_CHANNEL);
Expand All @@ -1353,19 +1353,19 @@ static void op_I2M_MUTE_POUND_set(const void *data, scene_state_t *ss,
}

static void op_I2M_SOLO_get(const void *data, scene_state_t *ss,
exec_state_t *es, command_state_t *cs) {
exec_state_t *es, command_state_t *cs) {
SEND_B1(15, midi_channel + 1);
RECEIVE_AND_PUSH_S8;
}

static void op_I2M_SOLO_set(const void *data, scene_state_t *ss,
exec_state_t *es, command_state_t *cs) {
exec_state_t *es, command_state_t *cs) {
s16 value = cs_pop(cs);
SEND_B2(16, midi_channel + 1, value);
}

static void op_I2M_SOLO_POUND_get(const void *data, scene_state_t *ss,
exec_state_t *es, command_state_t *cs) {
exec_state_t *es, command_state_t *cs) {
s16 channel = cs_pop(cs);
if (channel < 1 || channel > MAX_CHANNEL) {
cs_push(cs, 0);
Expand All @@ -1376,7 +1376,7 @@ static void op_I2M_SOLO_POUND_get(const void *data, scene_state_t *ss,
}

static void op_I2M_SOLO_POUND_set(const void *data, scene_state_t *ss,
exec_state_t *es, command_state_t *cs) {
exec_state_t *es, command_state_t *cs) {
s16 channel = cs_pop(cs);
s16 value = cs_pop(cs);
RETURN_IF_OUT_OF_RANGE(channel, 0, MAX_CHANNEL);
Expand Down
1 change: 1 addition & 0 deletions src/ops/init.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "ops/init.h"

#include <string.h> // memset()

#include "helpers.h"
#include "ops/op.h"
#include "teletype.h"
Expand Down
7 changes: 3 additions & 4 deletions src/ops/op.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,9 @@ const tele_op_t *tele_ops[E_OP__LENGTH] = {
&op_I2M_B_R, &op_I2M_B_L, &op_I2M_B_START, &op_I2M_B_END, &op_I2M_B_DIR,
&op_I2M_B_SPE, &op_I2M_B_FB, &op_I2M_B_NSHIFT, &op_I2M_B_VSHIFT,
&op_I2M_B_TSHIFT, &op_I2M_B_NOFF, &op_I2M_B_VOFF, &op_I2M_B_TOFF,
&op_I2M_B_CLR, &op_I2M_B_MODE, &op_I2M_C_QN, &op_I2M_C_QV,
&op_I2M_MUTE, &op_I2M_MUTE_POUND, &op_I2M_SOLO, &op_I2M_SOLO_POUND,
&op_I2M_TEST,

&op_I2M_B_CLR, &op_I2M_B_MODE, &op_I2M_C_QN, &op_I2M_C_QV, &op_I2M_MUTE,
&op_I2M_MUTE_POUND, &op_I2M_SOLO, &op_I2M_SOLO_POUND, &op_I2M_TEST,


// seed
&op_SEED, &op_RAND_SEED, &op_SYM_RAND_SD, &op_SYM_R_SD, &op_TOSS_SEED,
Expand Down
2 changes: 2 additions & 0 deletions src/ops/queue.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "ops/queue.h"

#include <stdlib.h> // rand

#include "helpers.h"
#include "state.h"
#include "teletype_io.h"
Expand Down
1 change: 1 addition & 0 deletions src/ops/seed.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "ops/seed.h"

#include "helpers.h"
#include "random.h"

Expand Down
2 changes: 1 addition & 1 deletion src/ops/turtle.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "ops/turtle.h"
#include "helpers.h"

#include "helpers.h"
#include "ops/op.h"
#include "state.h"
#include "teletype.h"
Expand Down
3 changes: 2 additions & 1 deletion src/state.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "state.h"
#include "helpers.h"

#include <stdlib.h>
#include <string.h>

#include "helpers.h"
#include "teletype_io.h"

////////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 3 additions & 1 deletion src/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,9 @@ typedef struct {
int16_t top;
} command_state_stack_t;

typedef struct { command_state_stack_t stack; } command_state_t;
typedef struct {
command_state_stack_t stack;
} command_state_t;

extern void cs_init(command_state_t *cs);
extern int16_t cs_stack_size(command_state_t *cs);
Expand Down
Loading

0 comments on commit 7041e67

Please sign in to comment.