friday code dump

This commit is contained in:
2024-05-17 20:12:40 +02:00
parent f05f1fd3b8
commit a3e7c2c266
8 changed files with 76 additions and 66 deletions

View File

@ -267,7 +267,21 @@ uint8 writeCMD(uint16 command, uint8* args, uint8 arglen) {
return ret;
}
#define ITER_COUNT 50
static uint8_t count = 0;
static bool isOn = false;
uint8 readCMD(uint16 command, uint8* buffer, uint8 buflen) {
if (count == ITER_COUNT) {
HAL_GPIO_WritePin(STATUS_LED_B_GPIO_Port, STATUS_LED_B_Pin, isOn ? GPIO_PIN_SET : GPIO_PIN_RESET);
count = 0;
isOn = !isOn;
} else {
count++;
}
uint8 txbuffer[6 + buflen] = {};
uint8 rxbuffer[6 + buflen] = {};
@ -314,11 +328,11 @@ uint8 pollCMD(uint16 command) {
}
void mcuAdbmsCSLow() {
//HAL_GPIO_WritePin(CSB_GPIO_Port, CSB_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(CSB_GPIO_Port, CSB_Pin, GPIO_PIN_RESET);
}
void mcuAdbmsCSHigh() {
//HAL_GPIO_WritePin(CSB_GPIO_Port, CSB_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(CSB_GPIO_Port, CSB_Pin, GPIO_PIN_SET);
}
uint8 mcuSPITransmit(uint8* buffer, uint8 buffersize) {