switches

Axoloti Control (AxoC) - switch control
Author: Mark Harris
License: GPL
Github: tb/ctrl/axoc/switches.axo

Inlets

bool32 led1

bool32 led2

bool32 led3

Outlets

bool32 out1

bool32 out2

bool32 out3

Displays

bool32 d1

bool32 d2

bool32 d3

Init
// leds
palSetPadMode(GPIOB, 1, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 8, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 9, PAL_MODE_OUTPUT_PUSHPULL);

// switches
palSetPadMode(GPIOC, 1, PAL_MODE_INPUT_PULLDOWN);
palSetPadMode(GPIOC, 2, PAL_MODE_INPUT_PULLDOWN);
palSetPadMode(GPIOC, 3, PAL_MODE_INPUT_PULLDOWN);
Control Rate
palWritePad(GPIOB, 1, (inlet_led1 > 0));
palWritePad(GPIOB, 8, (inlet_led2 > 0));
palWritePad(GPIOB, 9, (inlet_led3 > 0));

int32_t o1, o2, o3;
o1 = palReadPad(GPIOC, 1) << 27;
o2 = palReadPad(GPIOC, 2) << 27;
o3 = palReadPad(GPIOC, 3) << 27;

outlet_out1 = o1;
outlet_out2 = o2;
outlet_out3 = o3;

disp_d1 = o1;
disp_d2 = o2;
disp_d3 = o3;

Privacy

© 2024 Zrna Research