diff --git a/obc-firmware/interfaceview.ui.xml b/obc-firmware/interfaceview.ui.xml index 36f92d7..a87d125 100644 --- a/obc-firmware/interfaceview.ui.xml +++ b/obc-firmware/interfaceview.ui.xml @@ -1,12 +1,42 @@ - + - + + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -14,7 +44,7 @@ - + @@ -32,27 +62,27 @@ - - - + + + - + - + - + - + - + - + - + - + @@ -62,7 +92,7 @@ - + @@ -110,35 +140,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/obc-firmware/interfaceview.xml b/obc-firmware/interfaceview.xml index bac1a88..c5c0a7d 100644 --- a/obc-firmware/interfaceview.xml +++ b/obc-firmware/interfaceview.xml @@ -1,146 +1,21 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + @@ -168,16 +43,16 @@ - + - + - + - + @@ -200,9 +75,9 @@ - + - + @@ -210,23 +85,23 @@ - + - + - + - + @@ -303,34 +178,144 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + @@ -338,19 +323,34 @@ - - - + + + - - - + + + - - - + + + + + + + + + + + + + + + + + + diff --git a/obc-firmware/obc-firmware.asn b/obc-firmware/obc-firmware.asn index 161d490..87c91e6 100644 --- a/obc-firmware/obc-firmware.asn +++ b/obc-firmware/obc-firmware.asn @@ -37,9 +37,9 @@ BEGIN -- myVar MySeqOf ::= { hello, world } ModeChangeTimedCounter ::= INTEGER (0 .. 3600000) -i-sensing-entry ModeChangeTimedCounter ::= 3 -i-sensing-progress ModeChangeTimedCounter ::= 9 -i-sensing-exit ModeChangeTimedCounter ::= 18 +i-sensing-entry ModeChangeTimedCounter ::= 10 +i-sensing-progress ModeChangeTimedCounter ::= 25 +i-sensing-exit ModeChangeTimedCounter ::= 30 OString ::= OCTET STRING (SIZE (0 .. 255)) diff --git a/obc-firmware/work/hal/implem/msp430/C/src/hal.c b/obc-firmware/work/hal/implem/msp430/C/src/hal.c index 87db08b..0d3aeda 100644 --- a/obc-firmware/work/hal/implem/msp430/C/src/hal.c +++ b/obc-firmware/work/hal/implem/msp430/C/src/hal.c @@ -1,12 +1,12 @@ /* Body file for function HAL - * Generated by TASTE on 2023-03-10 23:20:06 + * Generated by TASTE (kazoo/templates/skeletons/c-body/function.tmplt) * You can edit this file, it will not be overwritten - * Provided interfaces : get_temperature, led_blink - * Required interfaces : - * User-defined properties for this function: - * |_ Taste::Startup_Priority = 1 - * Timers : - */ + + !! IMPORTANT !! + !! When you modify your design (interface view), you must update !! + !! the procedures corresponding to the provided interfaces in this !! + !! file. The up-to-date signatures can be found in the header file. !! +*/ #include "hal.h" @@ -14,7 +14,17 @@ #include #include -#include "msp430_pwm.h" +#include +#include +#include +#include + +#include "msp430_i2c.h" + +#define pipeline_i2c_read_buffer_length 2 +bool pipeline_i2c_read_successful = false; +unsigned char pipeline_i2c_read_buffer[pipeline_i2c_read_buffer_length]; + void hal_startup( void ) { @@ -23,41 +33,86 @@ void hal_startup( void ) PM5CTL0 &= ~LOCKLPM5; // disable the GPIO power-on default high-impedance mode // to activate previously configured port settings - P1DIR |= 0x01; // Set P1.0 to output direction - P4DIR |= 0x40; // Set P4.6 to output direction - P4OUT &= ~0x40; // Unset P4.6 + P1DIR |= BIT0 | BIT3 | BIT4 | BIT5; // Set P1.0, 1.3, 1.4, 1.5 to output direction + P4DIR |= BIT6; // Set P4.6 to output direction + P4OUT &= ~BIT6; // Unset P4.6 - setup_pwm(2400); // set up PWM with a ~400ms period + msp430_i2c_init(); } void hal_PI_blink_led(void) { - P1OUT ^= 0x01; // Toggle P1.0 using XOR + P1OUT ^= BIT0; // Toggle P1.0 using XOR } void hal_PI_set_led( const asn1SccT_Boolean *IN_val ) { if (*IN_val) { - P4OUT |= 0x40; // Set P4.6 using OR + P4OUT |= BIT6; // Set P4.6 using OR } else { - P4OUT &= ~0x40; // Unset P4.6 using AND + P4OUT &= ~BIT6; // Unset P4.6 using AND } } -void hal_PI_send_camera_capture_image_pulse( void ) +void hal_PI_send_camera_idle_signal() { - pulse_single_width(2000); // 2.0ms pulse (periodic, needs pulse) + P1OUT ^= BIT3; } -void hal_PI_send_camera_toggle_usb_pulse( void ) +void hal_PI_send_camera_capture_image_pulse() { - pulse_single_width(1500); // 1.5ms pulse (periodic, needs pulse) + P1OUT ^= BIT4; } -void hal_PI_send_camera_idle_signal( void ) +void hal_PI_send_camera_toggle_usb_pulse() { - //set_pwm_pulse_width(1000); // 1.0ms pulses (periodic) + P1OUT ^= BIT5; +} + +void hal_PI_change_pipeline_mode( const asn1SccPipeline_Mode_T *IN_target_pipeline_mode ) +{ + P1OUT ^= BIT0; + if (*IN_target_pipeline_mode == asn1SccPipeline_Mode_T_pipeline_idle) + { + msp430_i2c_write_data(8, 'i', " ", 1); + } + else + { + msp430_i2c_write_data(8, 'p', " ", 1); + } + P1OUT ^= BIT0; + + pipeline_i2c_read_successful = msp430_i2c_read_data(8, 0x10, pipeline_i2c_read_buffer, pipeline_i2c_read_buffer_length); +} + +void hal_PI_check_pipeline_response_i2c() +{ + asn1SccPipeline_Mode_Status_Report_T *OUT_pipeline_report; + + if (pipeline_i2c_read_successful) + { + if (pipeline_i2c_read_buffer[0] == 'i') + { + OUT_pipeline_report->pipeline_mode = asn1SccPipeline_Mode_T_pipeline_idle; + } + else if (pipeline_i2c_read_buffer[0] == 'p') + { + OUT_pipeline_report->pipeline_mode = asn1SccPipeline_Mode_T_pipeline_processing_lp; + } + + if (pipeline_i2c_read_buffer[1] == 't') + { + OUT_pipeline_report->pipeline_last_op = asn1SccMode_Status_Operation_T_mode_status_change; + } + else if (pipeline_i2c_read_buffer[1] == 'f') + { + OUT_pipeline_report->pipeline_last_op = asn1SccMode_Status_Operation_T_mode_status_change; + } + + hal_RI_report_pipeline_mode_status(OUT_pipeline_report); + pipeline_i2c_read_successful = false; + } }