Skip to content

Commit

Permalink
Merge pull request #4 from floripasat/dev
Browse files Browse the repository at this point in the history
Drivers: Antenna: ISIS Antenna: Using I2C routines from DriverLib wit…
  • Loading branch information
mgm8 authored Apr 2, 2019
2 parents 8349a65 + 0f1493b commit 1e4b514
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 24 deletions.
11 changes: 4 additions & 7 deletions firmware/fsat_beacon_msp430/drivers/antenna/isis_antenna.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* \author Gabriel Mariano Marcelino <[email protected]>
*
* \version 0.2.12
* \version 0.4.0
*
* \date 20/09/2017
*
Expand All @@ -51,8 +51,7 @@ void isis_antenna_arm()
{
debug_print_event_from_module(DEBUG_INFO, ISIS_ANTENNA_MODULE_NAME, "Arming...\n\r");

uint8_t data = ISIS_ANTENNA_CMD_ARM;
isis_antenna_i2c_write_data(&data, 1);
isis_antenna_i2c_write_byte(ISIS_ANTENNA_CMD_ARM);

debug_print_event_from_module(DEBUG_INFO, ISIS_ANTENNA_MODULE_NAME, "Arming command transmitted!\n\r");

Expand All @@ -63,8 +62,7 @@ void isis_antenna_disarm()
{
debug_print_event_from_module(DEBUG_INFO, ISIS_ANTENNA_MODULE_NAME, "Disarming...\n\r");

uint8_t data = ISIS_ANTENNA_CMD_DISARM;
isis_antenna_i2c_write_data(&data, 1);
isis_antenna_i2c_write_byte(ISIS_ANTENNA_CMD_DISARM);

isis_antenna_delay_ms(100);
}
Expand Down Expand Up @@ -153,8 +151,7 @@ isis_antenna_status_t isis_antenna_read_deployment_status()
{
uint16_t status_code = ISIS_ANTENNA_STATUS_MASK; // Initial state

uint8_t data = ISIS_ANTENNA_CMD_REPORT_DEPLOY_STATUS;
isis_antenna_i2c_write_data(&data, 1);
isis_antenna_i2c_write_byte(ISIS_ANTENNA_CMD_REPORT_DEPLOY_STATUS);

isis_antenna_delay_ms(1000);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* \author Gabriel Mariano Marcelino <[email protected]>
*
* \version 0.2.12
* \version 0.4.0
*
* \date 21/09/2017
*
Expand Down Expand Up @@ -56,6 +56,7 @@

#define ISIS_ANTENNA_I2C_CLOCK UCS_getSMCLK()

#define ISIS_ANTENNA_I2C_TIMEOUT 10000
#define ISIS_ANTENNA_I2C_TIMEOUT_MS 100

#endif // ISIS_ANTENNA_CONFIG_H_
Expand Down
28 changes: 14 additions & 14 deletions firmware/fsat_beacon_msp430/drivers/antenna/isis_antenna_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* \author Gabriel Mariano Marcelino <[email protected]>
*
* \version 0.2.13
* \version 0.4.0
*
* \date 21/09/2017
*
Expand Down Expand Up @@ -98,7 +98,7 @@ void isis_antenna_i2c_write_byte(uint8_t byte)
USCI_A_I2C_setMode(ISIS_ANTENNA_I2C_BASE_ADDRESS, USCI_A_I2C_TRANSMIT_MODE);

// Send single byte data
USCI_A_I2C_masterSendSingleByte(ISIS_ANTENNA_I2C_BASE_ADDRESS, byte);
USCI_A_I2C_masterSendSingleByteWithTimeout(ISIS_ANTENNA_I2C_BASE_ADDRESS, byte, ISIS_ANTENNA_I2C_TIMEOUT);

// Wait until transmission completes
uint16_t timeout_ms = ISIS_ANTENNA_I2C_TIMEOUT_MS;
Expand All @@ -118,7 +118,7 @@ void isis_antenna_i2c_write_byte(uint8_t byte)
USCI_B_I2C_setMode(ISIS_ANTENNA_I2C_BASE_ADDRESS, USCI_B_I2C_TRANSMIT_MODE);

// Send single byte data
USCI_B_I2C_masterSendSingleByte(ISIS_ANTENNA_I2C_BASE_ADDRESS, byte);
USCI_B_I2C_masterSendSingleByteWithTimeout(ISIS_ANTENNA_I2C_BASE_ADDRESS, byte, ISIS_ANTENNA_I2C_TIMEOUT);

// Wait until transmission completes
uint16_t timeout_ms = ISIS_ANTENNA_I2C_TIMEOUT_MS;
Expand All @@ -141,29 +141,29 @@ void isis_antenna_i2c_write_data(uint8_t *data, uint8_t len)
#if ISIS_ANTENNA_I2C_USCI == USCI_A
// Set in transmit mode
USCI_A_I2C_setMode(ISIS_ANTENNA_I2C_BASE_ADDRESS, USCI_A_I2C_TRANSMIT_MODE);
USCI_A_I2C_masterSendMultiByteStart(ISIS_ANTENNA_I2C_BASE_ADDRESS, data[0]);

USCI_A_I2C_masterSendMultiByteStartWithTimeout(ISIS_ANTENNA_I2C_BASE_ADDRESS, data[0], ISIS_ANTENNA_I2C_TIMEOUT);

uint8_t i = 1;
for(i=1; i<len; i++)
{
USCI_A_I2C_masterSendMultiByteNext(ISIS_ANTENNA_I2C_BASE_ADDRESS, data[i]);
USCI_A_I2C_masterSendMultiByteNextWithTimeout(ISIS_ANTENNA_I2C_BASE_ADDRESS, data[i], ISIS_ANTENNA_I2C_TIMEOUT);
}

USCI_A_I2C_masterSendMultiByteStop(ISIS_ANTENNA_I2C_BASE_ADDRESS);
#elif ISIS_ANTENNA_I2C_USCI == USCI_B
// Set in transmit mode
USCI_B_I2C_setMode(ISIS_ANTENNA_I2C_BASE_ADDRESS, USCI_B_I2C_TRANSMIT_MODE);
USCI_B_I2C_masterSendMultiByteStart(ISIS_ANTENNA_I2C_BASE_ADDRESS, data[0]);

USCI_B_I2C_masterSendMultiByteStartWithTimeout(ISIS_ANTENNA_I2C_BASE_ADDRESS, data[0], ISIS_ANTENNA_I2C_TIMEOUT);

uint8_t i = 1;
for(i=1; i<len; i++)
{
USCI_B_I2C_masterSendMultiByteNext(ISIS_ANTENNA_I2C_BASE_ADDRESS, data[i]);
USCI_B_I2C_masterSendMultiByteNextWithTimeout(ISIS_ANTENNA_I2C_BASE_ADDRESS, data[i], ISIS_ANTENNA_I2C_TIMEOUT);
}
USCI_B_I2C_masterSendMultiByteStop(ISIS_ANTENNA_I2C_BASE_ADDRESS);

USCI_B_I2C_masterSendMultiByteStopWithTimeout(ISIS_ANTENNA_I2C_BASE_ADDRESS, ISIS_ANTENNA_I2C_TIMEOUT);
#endif // ISIS_ANTENNA_I2C_USCI
}

Expand Down
4 changes: 2 additions & 2 deletions firmware/fsat_beacon_msp430/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* \author Gabriel Mariano Marcelino <[email protected]>
*
* \version 0.3.5
* \version 0.4.0
*
* \date 08/02/2019
*
Expand All @@ -36,7 +36,7 @@
#ifndef VERSION_H_
#define VERSION_H_

#define FIRMWARE_VERSION "0.3.5"
#define FIRMWARE_VERSION "0.4.0"

#define FIRMWARE_STATUS "Development"

Expand Down

0 comments on commit 1e4b514

Please sign in to comment.