User Tools

Site Tools


en:libschsat

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:libschsat [2018/01/25 15:11]
ashley
en:libschsat [2020/01/20 12:51]
golikov
Line 1: Line 1:
-**Description of the standard construction set functions library \\  +====== C Function Libraries ======
-// libschsat.h (1.01)//**+
  
-For devices whose number is not marked on the body the default number is 1.+**Description of C Function Libraries** ​
  
 +Functions described below are used for interaction with Orbicraft construction set subsystems by programs written in C.
 +
 +<note tip>
 +**//The default number for devices with no number indicated on their housing is 1.//**
 +</​note>​
 +
 +**Standard return codes generated by library functions**
   #define LSS_OK 0    #define LSS_OK 0 
   #define LSS_ERROR 1    #define LSS_ERROR 1 
   #define LSS_BREAK 2   #define LSS_BREAK 2
-Standard codes returned by library functions: 
  
 +**Orbiter power system (OPS)**
   float battery_get_charge(void);​   float battery_get_charge(void);​
-The function returns ​the current charge of the virtual ​ ​[[power_subsys|PSS]] ​(mA*h) +Returns ​the current charge ​level of the virtual ​OPS (mA*h)
   float battery_get_discharging_current(void); ​   float battery_get_discharging_current(void); ​
-The function returns ​the current ​discharge current ​of the  ​[[power_subsys|PSS]] ​(mA)+Returns ​the current ​value of current in the virtual OPS circuit ​(mA)
  
-  int camera_get_state(void);​  +**Magnetometer**
-The function returns the current [[camera_subsys|camera]] status (on/off)+
  
