70#define MUNICH_KEY(I, F, D) \
71 ((I << OFFSET_TO_I) | (F << OFFSET_TO_F) | (D << OFFSET_TO_D))
81#define MUNICH_KEY_I_D(I, D) MUNICH_KEY(I, 0, D)
87#define MUNICH_KEY_I(I) MUNICH_KEY(I, 0, 0)
229 PAYLOAD_RETINA_NO_DOWN_SAMPLING_IN_PAYLOAD =
243 PAYLOAD_MASTER_SLAVE_USE_INTERNAL_COUNTER = 0,
244 PAYLOAD_MASTER_SLAVE_SET_SLAVE = 1,
245 PAYLOAD_MASTER_SLAVE_SET_MASTER_CLOCK_NOT_STARTED = 2,
246 PAYLOAD_MASTER_SLAVE_SET_MASTER_CLOCK_ACTIVE = 4
250typedef enum modes_e {
308 .payload = (uint32_t)
mode,
321 uint32_t new_key, uint32_t uart_id) {
368 .payload = PAYLOAD_MASTER_SLAVE_USE_INTERNAL_COUNTER,
381 .payload = PAYLOAD_MASTER_SLAVE_SET_SLAVE,
395 .payload = PAYLOAD_MASTER_SLAVE_SET_MASTER_CLOCK_NOT_STARTED,
409 .payload = PAYLOAD_MASTER_SLAVE_SET_MASTER_CLOCK_ACTIVE,
420 uint32_t bias_id, uint32_t bias_value, uint32_t uart_id) {
424 .payload = ((bias_id << 0) | (bias_value << 8)),
436 uint32_t sensor_id) {
448 uint32_t sensor_id) {
462 uint32_t sensor_id, uint32_t time_in_ms) {
479 uint32_t enable_disable, uint32_t uart_id) {
483 .payload = enable_disable,
494 uint32_t time_in_ms, uint32_t uart_id) {
498 .payload = time_in_ms,
509 uint32_t pwm_signal, uint32_t uart_id) {
513 .payload = pwm_signal,
524 uint32_t pwm_signal, uint32_t uart_id) {
528 .payload = pwm_signal,
539 uint32_t pwm_signal, uint32_t uart_id) {
543 .payload = pwm_signal,
554 uint32_t pwm_signal, uint32_t uart_id) {
558 .payload = pwm_signal,
775 uint32_t total_period, uint32_t uart_id) {
777 log_error(
"The mode you configured is not the pushbot, "
778 "and so this message is invalid for mode %d",
mode);
784 .payload = total_period,
795 uint32_t active_time, uint32_t uart_id) {
797 log_error(
"The mode you configured is not the pushbot, "
798 "and so this message is invalid for mode %d",
mode);
804 .payload = active_time,
814 uint32_t frequency, uint32_t uart_id) {
816 log_error(
"The mode you configured is not the pushbot, "
817 "and so this message is invalid for mode %d",
mode);
823 .payload = frequency,
838 uint32_t total_period, uint32_t uart_id) {
840 log_error(
"The mode you configured is not the pushbot, "
841 "and so this message is invalid for mode %d",
mode);
847 .payload = total_period,
859 uint32_t active_time, uint32_t uart_id) {
861 log_error(
"The mode you configured is not the pushbot, "
862 "and so this message is invalid for mode %d",
mode);
868 .payload = active_time,
879 uint32_t frequency, uint32_t uart_id) {
881 log_error(
"The mode you configured is not the pushbot, "
882 "and so this message is invalid for mode %d",
mode);
888 .payload = frequency,
899 uint32_t melody, uint32_t uart_id) {
901 log_error(
"The mode you configured is not the pushbot, "
902 "and so this message is invalid for mode %d",
mode);
921 uint32_t total_period, uint32_t uart_id) {
923 log_error(
"The mode you configured is not the pushbot, "
924 "and so this message is invalid for mode %d",
mode);
930 .payload = total_period,
940 uint32_t active_time, uint32_t uart_id) {
942 log_error(
"The mode you configured is not the pushbot, "
943 "and so this message is invalid for mode %d",
mode);
949 .payload = active_time,
959 uint32_t active_time, uint32_t uart_id) {
961 log_error(
"The mode you configured is not the pushbot, "
962 "and so this message is invalid for mode %d",
mode);
968 .payload = active_time,
978 uint32_t frequency, uint32_t uart_id) {
980 log_error(
"The mode you configured is not the pushbot, "
981 "and so this message is invalid for mode %d",
mode);
987 .payload = frequency,
1000 state_t velocity, uint32_t uart_id) {
1002 log_error(
"The mode you configured is not the pushbot, "
1003 "and so this message is invalid for mode %d",
mode);
1009 .payload = velocity,
1019 uint32_t velocity, uint32_t uart_id) {
1021 log_error(
"The mode you configured is not the pushbot, "
1022 "and so this message is invalid for mode %d",
mode);
1028 .payload = velocity,
1039 uint32_t velocity, uint32_t uart_id) {
1041 log_error(
"The mode you configured is not the pushbot, "
1042 "and so this message is invalid for mode %d",
mode);
1048 .payload = velocity,
1059 uint32_t velocity, uint32_t uart_id) {
1061 log_error(
"The mode you configured is not the pushbot, "
1062 "and so this message is invalid for mode %d",
mode);
1068 .payload = velocity,
1077 uint32_t retina_pixels, uint32_t time_stamps, uint32_t uart_id) {
1078 if (retina_pixels == 128 * 128) {
1084 .payload_flag = WITH_PAYLOAD
1087 if (retina_pixels == 64 * 64) {
1092 .payload_flag = WITH_PAYLOAD
1095 if (retina_pixels == 32 * 32) {
1100 .payload_flag = WITH_PAYLOAD
1103 if (retina_pixels == 16 * 16) {
1108 .payload_flag = WITH_PAYLOAD
1112 log_error(
"The number of pixels is not supported in this protocol.");
1126 bool events_in_key, uint32_t retina_pixels,
1127 bool payload_holds_time_stamps, uint32_t size_of_time_stamp_in_bytes,
1130 if (events_in_key) {
1131 if (!payload_holds_time_stamps) {
1136 switch (size_of_time_stamp_in_bytes) {
1150 log_error(
"Unknown size of timestamp in bytes: %d\n",
1151 size_of_time_stamp_in_bytes);
1154 .key = 0, .payload = 0, .payload_flag = 0
1161 log_warning(
"The current sPyNNaker models do not support the reception "
1162 "of packets with payloads, therefore you will need to add a "
1163 "adaptor model between the device and sPyNNaker models.");
1166 if (payload_holds_time_stamps || (size_of_time_stamp_in_bytes == 0)) {
1168 "If you are using payloads to store events, you cannot"
1169 " have time stamps at all.");
1178 PAYLOAD_RETINA_NO_DOWN_SAMPLING_IN_PAYLOAD),
void log_error(const char *message,...)
void log_warning(const char *message,...)
static uint32_t timer_period
Used for configuring the timer hardware.
static multicast_packet munich_protocol_turn_off_sensor_reporting(uint32_t sensor_id)
Creates a command to stop sensor reporting.
@ OFFSET_TO_F
Offset to F (format) field in command word.
@ OFFSET_TO_I
Offset to I (instruction) field in command word.
@ OFFSET_TO_D
Offset to D (device) field in command word.
static multicast_packet munich_protocol_push_bot_led_back_active_time(uint32_t active_time, uint32_t uart_id)
Creates a command to set the back LED active time.
static multicast_packet munich_protocol_push_bot_speaker_set_melody(uint32_t melody, uint32_t uart_id)
Creates a command to configure the speaker play a pre-programmed "melody".
static multicast_packet munich_protocol_pwm_pin_output_timer_b_duration(uint32_t timer_period, uint32_t uart_id)
Creates a command to set the PWM duty cycle period for Timer B.
static multicast_packet munich_protocol_master_slave_use_internal_counter(uint32_t uart_id)
Creates a command to tell the master/slave to use its internal event counter.
static multicast_packet munich_protocol_push_bot_led_front_active_time(uint32_t active_time, uint32_t uart_id)
Creates a command to set the front LED active time.
static uint32_t instance_key
The value of the ignored part of the key.
munich_protocol_modes_e
human readable definitions of each mode
@ MUNICH_PROTOCOL_PUSH_BOT
Push Bot.
@ MUNICH_PROTOCOL_BALL_BALANCER
Ball balancer.
@ MUNICH_PROTOCOL_FREE
Free.
@ MUNICH_PROTOCOL_RESET_TO_DEFAULT
Reset.
@ MUNICH_PROTOCOL_MY_ORO_BOTICS
MyORO.
@ MUNICH_PROTOCOL_SPOMNIBOT
Omnibot.
static multicast_packet munich_protocol_push_bot_laser_config_active_time(uint32_t active_time, uint32_t uart_id)
Creates a command to set the laser active time.
static multicast_packet munich_protocol_reset_retina(uint32_t uart_id)
Creates a command to reset a retina.
static multicast_packet munich_protocol_poll_individual_sensor_continuously(uint32_t sensor_id, uint32_t time_in_ms)
Creates a command to continuously poll a sensor.
static multicast_packet munich_protocol_set_retina_transmission_key(uint32_t new_key, uint32_t uart_id)
Creates a command to set the retina base key.
static multicast_packet munich_protocol_push_bot_laser_config_total_period(uint32_t total_period, uint32_t uart_id)
Creates a command to set the laser total period.
static multicast_packet munich_protocol_add_payload_logic_to_current_output(uint32_t payload)
Creates a command to add to the current output.
static multicast_packet munich_protocol_set_output_pattern_for_payload(uint32_t payload)
Creates a command to set an output pattern for a payload.
static multicast_packet munich_protocol_pwm_pin_output_timer_c_channel_1_ratio(uint32_t timer_period, uint32_t uart_id)
Creates a command to set the PWM duty cycle ratio for Timer C, Channel 1.
static munich_protocol_modes_e mode
The current mode.
static multicast_packet munich_protocol_pwm_pin_output_timer_b_channel_1_ratio(uint32_t timer_period, uint32_t uart_id)
Creates a command to set the PWM duty cycle ratio for Timer B, Channel 1.
static multicast_packet munich_protocol_generic_motor_total_period_duration(uint32_t time_in_ms, uint32_t uart_id)
Creates a command to turn a motor on for a period.
static multicast_packet munich_protocol_generic_motor0_raw_output_leak_to_0(uint32_t pwm_signal, uint32_t uart_id)
Creates a command to turn motor 0 on at a rate that decays to zero.
#define MUNICH_KEY_I_D(I, D)
Assembles a Munich key with zero munich_key_bitfields_t::instance_key and munich_key_bitfields_t::pay...
uint32_t payload
What payload to use.
static multicast_packet munich_protocol_pwm_pin_output_timer_c_duration(uint32_t timer_period, uint32_t uart_id)
Creates a command to set the PWM duty cycle period for Timer C.
static multicast_packet munich_protocol_set_retina_transmission(bool events_in_key, uint32_t retina_pixels, bool payload_holds_time_stamps, uint32_t size_of_time_stamp_in_bytes, uint32_t uart_id)
Creates a command to set how silicon retinas transmit.
@ PAYLOAD_RETINA_32_DOWN_SAMPLING
Retina down-samples to 32×32.
@ PAYLOAD_RETINA_NO_DOWN_SAMPLING
Retina is 128×128.
@ PAYLOAD_RETINA_64_DOWN_SAMPLING
Retina down-samples to 64×64.
@ PAYLOAD_RETINA_16_DOWN_SAMPLING
Retina down-samples to 16×16.
static multicast_packet munich_protocol_get_set_mode_command(void)
Creates a command to set the device mode.
static void set_protocol_mode(munich_protocol_modes_e new_mode, uint32_t new_instance_key)
Configures the protocol mode.
static multicast_packet munich_protocol_push_bot_speaker_config_active_time(uint32_t active_time, uint32_t uart_id)
Creates a command to adjust how the speaker runs in PCM mode.
static multicast_packet munich_protocol_pwm_pin_output_timer_a_channel_1_ratio(uint32_t timer_period, uint32_t uart_id)
Creates a command to set the PWM duty cycle ratio for Timer A, Channel 1.
munich_key_bitfields_t bitfields
Specific fields within the key.
static multicast_packet munich_protocol_query_state_of_io_lines(void)
Creates a command to ask for the state of the IO lines.
static multicast_packet munich_protocol_push_bot_laser_set_frequency(uint32_t frequency, uint32_t uart_id)
Creates a command to set the laser flash frequency.
static multicast_packet munich_protocol_push_bot_speaker_set_tone(uint32_t frequency, uint32_t uart_id)
Creates a command to configure the speaker play a particular frequency of tone.
static multicast_packet munich_protocol_generic_motor0_raw_output_permanent(uint32_t pwm_signal, uint32_t uart_id)
Creates a command to turn motor 0 on at a constant rate.
static multicast_packet munich_protocol_master_slave_set_master_clock_active(uint32_t uart_id)
Creates a command to set a UART clock active.
static multicast_packet munich_protocol_pwm_pin_output_timer_a_duration(uint32_t timer_period, uint32_t uart_id)
Creates a command to set the PWM duty cycle period for Timer A.
static multicast_packet munich_protocol_set_payload_pins_to_high_impedance(uint32_t payload)
Creates a command to set the payload pins to high-impedance mode.
static multicast_packet munich_protocol_generic_motor1_raw_output_leak_to_0(uint32_t pwm_signal, uint32_t uart_id)
Creates a command to turn motor 1 on at a rate that decays to zero.
uint32_t payload_flag
Whether the payload is defined.
static multicast_packet munich_protocol_get_configure_master_key_command(uint32_t new_key)
Creates a command to configure the master key.
static multicast_packet munich_protocol_master_slave_set_master_clock_not_started(uint32_t uart_id)
Creates a command to set a UART clock into the not-started state.
static multicast_packet munich_protocol_generic_motor_enable_disable(uint32_t enable_disable, uint32_t uart_id)
Creates a command to turn a motor on or off.
static multicast_packet munich_protocol_pwm_pin_output_timer_a_channel_0_ratio(uint32_t timer_period, uint32_t uart_id)
Creates a command to set the PWM duty cycle ratio for Timer A, Channel 0.
uint32_t payload_format
Payload format.
@ PAYLOAD_SENSOR_ID_OFFSET
Offset for sensor ID.
@ PAYLOAD_OFFSET_FOR_RETINA_SIZE
Offset for retina size.
@ PAYLOAD_OFFSET_FOR_TIMESTAMPS
Offset for timestamps.
@ PAYLOAD_OFFSET_FOR_SENSOR_TIME
Offset for sensor timestamp.
static multicast_packet munich_protocol_push_bot_led_set_frequency(uint32_t frequency, uint32_t uart_id)
Creates a command to set the LED flash frequency.
static multicast_packet munich_protocol_push_bot_led_total_period(uint32_t total_period, uint32_t uart_id)
Creates a command to set the total LED period.
static multicast_packet munich_protocol_bias_values(uint32_t bias_id, uint32_t bias_value, uint32_t uart_id)
Creates a command to set bias values for a UART.
static multicast_packet munich_protocol_push_bot_motor_0_leaking_towards_zero(uint32_t velocity, uint32_t uart_id)
Creates a command to set motor 0 moving, in leak-to-zero mode.
static multicast_packet munich_protocol_push_bot_motor_1_leaking_towards_zero(uint32_t velocity, uint32_t uart_id)
Creates a command to set motor 1 moving, in leak-to-zero mode.
static multicast_packet munich_protocol_pwm_pin_output_timer_b_channel_0_ratio(uint32_t timer_period, uint32_t uart_id)
Creates a command to set the PWM duty cycle ratio for Timer B, Channel 0.
static multicast_packet munich_protocol_master_slave_set_slave(uint32_t uart_id)
Creates a command to tell a UART to be a slave.
static multicast_packet munich_protocol_generic_motor1_raw_output_permanent(uint32_t pwm_signal, uint32_t uart_id)
Creates a command to turn motor 1 on at a constant rate.
@ MOTOR_TIMER_C_CHANNEL_1_ACTIVE_PERIOD_KEY
motor 1 output timer C ratio active period
@ MOTOR_TIMER_A_CHANNEL_1_ACTIVE_PERIOD_KEY
motor 1 output timer A ratio active period
@ REMOVE_PAYLOAD_TO_CURRENT_OUTPUT_KEY
remove payload (logic or (PL)) to current output from current output
@ PUSH_BOT_MOTOR_1_LEAKY_VELOCITY
Set motor 1 leaky velocity.
@ MOTOR_RUN_FOR_PERIOD_KEY
run motor for total period
@ PUSH_BOT_SPEAKER_CONFIG_ACTIVE_TIME
Set speaker active time (PCM)
@ PUSH_BOT_SPEAKER_TONE_BEEP
Tell speaker to beep.
@ MOTOR_1_RAW_LEAK_KEY
raw output for motor 1 (leak towards 0)
@ MOTOR_TIMER_B_TOTAL_PERIOD_KEY
motor output duration timer B period
@ PUSH_BOT_SPEAKER_TONE_MELODY
Tell speaker to play pre-programmed melody.
@ MOTOR_TIMER_C_CHANNEL_0_ACTIVE_PERIOD_KEY
motor 0 output timer C ratio active period
@ MOTOR_TIMER_A_CHANNEL_0_ACTIVE_PERIOD_KEY
motor 0 output timer A ratio active period
@ CHANGE_MODE
command key for setting up what mode of device running on the board
@ PUSH_BOT_MOTOR_0_LEAKY_VELOCITY
Set motor 0 leaky velocity.
@ MOTOR_TIMER_C_TOTAL_PERIOD_KEY
motor output duration timer C period
@ PUSH_BOT_LED_BACK_CONFIG_ACTIVE_TIME
Set LED back active period.
@ DISABLE_RETINA_EVENT_STREAMING
command for turning off retina output
@ PUSH_BOT_MOTOR_0_PERMANENT_VELOCITY
Set motor 0 permanent velocity.
@ CONFIGURE_MASTER_KEY
command key for setting up the master key of the board
@ PUSH_BOT_LASER_FREQUENCY
Set laser frequency.
@ MOTOR_0_RAW_PERM_KEY
raw output for motor 0 (permanent)
@ ACTIVE_RETINA_EVENT_STREAMING_SET_KEY
command for retina where events are the key
@ SET_TIMER_COUNTER_FOR_TIMESTAMPS
set timer / counter for timestamps
@ MOTOR_TIMER_B_CHANNEL_1_ACTIVE_PERIOD_KEY
motor 1 output timer B ratio active period
@ BIAS_KEY
command for setting bias
@ MOTOR_0_RAW_LEAK_KEY
raw output for motor 0 (leak towards 0)
@ PUSH_BOT_LASER_CONFIG_TOTAL_PERIOD
Set laser total period.
@ ACTIVE_RETINA_EVENT_STREAMING_KEYS_CONFIGURATION
command for retina where payload is events
@ PUSH_BOT_LED_FREQUENCY
Set LED frequency.
@ PUSH_BOT_LED_FRONT_CONFIG_ACTIVE_TIME
Set LED front active period.
@ DISABLE_MOTOR_KEY
disable motor
@ PUSH_BOT_LED_CONFIG_TOTAL_PERIOD
Set LED total period.
@ RESET_RETINA_KEY
reset retina key.
@ PUSH_BOT_LASER_CONFIG_ACTIVE_TIME
Set laser active period (out of total)
@ SET_OUTPUT_PATTERN_KEY
set output pattern to payload
@ SENSOR_REPORTING_OFF_KEY
request on-board sensor data
@ PUSH_BOT_MOTOR_1_PERMANENT_VELOCITY
Set motor 1 permanent velocity.
@ POLL_SENSORS_CONTINUOUSLY_KEY
poll sensors continuously
@ MOTOR_1_RAW_PERM_KEY
raw output for motor 1 (permanent)
@ MASTER_SLAVE_KEY
handle master / slave time sync
@ PUSH_BOT_SPEAKER_CONFIG_TOTAL_PERIOD
Set speaker total time period (PCM)
@ MOTOR_TIMER_A_TOTAL_PERIOD_KEY
motor output duration timer A period
@ QUERY_STATES_LINES_KEY
Query digital IO Signals.
@ POLL_SENSORS_ONCE_KEY
poll sensors once
@ ADD_PAYLOAD_TO_CURRENT_OUTPUT_KEY
add payload (logic or (PL)) to current output
@ SET_PAYLOAD_TO_HIGH_IMPEDANCE_KEY
set payload pins to high impedance
@ MOTOR_TIMER_B_CHANNEL_0_ACTIVE_PERIOD_KEY
motor 0 output timer B ratio active period
static multicast_packet munich_protocol_pwm_pin_output_timer_c_channel_0_ratio(uint32_t timer_period, uint32_t uart_id)
Creates a command to set the PWM duty cycle ratio for Timer C, Channel 0.
#define MUNICH_KEY_I(I)
Assembles a Munich key with zero for all fields except munich_key_bitfields_t::instruction.
static multicast_packet munich_protocol_remove_payload_logic_to_current_output(uint32_t payload)
Creates a command to remove from the current output.
static multicast_packet munich_protocol_push_bot_speaker_config_total_period(uint32_t total_period, uint32_t uart_id)
Creates a command to configure the speaker to run in PCM mode.
uint32_t device
Device identifier.
@ PAYLOAD_NO_TIMESTAMPS
No timestamps.
@ PAYLOAD_TWO_BYTE_TIME_STAMPS
Timestamps are two bytes (absolute)
@ PAYLOAD_THREE_BYTE_TIME_STAMPS
Timestamps are three bytes (absolute)
@ PAYLOAD_DELTA_TIMESTAMPS
Timestamps are deltas.
@ PAYLOAD_FOUR_BYTE_TIME_STAMPS
Timestamps are four bytes (absolute)
@ PUSH_BOT_UART_OFFSET_SPEAKER_LED_LASER
Device UART offset for the pushbot.
@ OFFSET_FOR_UART_ID
UART identifier offset.
uint32_t value
Overall key value.
static multicast_packet munich_protocol_disable_retina_event_streaming(uint32_t uart_id)
Creates a command to disable event streaming my a retina.
static multicast_packet munich_protocol_poll_sensors_once(uint32_t sensor_id)
Creates a command to poll a sensor once.
static multicast_packet munich_protocol_push_bot_motor_0_permanent(state_t velocity, uint32_t uart_id)
Creates a command to set motor 0 moving, in constant mode.
uint32_t key
What key to use.
uint32_t instance_key
Instance key (ignored)
static multicast_packet munich_protocol_push_bot_motor_1_permanent(uint32_t velocity, uint32_t uart_id)
Creates a command to set motor 1 moving, in constant mode.
uint32_t instruction
Device-specific instruction.
Description of multicast packet to send as part of Munich protocol.
The format of Munich device protocol keys.
Keys are really uint32_t, but contain bitfields within them.
REAL state_t
The type of a state variable.
void rt_error(uint code,...)