User Tools

Site Tools


en:libschsat

Differences

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

Link to this comparison view

en:libschsat [2020/01/20 12:51]
golikov
en:libschsat [2020/03/25 16:28]
Line 1: Line 1:
-====== C Function Libraries ====== 
- 
-**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_ERROR 1  
-  #define LSS_BREAK 2 
- 
-**Orbiter power system (OPS)** 
-  float battery_get_charge(void);​ 
-Returns the current charge level of the virtual OPS (mA*h) 
-  float battery_get_discharging_current(void); ​ 
-Returns the current value of current in the virtual OPS circuit (mA) 
- 
-**Magnetometer** 
- 
-  int magnetometer_get_state(uint16_t num); 
-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 
- 
-Returns LSS_ERROR if errors occurred on the bus 
- 
-Returns LSS_BREAK if the magnetometer is powered down  
- 
-<note tip> 
-**//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.//** 
-</​note>​ 
- 
-  int magnetometer_request_reset(uint16_t num);  
-Reboots the magnetometer num 
-  int magnetometer_turn_off(uint16_t num); 
-Turns off the magnetometer num 
-  int magnetometer_turn_on(uint16_t num); 
-Turns on the magnetometer ID **num** 
- 
-**Angular Velocity Sensor (AVS)** 
- 
-  int hyro_get_state(uint16_t 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 
- 
-Returns LSS_ERROR if errors occurred on the bus 
- 
-Returns LSS_BREAK if the AVS is powered down  
- 
-<note tip> 
-**//​Readings of angular velocity provided by the sensor are scaled at 0.00875 deg/s per one RAW unit.//** 
-</​note>​ 
- 
-  int hyro_request_reset(uint16_t num); 
-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 
- 
-**Solar Sensor** 
- 
-  int sun_sensor_get_state(uint16_t 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 
- 
-Returns LSS_ERROR if errors occurred on the bus 
- 
-Returns LSS_BREAK if the magnetometer is powered down 
- 
-  int sun_sensor_request_raw(uint16_t num, uint16_t *pRAW_data1,​ uint16_t *pRAW_data2); ​ 
-Returns LSS_OK and writes current readings of the solar sensor num in the pRAW_data1 and pRAW_data2 variables 
- 
-Returns LSS_ERROR if errors occurred on the bus 
- 
-Returns LSS_BREAK if the solar sensor is powered down 
- 
-  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 
-  int sun_sensor_turn_off(uint16_t num); 
-Reboots the solar sensor num 
-  int sun_sensor_turn_on(uint16_t num); 
-Turns on the solar sensor num 
- 
-**Reaction wheel** 
-  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 
- 
-**Earth Observation Camera** 
-  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 a picture with the camera, storing it in a cell indexed with num 
- 
-**HF Radio Link** 
-  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 
- 
-**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 
-  int transceiver_request_reset(uint16_t num); 
-Reboots the telemetry transmitter 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_turn_off(uint16_t num); 
-Turns off the telemetry receiver num to conserve power 
-  int transceiver_turn_on(uint16_t num); 
-Turns on telemetry transmitter num 
- 
-**General-Purpose Functions** 
- 
- void dump_buffer(uint8_t *buf,size_t len); 
-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. 
- 
  
en/libschsat.txt · Last modified: 2020/03/25 16:28 (external edit)