Compare commits
7 Commits
2422ef0043
...
7844c8bdce
Author | SHA1 | Date | |
---|---|---|---|
7844c8bdce | |||
4b467f6701 | |||
9370ddbadd | |||
ac75969758 | |||
c74299dc0d | |||
8d41a30bff | |||
8b5bbd3e9a |
@ -36,7 +36,7 @@
|
|||||||
</tool>
|
</tool>
|
||||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.1285639549" name="MCU/MPU GCC Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler">
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.1285639549" name="MCU/MPU GCC Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler">
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.75005491" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.value.g3" valueType="enumerated"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.75005491" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.value.g3" valueType="enumerated"/>
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.1711938240" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level" useByScannerDiscovery="false"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.1711938240" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.value.o0" valueType="enumerated"/>
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.1662015804" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.1662015804" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||||
<listOptionValue builtIn="false" value="DEBUG"/>
|
<listOptionValue builtIn="false" value="DEBUG"/>
|
||||||
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
|
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
|
||||||
|
@ -32,6 +32,8 @@ void EEPROM_24AA02E48_run_test(void)
|
|||||||
display_write_data_seq("/5 ");
|
display_write_data_seq("/5 ");
|
||||||
|
|
||||||
switch (op_result) {
|
switch (op_result) {
|
||||||
|
case HAL_OK:
|
||||||
|
break;
|
||||||
case HAL_ERROR:
|
case HAL_ERROR:
|
||||||
display_write_data_seq("ERROR");
|
display_write_data_seq("ERROR");
|
||||||
break;
|
break;
|
||||||
@ -64,6 +66,8 @@ void EEPROM_24AA02E48_run_test(void)
|
|||||||
display_write_data_seq("/5 ");
|
display_write_data_seq("/5 ");
|
||||||
|
|
||||||
switch (op_result) {
|
switch (op_result) {
|
||||||
|
case HAL_OK:
|
||||||
|
break;
|
||||||
case HAL_ERROR:
|
case HAL_ERROR:
|
||||||
display_write_data_seq("ERROR");
|
display_write_data_seq("ERROR");
|
||||||
break;
|
break;
|
||||||
@ -89,10 +93,10 @@ void EEPROM_24AA02E48_run_test(void)
|
|||||||
display_write_data_byte('0' + err_count / 10 % 10);
|
display_write_data_byte('0' + err_count / 10 % 10);
|
||||||
display_write_data_byte('0' + err_count % 10);
|
display_write_data_byte('0' + err_count % 10);
|
||||||
display_write_data_seq("E ");
|
display_write_data_seq("E ");
|
||||||
display_write_data_seq(data_buffer);
|
display_write_data_seq((char *) data_buffer);
|
||||||
} else {
|
} else {
|
||||||
DISPLAY_SET_CURSOR(1, 1);
|
DISPLAY_SET_CURSOR(1, 1);
|
||||||
display_write_data_seq("OK ");
|
display_write_data_seq("OK ");
|
||||||
display_write_data_seq(data_buffer);
|
display_write_data_seq((char *) data_buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,8 @@ void CS43L22_run_test(void)
|
|||||||
display_write_data_seq("/5 ");
|
display_write_data_seq("/5 ");
|
||||||
|
|
||||||
switch (op_result) {
|
switch (op_result) {
|
||||||
|
case HAL_OK:
|
||||||
|
break;
|
||||||
case HAL_ERROR:
|
case HAL_ERROR:
|
||||||
display_write_data_seq("ERROR");
|
display_write_data_seq("ERROR");
|
||||||
break;
|
break;
|
||||||
|
@ -15,6 +15,7 @@ static void wait(uint32_t wait_us)
|
|||||||
|
|
||||||
static size_t dht11_measure_high_duration(void)
|
static size_t dht11_measure_high_duration(void)
|
||||||
{
|
{
|
||||||
|
SKIP_LOW;
|
||||||
uint32_t start_time = TIM2->CNT;
|
uint32_t start_time = TIM2->CNT;
|
||||||
SKIP_HIGH;
|
SKIP_HIGH;
|
||||||
uint32_t end_time = TIM2->CNT;
|
uint32_t end_time = TIM2->CNT;
|
||||||
@ -28,7 +29,7 @@ static size_t dht11_read_value(struct DHT11_Data *data)
|
|||||||
// treat data as a normal array to simplify read loop
|
// treat data as a normal array to simplify read loop
|
||||||
uint8_t *buffer = (uint8_t *) data;
|
uint8_t *buffer = (uint8_t *) data;
|
||||||
|
|
||||||
register uint8_t read_register = 0;
|
register uint32_t read_register = 0;
|
||||||
|
|
||||||
TIM2->CNT = 0;
|
TIM2->CNT = 0;
|
||||||
HAL_TIM_Base_Start(&htim2);
|
HAL_TIM_Base_Start(&htim2);
|
||||||
@ -44,11 +45,11 @@ static size_t dht11_read_value(struct DHT11_Data *data)
|
|||||||
|
|
||||||
GPIOD->MODER &= 0xFF3FFFFF; // switch GPIOD 11 to input mode
|
GPIOD->MODER &= 0xFF3FFFFF; // switch GPIOD 11 to input mode
|
||||||
|
|
||||||
// reading transmission from DHT11
|
// reading pull down from DHT11
|
||||||
SKIP_LOW;
|
SKIP_LOW;
|
||||||
|
|
||||||
// waiting for 50 ms max
|
// waiting for 500ms max
|
||||||
for (size_t i = TIM2->CNT + (50000 << 4); TIM2->CNT >= i; )
|
for (size_t i = TIM2->CNT + (500000 << 4); TIM2->CNT <= i; )
|
||||||
if (!(GPIOD->IDR & 0x0800))
|
if (!(GPIOD->IDR & 0x0800))
|
||||||
goto reading_data;
|
goto reading_data;
|
||||||
|
|
||||||
@ -60,11 +61,10 @@ reading_data:
|
|||||||
for (size_t i = 0; i < 5; i++) {
|
for (size_t i = 0; i < 5; i++) {
|
||||||
for (register size_t j = 0; j < 8; j++) {
|
for (register size_t j = 0; j < 8; j++) {
|
||||||
read_register <<= 1;
|
read_register <<= 1;
|
||||||
SKIP_LOW;
|
|
||||||
read_register |= dht11_measure_high_duration();
|
read_register |= dht11_measure_high_duration();
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer[i] = read_register;
|
buffer[i] = (uint8_t) read_register;
|
||||||
}
|
}
|
||||||
|
|
||||||
HAL_TIM_Base_Stop(&htim2);
|
HAL_TIM_Base_Stop(&htim2);
|
||||||
|
@ -43,6 +43,8 @@ static void print_error_message(HAL_StatusTypeDef result, size_t *err_count, siz
|
|||||||
display_write_data_seq("/5 ");
|
display_write_data_seq("/5 ");
|
||||||
|
|
||||||
switch (result) {
|
switch (result) {
|
||||||
|
case HAL_OK:
|
||||||
|
break;
|
||||||
case HAL_ERROR:
|
case HAL_ERROR:
|
||||||
display_write_data_seq("ERROR");
|
display_write_data_seq("ERROR");
|
||||||
break;
|
break;
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
|
|
||||||
#define FAILSAFE_PRE_OP for (size_t t = 0; t < 5; t++) {
|
#define FAILSAFE_PRE_OP for (size_t t = 0; t < 5; t++) {
|
||||||
#define FAILSAFE_POST_OP_ACCEL(prefix) if (op_result) print_error_accel(op_result, err_count, t, prefix); else break; }
|
#define FAILSAFE_POST_OP_ACCEL(prefix) if (op_result) print_error_accel(op_result, &err_count, t, prefix); else break; }
|
||||||
#define FAILSAFE_POST_OP_MAGNET(prefix) if (op_result) print_error_magnet(op_result, err_count, t, prefix); else break; }
|
#define FAILSAFE_POST_OP_MAGNET(prefix) if (op_result) print_error_magnet(op_result, &err_count, t, prefix); else break; }
|
||||||
|
|
||||||
extern I2C_HandleTypeDef hi2c1;
|
extern I2C_HandleTypeDef hi2c1;
|
||||||
|
|
||||||
@ -20,6 +20,8 @@ static void print_error_message(HAL_StatusTypeDef result, size_t *err_count, siz
|
|||||||
display_write_data_seq("/5 ");
|
display_write_data_seq("/5 ");
|
||||||
|
|
||||||
switch (result) {
|
switch (result) {
|
||||||
|
case HAL_OK:
|
||||||
|
break;
|
||||||
case HAL_ERROR:
|
case HAL_ERROR:
|
||||||
display_write_data_seq("ERROR");
|
display_write_data_seq("ERROR");
|
||||||
break;
|
break;
|
||||||
@ -110,12 +112,12 @@ void LSM9DS1_test_magnet(void)
|
|||||||
buffer[0] = 0x28;
|
buffer[0] = 0x28;
|
||||||
FAILSAFE_PRE_OP;
|
FAILSAFE_PRE_OP;
|
||||||
op_result = HAL_I2C_Master_Transmit(&hi2c1, 0x3C, buffer, 1, 1000);
|
op_result = HAL_I2C_Master_Transmit(&hi2c1, 0x3C, buffer, 1, 1000);
|
||||||
FAILSAFE_POST_OP_ACCEL("A");
|
FAILSAFE_POST_OP_MAGNET("A");
|
||||||
|
|
||||||
// read from registers sequentially
|
// read from registers sequentially
|
||||||
FAILSAFE_PRE_OP;
|
FAILSAFE_PRE_OP;
|
||||||
op_result = HAL_I2C_Master_Receive(&hi2c1, 0x3D, buffer, 6, 1000);
|
op_result = HAL_I2C_Master_Receive(&hi2c1, 0x3D, buffer, 6, 1000);
|
||||||
FAILSAFE_POST_OP_ACCEL("R");
|
FAILSAFE_POST_OP_MAGNET("R");
|
||||||
|
|
||||||
if (!err_count) {
|
if (!err_count) {
|
||||||
DISPLAY_SET_CURSOR(1, 1);
|
DISPLAY_SET_CURSOR(1, 1);
|
||||||
|
@ -40,6 +40,8 @@ void PCA9685_run_test(void)
|
|||||||
display_write_data_seq("/5 ");
|
display_write_data_seq("/5 ");
|
||||||
|
|
||||||
switch (op_result) {
|
switch (op_result) {
|
||||||
|
case HAL_OK:
|
||||||
|
break;
|
||||||
case HAL_ERROR:
|
case HAL_ERROR:
|
||||||
display_write_data_seq("ERROR");
|
display_write_data_seq("ERROR");
|
||||||
break;
|
break;
|
||||||
|
@ -112,7 +112,7 @@ int delay_between_runs[] = {
|
|||||||
-1
|
-1
|
||||||
};
|
};
|
||||||
|
|
||||||
size_t current_executor_id = 0;
|
size_t current_executor_id = 11;
|
||||||
|
|
||||||
size_t buttons_interrupt_enabled;
|
size_t buttons_interrupt_enabled;
|
||||||
|
|
||||||
@ -641,10 +641,17 @@ static void MX_GPIO_Init(void)
|
|||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||||
|
|
||||||
/*Configure GPIO pins : PD11 PD12 PD13 PD14
|
/*Configure GPIO pin : PD11 */
|
||||||
PD15 PD4 PD7 */
|
GPIO_InitStruct.Pin = GPIO_PIN_11;
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
|GPIO_PIN_15|GPIO_PIN_4|GPIO_PIN_7;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/*Configure GPIO pins : PD12 PD13 PD14 PD15
|
||||||
|
PD4 PD7 */
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15
|
||||||
|
|GPIO_PIN_4|GPIO_PIN_7;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
@ -121,6 +121,8 @@ PC8.Locked=true
|
|||||||
PC8.Signal=GPIO_Input
|
PC8.Signal=GPIO_Input
|
||||||
PC9.Locked=true
|
PC9.Locked=true
|
||||||
PC9.Signal=GPIO_Input
|
PC9.Signal=GPIO_Input
|
||||||
|
PD11.GPIOParameters=GPIO_Speed
|
||||||
|
PD11.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
|
||||||
PD11.Locked=true
|
PD11.Locked=true
|
||||||
PD11.Signal=GPIO_Output
|
PD11.Signal=GPIO_Output
|
||||||
PD12.Locked=true
|
PD12.Locked=true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user