Fix some HAL_STM32F1 type declarations

This commit is contained in:
Scott Lahteine 2019-01-12 15:10:21 -06:00
parent eb78aed863
commit 3e867008f0
5 changed files with 14 additions and 14 deletions

View file

@ -100,7 +100,7 @@ uint16_t HAL_adc_result;
// --------------------------------------------------------------------------
STM32ADC adc(ADC1);
uint8 adc_pins[] = {
uint8_t adc_pins[] = {
#if HAS_TEMP_ADC_0
TEMP_0_PIN,
#endif

View file

@ -52,14 +52,14 @@ uint8_t ServoCount; //=0
#define TAU_USEC (TAU_MSEC * 1000)
#define TAU_CYC (TAU_MSEC * CYC_MSEC)
#define SERVO_PRESCALER (TAU_CYC / MAX_OVERFLOW + 1)
#define SERVO_OVERFLOW ((uint16)round((double)TAU_CYC / SERVO_PRESCALER))
#define SERVO_OVERFLOW ((uint16_t)round((double)TAU_CYC / SERVO_PRESCALER))
// Unit conversions
#define US_TO_COMPARE(us) ((uint16)map((us), 0, TAU_USEC, 0, SERVO_OVERFLOW))
#define COMPARE_TO_US(c) ((uint32)map((c), 0, SERVO_OVERFLOW, 0, TAU_USEC))
#define ANGLE_TO_US(a) ((uint16)(map((a), this->minAngle, this->maxAngle, \
#define US_TO_COMPARE(us) ((uint16_t)map((us), 0, TAU_USEC, 0, SERVO_OVERFLOW))
#define COMPARE_TO_US(c) ((uint32_t)map((c), 0, SERVO_OVERFLOW, 0, TAU_USEC))
#define ANGLE_TO_US(a) ((uint16_t)(map((a), this->minAngle, this->maxAngle, \
SERVO_DEFAULT_MIN_PW, SERVO_DEFAULT_MAX_PW)))
#define US_TO_ANGLE(us) ((int16)(map((us), SERVO_DEFAULT_MIN_PW, SERVO_DEFAULT_MAX_PW, \
#define US_TO_ANGLE(us) ((int16_t)(map((us), SERVO_DEFAULT_MIN_PW, SERVO_DEFAULT_MAX_PW, \
this->minAngle, this->maxAngle)))
libServo::libServo() {
@ -74,7 +74,7 @@ bool libServo::attach(const int32_t pin, const int32_t minAngle, const int32_t m
this->maxAngle = maxAngle;
timer_dev *tdev = PIN_MAP[this->pin].timer_device;
uint8 tchan = PIN_MAP[this->pin].timer_channel;
uint8_t tchan = PIN_MAP[this->pin].timer_channel;
pinMode(this->pin, PWM);
pwmWrite(this->pin, 0);
@ -97,7 +97,7 @@ bool libServo::detach() {
int32_t libServo::read() const {
if (this->attached()) {
timer_dev *tdev = PIN_MAP[this->pin].timer_device;
uint8 tchan = PIN_MAP[this->pin].timer_channel;
uint8_t tchan = PIN_MAP[this->pin].timer_channel;
return US_TO_ANGLE(COMPARE_TO_US(timer_get_compare(tdev, tchan)));
}
return 0;

View file

@ -138,7 +138,7 @@ bool SDIO_WriteBlock(uint32_t blockAddress, const uint8_t *data) {
SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
uint32 timeout = millis() + SDIO_WRITE_TIMEOUT;
uint32_t timeout = millis() + SDIO_WRITE_TIMEOUT;
while (timeout > millis()) {
if (SDIO_GetCardState() == SDIO_CARD_TRANSFER) {
return true;

View file

@ -133,7 +133,7 @@ uint8_t spiRec(void) {
*/
void spiRead(uint8_t* buf, uint16_t nbyte) {
SPI.beginTransaction(spiConfig);
SPI.dmaTransfer(0, const_cast<uint8*>(buf), nbyte);
SPI.dmaTransfer(0, const_cast<uint8_t*>(buf), nbyte);
SPI.endTransaction();
}
@ -161,7 +161,7 @@ void spiSend(uint8_t b) {
void spiSendBlock(uint8_t token, const uint8_t* buf) {
SPI.beginTransaction(spiConfig);
SPI.send(token);
SPI.dmaSend(const_cast<uint8*>(buf), 512);
SPI.dmaSend(const_cast<uint8_t*>(buf), 512);
SPI.endTransaction();
}

View file

@ -119,7 +119,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
case STEP_TIMER_NUM:
timer_pause(STEP_TIMER_DEV);
timer_set_count(STEP_TIMER_DEV, 0);
timer_set_prescaler(STEP_TIMER_DEV, (uint16)(STEPPER_TIMER_PRESCALE - 1));
timer_set_prescaler(STEP_TIMER_DEV, (uint16_t)(STEPPER_TIMER_PRESCALE - 1));
timer_set_reload(STEP_TIMER_DEV, 0xFFFF);
timer_set_compare(STEP_TIMER_DEV, STEP_TIMER_CHAN, MIN(HAL_TIMER_TYPE_MAX, (STEPPER_TIMER_RATE / frequency)));
timer_attach_interrupt(STEP_TIMER_DEV, STEP_TIMER_CHAN, stepTC_Handler);
@ -130,7 +130,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
case TEMP_TIMER_NUM:
timer_pause(TEMP_TIMER_DEV);
timer_set_count(TEMP_TIMER_DEV, 0);
timer_set_prescaler(TEMP_TIMER_DEV, (uint16)(TEMP_TIMER_PRESCALE - 1));
timer_set_prescaler(TEMP_TIMER_DEV, (uint16_t)(TEMP_TIMER_PRESCALE - 1));
timer_set_reload(TEMP_TIMER_DEV, 0xFFFF);
timer_set_compare(TEMP_TIMER_DEV, TEMP_TIMER_CHAN, MIN(HAL_TIMER_TYPE_MAX, ((F_CPU / TEMP_TIMER_PRESCALE) / frequency)));
timer_attach_interrupt(TEMP_TIMER_DEV, TEMP_TIMER_CHAN, tempTC_Handler);
@ -157,7 +157,7 @@ void HAL_timer_disable_interrupt(const uint8_t timer_num) {
}
}
static inline bool timer_irq_enabled(const timer_dev * const dev, const uint8 interrupt) {
static inline bool timer_irq_enabled(const timer_dev * const dev, const uint8_t interrupt) {
return bool(*bb_perip(&(dev->regs).adv->DIER, interrupt));
}