-  int camera_turn_off(void); +  int magnetometer_get_state(uint16_t num); 
-Turns off [[camera_subsys|the camera ]] to reduce power consumption+Returns the current magnetometer state (on/off
 +  int magnetometer_request_raw(uint16_t num,int16_t *pRAW_dataX,​int16_t *pRAW_dataY,​int16_t *pRAW_dataZ);​  
 +   
 +Returns LSS_OK and writes current readings of the magnetometer ID num in the pRAW_dataX - pRAW_dataZ variables
  
-  int camera_turn_on(void);​ +Returns LSS_ERROR if errors occurred ​on the bus
-Turns on [[camera_subsys|the camera]] ​+
  
-  int hyro_get_state(uint16_t num); +Returns LSS_BREAK if the magnetometer is powered down 
-The function returns ​the current status of [[w_subsys|the AVS]] (on/off)+
  
-  int hyro_request_raw(uint16_t num,​int16_t ​*pRAW_dataX,​int16_t ​*pRAW_dataY,​int16_t *pRAW_dataZ);​  +<note tip> 
-The function returns LSS_OK ​and writes ​the current readings of [[w_subsys|the AVS]] number ​**num** to the variables pRAW_dataX - pRAW_dataZ \\ +**//The returned value is scaled at 1100 RAW units per Gauss along X and Y axes, 980 RAW units per Gauss along the Z axis.//** 
-In case of errors on the bus, the function returns LSS_ERROR \\ +</note>
-In case of a power failure, [[w_subsys|the AVS]] function returns LSS_BREAK ​\\   +
-The angular velocity determined by the sensor is 0.00875 degrees/second per unit RAW+
  
-  int hyro_request_reset(uint16_t num); 
-Reboots [[w_subsys|the AVS]] number **num** 
- 
-  int hyro_turn_off(uint16_t num); 
-Turns off [[w_subsys|the AVS]] number **num** to reduce power consumption 
- 
-  int hyro_turn_on(uint16_t num); 
-Turn on [[w_subsys|the AVS]] number **num** 
- 
-  int laser_get_state(uint16_t num);  
-The function returns the current state of [[hf_tx_subsys|the HF transmitter]] (on/off) 
-  ​ 
-  int magnetometer_get_state(uint16_t num); 
-The function returns the current state of [[mag_subsys|the magnetometer]] ​ (on/off) 
- 
-  int magnetometer_request_raw(uint16_t num,int16_t *pRAW_dataX,​int16_t *pRAW_dataY,​int16_t *pRAW_dataZ); ​ 
-The function returns LSS_OK and writes the current readings of [[mag_subsys|the magnetometer]] number **num** to the variables pRAW_dataX - pRAW_dataZ \\ 
-In case of errors on the bus, the function returns LSS_ERROR \\ 
-In case of a power failure, [[mag_subsys|the magnetometer]] function returns LSS_BREAK ​\\  
-The return value contains: - 1100 RAW units per Gauss along the X and Y axes, 980 RAW units per Gauss along Z-axis 
-  ​ 
   int magnetometer_request_reset(uint16_t num);    int magnetometer_request_reset(uint16_t num); 
-Reboots ​[[mag_subsys|the magnetometer]] number **num** +Reboots the magnetometer num
   int magnetometer_turn_off(uint16_t num);   int magnetometer_turn_off(uint16_t num);
-Turns off [[mag_subsys|the magnetometer]] number **num** to reduce power consumption +Turns off the magnetometer num
   int magnetometer_turn_on(uint16_t num);   int magnetometer_turn_on(uint16_t num);
-Turns on [[mag_subsys|the magnetometer]] number ​**num**+Turns on the magnetometer ​ID **num**
  
-  int motor_get_state(uint16_t num)+**Angular Velocity Sensor ​(AVS)**
-The function returns current state of [[wheel_subsys|the flywheel]] number ​**num** (on/off)+
  
-  int motor_request_reset(uint16_t num); +  int hyro_get_state(uint16_t num); 
-Reboots [[wheel_subsys|the flywheel]] number **num**+Returns ​the current AVS state (on/off) 
 +  int hyro_request_raw(uint16_t ​num,​int16_t ​*pRAW_dataX,​int16_t ​*pRAW_dataY,​int16_t *pRAW_dataZ);​  
 +   
 +Returns LSS_OK and writes current readings of the AVS identified with num in the pRAW_dataX - pRAW_dataZ variables
  
-  int motor_request_speed(uint16_t num,int16_t *pRPM);  +Returns LSS_ERROR if errors ​occurred ​on the bus
-The function returns LSS_OK and writes the current speed of [[wheel_subsys|the flywheel]] number **num** to the variable pRPM \\ +
-In case of errors on the bus, the function returns LSS_ERROR \\ +
-In case of power failure, [[wheel_subsys|the flywheel]] function returns LSS_BREAK ​\\  ​+
  
 +Returns LSS_BREAK if the AVS is powered down 
  
-  int motor_set_speed(uint16_t num,int16_t RPM,int16_t *confirm); +<note tip> 
-The function returns LSS_OK and writes the target speed for  [[wheel_subsys|the flywheel]] number ​**num**  in the variable ​**confirm** and sets this speed to the flywheel \\ +**//Readings of angular velocity provided by the sensor are scaled at 0.00875 deg/s per one RAW unit.//** 
-In case of errors on the bus, the function returns LSS_ERROR\\  +</​note>​
-In case of a power failure, [[wheel_subsys|the flywheel]] function returns LSS_BREAK ​+
  
-  int motor_turn_off(uint16_t num);  +  int hyro_request_reset(uint16_t num); 
-Turns off [[wheel_subsys|the flywheel]] number **num** to reduce power consumption ​(short-term turning off and on is not recommended)+Reboots the AVS num 
 +  int hyro_turn_off(uint16_t num); 
 +Turns off the AVS num 
 +  int hyro_turn_on(uint16_t num)
 +Turns on the AVS num
  
-  int motor_turn_on(uint16_t num);  +**Solar Sensor**
-Turns on [[wheel_subsys|the flywheel]] number ​**num** +
  
-  int receiver_request_reset(uint16_t num);  +  int sun_sensor_get_state(uint16_t num); 
-Reboots [[uhf_tx_subsys|the telemetry transmitter]] number **num**+Returns ​the current state (on/off) of the solar sensor ​num 
 +  int sun_sensor_request_maxraw(uint16_t num, uint16_t ​*pMAXRAW_data1,​ uint16_t ​*pMAXRAW_data2);​  
 +   
 +Returns LSS_OK and records current maximum readings of the solar sensor ID num into pMAXRAW_data1 and pMAXRAW_data2 variables. A maximum is defined as the maximum value ever detected by the sensor since last reboot
  
-  int receiver_request_state(uint16_t num,float *quality);  +Returns LSS_ERROR if errors occurred on the bus
-The function returns ​the current state of [[uhf_tx_subsys|the telemetry transmitter]] number **num** (on/off)+
  
-  int bus_setup(void);​ +Returns LSS_BREAK if the magnetometer ​is powered down
-Prepares all devices on the bus to receive information. By default, devices after turning on or rebooting start the exchange only after at least one sending ​is complete on the bus (for any device), this function simply sends an empty message addressed to all. +
- +
-  int sun_sensor_get_state(uint16_t num);  +
-The function returns current state of [[sun_subsys|the solar sensor]] number **num** (on/off) +
- +
-  int sun_sensor_request_maxraw(uint16_t num, uint16_t *pMAXRAW_data1,​ uint16_t *pMAXRAW_data2);​  +
-The function returns LSS_OK and writes the current maximums of  [[sun_subsys| the solar sensor]] number **num** in the variables pMAXRAW_data1 and pMAXRAW_data2. Maximum is the maximum reading that the sensor has ever detected since the reset.\\ +
-In case of errors on bus the function returns LSS_ERROR\\ +
-In case of no power on [[sun_subsys|the solar sensor]] the function returns LSS_BREAK ​+
  
   int sun_sensor_request_raw(uint16_t num, uint16_t *pRAW_data1,​ uint16_t *pRAW_data2); ​   int sun_sensor_request_raw(uint16_t num, uint16_t *pRAW_data1,​ uint16_t *pRAW_data2); ​
-The function returns ​LSS_OK and writes ​the current readings of  ​[[sun_subsys| ​the solar sensor]] number **num** in the variables ​pRAW_data1 and pRAW_data2. \\ +Returns ​LSS_OK and writes current readings of the solar sensor num in the pRAW_data1 and pRAW_data2 ​variables
-In case of errors on bus the function returns LSS_ERROR\\ +
-In case of no power on [[sun_subsys|the solar sensor]] the function returns LSS_BREAK ​+
  
-  int sun_sensor_request_reset(uint16_t num);  +Returns LSS_ERROR if errors occurred on the bus
-Reboot [[sun_subsys|the solar sensor]] number **num**+
  
-  int sun_sensor_set_calibrate(uint16_t num,uint8_t mode);  +Returns LSS_BREAK if the solar sensor is powered down
-Not used+
  
-  int sun_sensor_set_minvalue(uint16_t num,​uint16_t value); ​+  ​int sun_sensor_request_reset(uint16_t num); 
 +Reboots the solar sensor num 
 + int sun_sensor_set_calibrate(uint16_t num,uint8_t mode); 
 +Not used 
 + int sun_sensor_set_minvalue(uint16_t num,​uint16_t value); ​
 Not used Not used
- 
   int sun_sensor_turn_off(uint16_t num);   int sun_sensor_turn_off(uint16_t num);
-Turn off [[sun_subsys|the solar sensor]] number **num** to reduce power consumtion+Reboots the solar sensor num 
 +  int sun_sensor_turn_on(uint16_t num); 
 +Turns on the solar sensor num
  
-  ​int sun_sensor_turn_on(uint16_t num);  +**Reaction wheel** 
-Turn on [[sun_subsys|the solar sensor]] number **num**+  ​int motor_get_state(uint16_t num); 
 +Returns the current state (on/off) of the reaction wheel num 
 +  int motor_request_reset(uint16_t num); 
 +Reboots the wheel num 
 +  int motor_request_speed(uint16_t num,​int16_t ​*pRPM); 
 +Returns LSS_OK and writes the current speed of the wheel num in the pRPM variable 
 +Returns LSS_ERROR if errors occurred on the bus 
 +Returns LSS_BREAK if the wheel is powered down 
 +  int motor_set_speed(uint16_t ​num,int16_t RPM,​int16_t ​*confirm); 
 +Returns LSS_OK and writes the specified speed of the wheel num in the confirm variable, setting the wheel to run at this speed 
 +Returns LSS_ERROR if errors occurred on the bus 
 +Returns LSS_BREAK if the wheel is powered down 
 +  int motor_turn_off(uint16_t num); 
 +Turns off the wheel num (turning off and on intermittently is not recommended!) 
 +  int motor_turn_on(uint16_t num); 
 +Turns of the wheel num
  
-  ​int camera_take_photo(uint16_t num);  +**Earth Observation Camera** 
-This function sends signal to [[camera_subsys|the camera]] to take a photo and records the photo in the cell number **num**+  int camera_get_state(void);​  
 +Returns the current state of the camera (on/off) 
 +  int camera_turn_off(void);​ 
 +Turns off the camera 
 +  int camera_turn_on(void);​ 
 +Turns on the camera 
 +  ​int camera_take_photo(uint16_t num); 
 +Takes picture with the camera, storing it in cell indexed with num
  
-  ​int transceiver_get_state(uint16_t num);  +**HF Radio Link** 
-The function returns ​the current ​status ​of [[uhf_tx_subsys|the telemetry ​transmitter]] numer **num** ​(on/off)+  ​int transmitter_get_state(uint16_t num); 
 +Returns ​the current ​state of the HF transmitter (on/off) 
 +  int transmitter_transmit_photo(uint16_t num, uint16_t nPhoto); 
 +Transfers the photograph from the cell of the camera ID nPhoto using the HF transmitter num to the HF receiver (to Earth) 
 +  int transmitter_request_reset(uint16_t num); 
 +Reboots the HF transmitter num 
 +  int transmitter_turn_off(uint16_t num); 
 +Turn off the HF transmitter num 
 +  int transmitter_turn_on(uint16_t num); 
 +Turn on the HF transmitter num
  
-  ​int transceiver_request_buff(uint16_t num,uint8_t *data);+**VHF/UHF Radio Link** 
 +  int transceiver_get_state(uint16_t num); 
 +Returns the current state (on/off) of the telemetry transmitter num 
 + int transceiver_request_buff(uint16_t num,uint8_t *data);
 Not used Not used
- +  ​int transceiver_request_reset(uint16_t num); 
-  ​int transceiver_request_reset(uint16_t num);  +Reboots ​the telemetry transmitter num 
-Reboot [[uhf_tx_subsys|the telemetry transmitter]] number **num** +  int transceiver_send(uint16_t tx_num,​uint16_t rx_num,​const uint8_t *data,​uint16_t len); 
- +Transfers ​a data packet ​containing ​data of length len from the telemetry transmitter ​ID tx_num to the telemetry receiver ​ID rx_num (to the ground)
-  int transceiver_send(uint16_t tx_num,​uint16_t rx_num,​const uint8_t *data,​uint16_t len);  +
-Sends a data packet ​with **data** length ​**len** from [[uhf_tx_subsys|the telemetry transmitter]] number **tx_num** to [[uhf_rx_subsys|the telemetry receiver]] number **rx_num** (to the Earth +
   int transceiver_turn_off(uint16_t num);   int transceiver_turn_off(uint16_t num);
-Turn off [[uhf_tx_subsys|the telemetry ​transmitter]] number **num** to reduce ​power consumption+Turns off the telemetry ​receiver ​num to conserve ​power 
 +  int transceiver_turn_on(uint16_t num); 
 +Turns on telemetry transmitter num
  
-  int transceiver_turn_on(uint16_t num);  +**General-Purpose Functions**
-Turn on [[uhf_tx_subsys|the telemetry transmitter]] number ​**num**+
  
-  int transmitter_transmit_photo(uint16_t num, uint16_t nPhoto);  + void dump_buffer(uint8_t *buf,size_t len);
-Sends a photo from [[camera_subsys|the camera]] cell number **nPhoto** using [[hf_tx_subsys|the HF transmitter]] number **num** to [[hf_rx_subsys|the HF receiver]] (to the Earth) +
- +
-  int transmitter_request_reset(uint16_t num); +
-Reboot [[hf_tx_subsys|the HF transmitter]] number **num** +
- +
-  int transmitter_turn_off(uint16_t num);  +
-Turn off [[hf_tx_subsys|the HF transmitter]] number **num** to reduce power consumption +
- +
-  int transmitter_turn_on(uint16_t num); +
-Turn on [[hf_tx_subsys|the HF transmitter]] number **num** +
- +
-  void dump_buffer(uint8_t *buf,size_t len);+
 Not used Not used
 +  void mSleep(int msec);
 +Pauses the program for msec milliseconds
 +  void Sleep(int sec);
 +Pauses the program for sec seconds
 +  int bus_setup(void);​
 +  ​
 +Sets up all devices on the bus to receive data. By default, upon power-on or reboot, devices may only commence data transfer after at least one transaction on the bus is completed (with any device). This function simply broadcasts a null message.
  
-  void mSleep(int msec); ​ 
-Pause in the program for **msec** milliseconds 
- 
-  void Sleep(int sec); 
-Pause in the program for **sec** seconds 
  
en/libschsat.txt · Last modified: 2020/03/25 16:28 (external edit)