Commit 9c4aaf9e authored by philip's avatar philip
Browse files

pin assignment check

parent 494e6d2f
......@@ -155,22 +155,30 @@ PC11 (8) | DBG SERIAL | RX
PC12 (10) | UART | MIDI TX | CN7
PD2 (12) | UART | MIDI RX
| |
PC8 (2) | PWM3/3 | Motor 1 Control | CN8
PC9 (4) | PWM3/4 | Motor 2 Control
PA6 (12) | PWM3/1 | Motor 3 Control | CN7
PB5 (14) | PWM3/2 | Motor 4 Control
PB3 (15) | PWM2/2 | Motor 5 Control
PD14 (16) | PWM4/3 | Motor 6 Control
PD15 (18) | PWM4/4 | Motor 7 Control
PE9 (4) | PWM1/1 | Motor 8 Control | CN10
PE11 (6) | PWM1/2 | Motor 9 Control
PE14 (8) | PWM1/4 | Motor 10 Control
PE13 (10) | PWM1/3 | Motor 11 Control
PB6 (14) | PWM4/1 | Motor 12 Control
PB7 (16) | PWM4/2 | Motor 13 Control
PA0 (29) | PWM2/1 | Motor 14 Control
PB10 (32) | PWM2/3 | Motor 15 Control
PB11 (34) | PWM2/4 | Motor 16 Control
PC8 (2) | PWM3/3 | Motor 1 (spkr 1) Control | CN8
PC9 (4) | PWM3/4 | Motor 2 (spkr 1) Control
PC6 (1) | GPIO OUT | Motor 1/2 Power | CN7
PA15 (9) | GPIO OUT | Motor 3/4 Power
PC7 (11) | GPIO OUT | Motor 5/6 Power
PA6 (12) | PWM3/1 | Motor 3 (spkr 2) Control
PB5 (14) | PWM3/2 | Motor 4 (spkr 2) Control
PB3 (15) | PWM2/2 | Motor 5 (spkr 3) Control
PD14 (16) | PWM4/3 | Motor 6 (spkr 3) Control
PD15 (18) | PWM4/4 | Motor 7 (spkr 4) Control
PB4 (19) | GPIO OUT | Motor 7/8 Power
PE9 (4) | PWM1/1 | Motor 8 (spkr 4) Control | CN10
PE11 (6) | PWM1/2 | Motor 9 (spkr 5) Control
PE14 (8) | PWM1/4 | Motor 10 (spkr 5) Control
PF5 (9) | GPIO OUT | Motor 9/10 Power
PE13 (10) | PWM1/3 | Motor 11 (spkr 6) Control
PB6 (14) | PWM4/1 | Motor 12 (spkr 6) Control
PB2 (15) | GPIO OUT | Motor 11/12 Power
PB7 (16) | PWM4/2 | Motor 13 (spkr 7) Control
PD11 (23) | GPIO OUT | Motor 13/14 Power
PA0 (29) | PWM2/1 | Motor 14 (spkr 7) Control
PB10 (32) | PWM2/3 | Motor 15 (spkr 8) Control
PE0 (33) | GPIO OUT | Motor 15/16 Power
PB11 (34) | PWM2/4 | Motor 16 (spkr 8) Control
#### iocontrols
......
......@@ -3,7 +3,7 @@
/************ FEATURES ************/
// MIDI channel (0-15) selection through 4 active high switches
#define USE_CHANNEL_SELECT 0
#define USE_CHANNEL_SELECT 1
#if USE_CHANNEL_SELECT
#define CHANNEL_SELECT_PIN_1 PC_3 // LSB
......@@ -17,7 +17,7 @@
// device id (0-15) selection (usb device name + hostname)
#define USE_DEVICE_ID_SELECT 0
#define USE_DEVICE_ID_SELECT 1
#if USE_DEVICE_ID_SELECT
#define DEVICE_ID_SELECT_PIN_1 PF_1 // LSB
......@@ -29,7 +29,7 @@
// default value (iff USE_DEVICE_ID_SELECT == 0)
#define DEVICE_ID_SELECT_DEFAULT 0
#define USE_FORWARDING_CONTROLS 0
#define USE_FORWARDING_CONTROLS 1
#if USE_FORWARDING_CONTROLS
#define USB_TO_MIDI_PIN PF_0
......@@ -48,14 +48,14 @@
#define NET_TO_USB_DEFAULT true
// not used at this time
#define USE_CFG 0
#define USE_CFG 1
#if USE_CFG
#define CFG_RSRV_1_PIN PD_5
#define CFG_RSRV_2_PIN PD_4
#endif //USE_CFG
#define USE_BUTTONS 0
#define USE_BUTTONS 1
#if USE_BUTTONS
#define BTN_CENTER_PIN PE_2
......@@ -68,8 +68,8 @@
#if USE_STATUS_LEDS
#define LED_PWR_PIN PC_0
#define LED_MTR_PIN PA_3
#define LED_USB_1_PIN LED1 //PE_6
#define LED_USB_2_PIN LED2 //PE_3
#define LED_USB_1_PIN PE_6
#define LED_USB_2_PIN PE_3
#define LED_MIDI_1_PIN PF_8
#define LED_MIDI_2_PIN PF_7
#define LED_NET_1_PIN PF_9
......@@ -98,7 +98,7 @@
#define MOTOR_PWR_AT_STARTUP 1
#define MOTOR_COUNT 2
#define MOTOR_COUNT 16
// PWM out pins
......@@ -109,7 +109,7 @@
#define MOTOR_5_PWM_PIN PB_3
#define MOTOR_6_PWM_PIN PD_14
#define MOTOR_7_PWM_PIN PD_15
#define MOTOR_8_PWM_PIN PC_8 //PE_9
#define MOTOR_8_PWM_PIN PE_9
#define MOTOR_9_PWM_PIN PE_11
#define MOTOR_10_PWM_PIN PE_14
#define MOTOR_11_PWM_PIN PE_13
......@@ -122,18 +122,18 @@
// GPIO power on
#define MOTOR_1_PWR_PIN PC_6
#define MOTOR_2_PWR_PIN PC_6
#define MOTOR_3_PWR_PIN PC_7
#define MOTOR_4_PWR_PIN PC_7
#define MOTOR_5_PWR_PIN PB_3
#define MOTOR_6_PWR_PIN PB_3
#define MOTOR_3_PWR_PIN PA_15
#define MOTOR_4_PWR_PIN PA_15
#define MOTOR_5_PWR_PIN PC_7
#define MOTOR_6_PWR_PIN PC_7
#define MOTOR_7_PWR_PIN PB_4
#define MOTOR_8_PWR_PIN PB_4
#define MOTOR_9_PWR_PIN PF_5
#define MOTOR_10_PWR_PIN PF_5
#define MOTOR_11_PWR_PIN PC_6//PB_2
#define MOTOR_12_PWR_PIN PC_6//PB_2
#define MOTOR_13_PWR_PIN PC_6// PE_2
#define MOTOR_14_PWR_PIN PC_6//PE_2
#define MOTOR_11_PWR_PIN PB_2
#define MOTOR_12_PWR_PIN PB_2
#define MOTOR_13_PWR_PIN PD_11
#define MOTOR_14_PWR_PIN PD_11
#define MOTOR_15_PWR_PIN PE_0
#define MOTOR_16_PWR_PIN PE_0
......
......@@ -339,12 +339,18 @@ void gpio_init()
#if USE_BUTTONS
btn_center.rise([](){
motors_center_request = true;
// usb_led1 = !usb_led1;
// usb_led2 = !usb_led2;
});
btn_plus1.rise([](){
btn_plus1_touched = true;
// midi_led1 = !midi_led1;
// midi_led2 = !midi_led2;
});
btn_plus2.rise([](){
btn_plus2_touched = true;
// net_led1 = !net_led1;
// net_led2 = !net_led2;
});
#endif //USE_BUTTONS
......@@ -405,7 +411,7 @@ void motors_run()
for(int i = 0; i < MOTOR_COUNT; i++){
motors[i].run();
is_off |= !motors[i].get_state();
// is_off |= !motors[i].get_state();
}
led_motors = is_off;
......@@ -486,16 +492,13 @@ void controller_handle_msg(uint8_t * buffer, size_t length, Source source)
// power control
if (msg.type() == MIDIMessage::NoteOnType || msg.type() == MIDIMessage::NoteOffType){
printf("note\n");
if (msg.channel() == get_channel()){
printf("channel %d\n");
int32_t motori = msg.key();
if (0 <= motori && motori < MOTOR_COUNT){
// turn on or off
bool off = msg.type() == MIDIMessage::NoteOffType || msg.velocity() == 0;
printf("motor pwr %d := %d\n", motori, !off);
// printf("motor pwr %d := %d\n", motori, !off);
motors[motori] = !off;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment