Skip to content

Commit

Permalink
Fixed Typos
Browse files Browse the repository at this point in the history
  • Loading branch information
avtoku committed Aug 23, 2024
1 parent b955546 commit 31032f2
Show file tree
Hide file tree
Showing 32 changed files with 55 additions and 64 deletions.
8 changes: 2 additions & 6 deletions common/CommonConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,12 @@
#define DATA_RAM __attribute__((section(".data"))) __attribute__((aligned(32))) static

/////////////////////////////////////////////////////////////////////////////////////////////
// MiddleWare name : AL94.I-CUBE-USBD-COMPOSITE.1.0.3
// USB MiddleWare
//
#define VCP_Transmit(buffer, length) CDC_Transmit(0, buffer, length)
//#define _USBD_USE_HS false
//extern PCD_HandleTypeDef hpcd_USB_OTG_FS; // USB FS (48 MB/s)

#define _USBD_USE_CDC_ACM true // /dev/ttyACM* device type
#define _USBD_USE_CDC_ACM true
#define _USBD_CDC_ACM_COUNT 1
//
// End MiddleWare name : AL94.I-CUBE-USBD-COMPOSITE.1.0.3
/////////////////////////////////////////////////////////////////////////////////////////////

#define EPOCH_HZ (400)
Expand Down
10 changes: 9 additions & 1 deletion common/Varmint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,15 @@ void Varmint::serial_flush(void)
//////////////////////////////////////////////////////////////////////////////////////////////////

// Report any initialization errors
void Varmint::sensors_init() { sensor_errors_ = 0; }
void Varmint::sensors_init()
{
sensor_errors_ = 0;

for(uint32_t i=0;i<varmint.status_len();i++ )
{
if(varmint.status(i)->status() != DRIVER_OK)sensor_errors_++;
}
}

uint16_t Varmint::num_sensor_errors() { return sensor_errors_; }

Expand Down
5 changes: 5 additions & 0 deletions common/Varmint.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,17 @@ class Varmint : public rosflight_firmware::Board
private:
uint32_t serial_device_;
uint32_t sensor_errors_ = 0;
uint32_t status_len_ = 0;
Status *status_list_[STATUS_LIST_MAX_LEN];

public:
Varmint(){};

INTERFACE_LIST

Status* status(uint32_t n) { return status_list_[n];}
uint32_t status_len(void) { return status_len_;}

////////////////////////////////////////////////////////////////////////////////
// Required ROSflight Board HAL functions:

Expand Down
2 changes: 1 addition & 1 deletion common/drivers/Adc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ uint32_t Adc::init(uint16_t sample_rate_hz, ADC_HandleTypeDef * hadc_ext,
ADC_TypeDef * adc_instance_int // This ADC has the calibration values
)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "Adc");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "Adc");
initializationStatus_ = DRIVER_OK;
sampleRateHz_ = sample_rate_hz;
hadcExt_ = hadc_ext;
Expand Down
2 changes: 1 addition & 1 deletion common/drivers/Adis165xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ uint32_t Adis165xx::init(
uint16_t reset_pin, // Reset GPIO Pin
TIM_HandleTypeDef * htim, TIM_TypeDef * htim_instance, uint32_t htim_channel, uint32_t htim_period_us)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "Adis165xx");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "Adis165xx");
initializationStatus_ = DRIVER_OK;
sampleRateHz_ = sample_rate_hz;
drdyPort_ = drdy_port;
Expand Down
2 changes: 1 addition & 1 deletion common/drivers/Bmi088.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ uint32_t Bmi088::init(
uint8_t range_g // 0,1,2,3,4 --> 2000,1000,500,250,125 deg/s
)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "Bmi088");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "Bmi088");
initializationStatus_ = DRIVER_OK;
sampleRateHz_ = sample_rate_hz;
drdyPort_ = drdy_port;
Expand Down
4 changes: 1 addition & 3 deletions common/drivers/ByteFifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@
class ByteFifo : public Status
{
public:
ByteFifo() { initializationStatus_ = DRIVER_NOT_INITIALIZED; }
bool initGood(void) { return initializationStatus_ == DRIVER_OK; }

void init(uint16_t buffer_size, uint8_t * buffer)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "ByteFifo");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "ByteFifo");
if (buffer == NULL) {
bufferSize_ = 0;
buffer_ = buffer;
Expand Down Expand Up @@ -107,7 +106,6 @@ class ByteFifo : public Status
volatile uint8_t *head_, *tail_;
volatile uint8_t *buffer_, *bufferEnd_;
uint32_t bufferSize_ = 0;
uint32_t initializationStatus_ = DRIVER_NOT_INITIALIZED;
};

#endif /* BYTEFIFO_H_ */
2 changes: 1 addition & 1 deletion common/drivers/DlhrL20G.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ uint32_t DlhrL20G::init(
I2C_HandleTypeDef * hi2c, uint16_t i2c_address // I2C initializers
)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "DlhrL20G");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "DlhrL20G");
initializationStatus_ = DRIVER_OK;
sampleRateHz_ = sample_rate_hz;
drdyPort_ = drdy_port;
Expand Down
2 changes: 1 addition & 1 deletion common/drivers/Dps310.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ uint32_t Dps310::init(
// Mode
bool three_wire)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "Dps310");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "Dps310");
initializationStatus_ = DRIVER_OK;

sampleRateHz_ = sample_rate_hz;
Expand Down
2 changes: 1 addition & 1 deletion common/drivers/Eng094x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ uint32_t Eng094x::init(
uint16_t cs_pin, // Chip Select GPIO Pin
eng094x_press type)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "Eng094x");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "Eng094x");
initializationStatus_ = DRIVER_OK;
sampleRateHz_ = sample_rate_hz;
drdyPort_ = drdy_port;
Expand Down
2 changes: 1 addition & 1 deletion common/drivers/Iis2mdc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ uint32_t Iis2mdc::init(
uint16_t cs_pin // Chip Select GPIO Pin
)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "Iis2mdc");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "Iis2mdc");
initializationStatus_ = DRIVER_OK;
sampleRateHz_ = sample_rate_hz;
drdyPort_ = drdy_port;
Expand Down
2 changes: 1 addition & 1 deletion common/drivers/Ist8308.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ uint32_t Ist8308::init(
// I2C initializers
I2C_HandleTypeDef * hi2c, uint16_t i2c_address)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "Ist8308");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "Ist8308");
initializationStatus_ = DRIVER_OK;
sampleRateHz_ = sample_rate_hz;

Expand Down
5 changes: 1 addition & 4 deletions common/drivers/Mcp4017.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,12 @@ class Mcp4017 : public Status
*
*/
public:
Mcp4017() { initializationStatus_ = DRIVER_NOT_INITIALIZED; }

uint32_t init(I2C_HandleTypeDef * hi2c, // The SPI handle
uint16_t i2c_address, // Chip select Port
double v // voltage
)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "Mcp4017");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "Mcp4017");
initializationStatus_ = DRIVER_OK;

hi2c_ = hi2c;
Expand Down Expand Up @@ -98,7 +96,6 @@ class Mcp4017 : public Status
uint8_t pot_;
I2C_HandleTypeDef * hi2c_; // The SPI handle
uint16_t address_; // Chip select Port
uint32_t initializationStatus_ = 0;
};

#endif /* DRIVERS_MCP4017_H_ */
2 changes: 1 addition & 1 deletion common/drivers/Ms4525.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ uint32_t Ms4525::init(
uint16_t i2c_address // Chip select Port
)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "Ms4525");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "Ms4525");
initializationStatus_ = DRIVER_OK;
sampleRateHz_ = sample_rate_hz;

Expand Down
6 changes: 1 addition & 5 deletions common/drivers/PacketFifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,9 @@ typedef struct
class PacketFifo : public Status
{
public:
PacketFifo() { initializationStatus_ = DRIVER_NOT_INITIALIZED; }
bool initGood(void) { return initializationStatus_ == DRIVER_OK; }

void init(uint16_t max_packets, uint16_t max_data_size, uint8_t * buffer_head)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "PacketFifo");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "PacketFifo");
initializationStatus_ = DRIVER_OK;
if (buffer_head == NULL) // Maybe check for a valid range?
{
Expand Down Expand Up @@ -150,7 +147,6 @@ class PacketFifo : public Status

volatile uint32_t bufferSize_;
Packet packet_[PACKET_FIFO_MAX_BUFFERS];
uint32_t initializationStatus_ = DRIVER_NOT_INITIALIZED;
};

#endif /* PACKETFIFO_H_ */
2 changes: 1 addition & 1 deletion common/drivers/Pwm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void Pwm::updateConfig(const float * rate, uint32_t channels)

uint32_t Pwm::init(void)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "Pwm");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "Pwm");
initializationStatus_ = DRIVER_OK;

block_ = pwm_init;
Expand Down
4 changes: 0 additions & 4 deletions common/drivers/Pwm.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ typedef struct __attribute__((__packed__))
class Pwm : public Status
{
public:
Pwm() { initializationStatus_ = DRIVER_NOT_INITIALIZED; }
bool initGood(void) { return initializationStatus_ == DRIVER_OK; }

uint32_t init(void);
void updateConfig(const float * rate, uint32_t channels);

Expand Down Expand Up @@ -212,7 +209,6 @@ class Pwm : public Status
uint32_t chan_[PWM_CHANNELS];
uint32_t (*dmaBuf_)[PWM_DMA_BUFFER_LEN];
uint32_t blockIndex_[PWM_CHANNELS];
uint32_t initializationStatus_ = 0;
};

#endif /* PWM_H_ */
2 changes: 1 addition & 1 deletion common/drivers/Sbus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ uint32_t Sbus::init(
// UART initializers
UART_HandleTypeDef * huart, USART_TypeDef * huart_instance, DMA_HandleTypeDef * hdma_uart_rx, uint32_t baud)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "Sbus");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "Sbus");
initializationStatus_ = DRIVER_OK;
sampleRateHz_ = sample_rate_hz;
drdyPort_ = 0; // do not use
Expand Down
2 changes: 1 addition & 1 deletion common/drivers/Sd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ DMA_RAM uint8_t sd_tx_buf[SD_BUFF_SIZE];

uint32_t Sd::init(SD_HandleTypeDef * hsd, SD_TypeDef * hsd_instance)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "Sd");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "Sd");
initializationStatus_ = DRIVER_OK;
hsd_ = hsd;
hsd_->Instance = hsd_instance;
Expand Down
4 changes: 1 addition & 3 deletions common/drivers/Sd.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,13 @@ class Sd : public Status
*
*/
public:
Sd() { initializationStatus_ = DRIVER_NOT_INITIALIZED; }
bool initGood(void) { return initializationStatus_ == DRIVER_OK; }
uint32_t init(SD_HandleTypeDef * hsd, SD_TypeDef * hsd_instance);
bool read(uint8_t * dest, size_t len);
bool write(uint8_t * src, size_t len);

private:
SD_HandleTypeDef * hsd_;
uint32_t initializationStatus_ = 0;

};

#endif /* SD_H_ */
4 changes: 1 addition & 3 deletions common/drivers/Spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,14 @@ class Spi : public Status
SPI_HandleTypeDef * hspi_;
uint8_t * txBuffer_;
uint8_t * rxBuffer_;
uint32_t initializationStatus_ = DRIVER_NOT_INITIALIZED;

public:
// uint16_t size_;
GPIO_TypeDef * port_;
uint16_t pin_;
uint32_t init(SPI_HandleTypeDef * hspi, uint8_t * tx_buffer, uint8_t * rx_buffer, GPIO_TypeDef * cs_port,
uint16_t cs_pin)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "Spi");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "Spi");
initializationStatus_ = DRIVER_OK;
hspi_ = hspi;
txBuffer_ = tx_buffer;
Expand Down
6 changes: 5 additions & 1 deletion common/drivers/Status.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,16 @@
#ifndef STATUS_H_
#define STATUS_H_

#define STATUS_NAME_MAX_LEN 32
#define STATUS_LIST_MAX_LEN 16
#define STATUS_NAME_MAX_LEN 16

class Status
{
public:
Status() { initializationStatus_ = DRIVER_NOT_INITIALIZED;}
bool initGood(void) { return initializationStatus_ == DRIVER_OK; }
uint32_t status() { return initializationStatus_;}
char *name() { return name_;}

protected:
uint32_t initializationStatus_ = DRIVER_NOT_INITIALIZED;
Expand Down
2 changes: 1 addition & 1 deletion common/drivers/Telem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ uint32_t Telem::init(
//,void (*RxISR) (struct __UART_HandleTypeDef *huart)
)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "Telem");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "Telem");
initializationStatus_ = DRIVER_OK;
// Common initializations
sampleRateHz_ = sample_rate_hz;
Expand Down
2 changes: 0 additions & 2 deletions common/drivers/Telem.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ class Telem : public Status
*/

public:
Telem() { initializationStatus_ = DRIVER_NOT_INITIALIZED; }
bool initGood(void) { return initializationStatus_ == DRIVER_OK; }
uint32_t init(
// Driver initializers
uint16_t sample_rate_hz,
Expand Down
16 changes: 6 additions & 10 deletions common/drivers/Time64.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,10 @@
class Time64 : public Status
{
public:
Time64() { initializationStatus_ = DRIVER_NOT_INITIALIZED; }
bool initGood(void) { return initializationStatus_ == DRIVER_OK; }

uint32_t init(TIM_HandleTypeDef * htim_low, TIM_TypeDef * instance_low, TIM_HandleTypeDef * htim_high,
TIM_TypeDef * instance_high)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "Time64");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "Time64");
initializationStatus_ = DRIVER_OK;

htimLow_ = htim_low;
Expand All @@ -75,21 +72,21 @@ class Time64 : public Status
htimLow_->Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
if (HAL_TIM_Base_Init(htimLow_) != HAL_OK) {
initializationStatus_ |= DRIVER_HAL_ERROR;
return DRIVER_HAL_ERROR;
return initializationStatus_;
}

sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
if (HAL_TIM_ConfigClockSource(htimLow_, &sClockSourceConfig) != HAL_OK) {
initializationStatus_ |= DRIVER_HAL_ERROR;
return DRIVER_HAL_ERROR;
return initializationStatus_;
}
sMasterConfig.MasterOutputTrigger = TIM_TRGO_UPDATE;
if (htimLow_->Instance == TIM8) sMasterConfig.MasterOutputTrigger2 = TIM_TRGO2_RESET;

sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
if (HAL_TIMEx_MasterConfigSynchronization(htimLow_, &sMasterConfig) != HAL_OK) {
initializationStatus_ |= DRIVER_HAL_ERROR;
return DRIVER_HAL_ERROR;
return initializationStatus_;
}
}
// high timer (slave)
Expand All @@ -108,7 +105,7 @@ class Time64 : public Status
htimHigh_->Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
if (HAL_TIM_Base_Init(htimHigh_) != HAL_OK) {
initializationStatus_ |= DRIVER_HAL_ERROR;
return DRIVER_HAL_ERROR;
return initializationStatus_;
}

sSlaveConfig.SlaveMode = TIM_SLAVEMODE_EXTERNAL1;
Expand Down Expand Up @@ -140,7 +137,7 @@ class Time64 : public Status
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
if (HAL_TIMEx_MasterConfigSynchronization(htimHigh_, &sMasterConfig) != HAL_OK) {
initializationStatus_ |= DRIVER_HAL_ERROR;
return DRIVER_HAL_ERROR;
return initializationStatus_;
}
}

Expand Down Expand Up @@ -185,7 +182,6 @@ class Time64 : public Status
TIM_HandleTypeDef * htimLow_;
TIM_HandleTypeDef * htimHigh_;
uint32_t shift_;
uint32_t initializationStatus_ = DRIVER_NOT_INITIALIZED;
};

#endif /* TIME64_H_ */
2 changes: 1 addition & 1 deletion common/drivers/Ubx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ uint32_t Ubx::init(
UART_HandleTypeDef * huart, USART_TypeDef * huart_instance, DMA_HandleTypeDef * hdma_uart_rx, uint32_t baud,
UbxProtocol ubx_protocol)
{
snprintf(name_, STATUS_NAME_MAX_LEN, "-%s", "Ubx");
snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "Ubx");
initializationStatus_ = DRIVER_OK;
sampleRateHz_ = sample_rate_hz;
drdyPort_ = drdy_port;
Expand Down
Loading

0 comments on commit 31032f2

Please sign in to comment.