fix multithread logic in template app, update gpio HAL (#250)
* fix multithread logic * more buffer for dallas id string * update apps to use new logic * delay_us small speedup * add consant qualifier to gpio records and some core api * fix some apps to use simpler method of getting gpio record * fix ibutton app, stupid stack problem
This commit is contained in:
@@ -9,7 +9,7 @@ bool gpio_api_init(void) {
|
||||
}
|
||||
|
||||
// init GPIO
|
||||
void gpio_init(GpioPin* gpio, GpioMode mode) {
|
||||
void gpio_init(const GpioPin* gpio, const GpioMode mode) {
|
||||
if(osMutexAcquire(gpioInitMutex, osWaitForever) == osOK) {
|
||||
hal_gpio_init(gpio, mode, GpioPullNo, GpioSpeedLow);
|
||||
osMutexRelease(gpioInitMutex);
|
||||
@@ -17,13 +17,17 @@ void gpio_init(GpioPin* gpio, GpioMode mode) {
|
||||
}
|
||||
|
||||
// init GPIO, extended version
|
||||
void gpio_init_ex(GpioPin* gpio, GpioMode mode, GpioPull pull, GpioSpeed speed) {
|
||||
void gpio_init_ex(
|
||||
const GpioPin* gpio,
|
||||
const GpioMode mode,
|
||||
const GpioPull pull,
|
||||
const GpioSpeed speed) {
|
||||
hal_gpio_init(gpio, mode, pull, speed);
|
||||
}
|
||||
|
||||
// put GPIO to Z-state
|
||||
void gpio_disable(GpioDisableRecord* gpio_record) {
|
||||
GpioPin* gpio_pin = acquire_mutex(gpio_record->gpio_mutex, 0);
|
||||
const GpioPin* gpio_pin = acquire_mutex(gpio_record->gpio_mutex, 0);
|
||||
if(gpio_pin == NULL) {
|
||||
gpio_pin = gpio_record->gpio;
|
||||
}
|
||||
|
@@ -12,13 +12,17 @@ typedef struct {
|
||||
bool gpio_api_init();
|
||||
|
||||
// init GPIO
|
||||
void gpio_init(GpioPin* gpio, GpioMode mode);
|
||||
void gpio_init(const GpioPin* gpio, const GpioMode mode);
|
||||
|
||||
// init GPIO, extended version
|
||||
void gpio_init_ex(GpioPin* gpio, GpioMode mode, GpioPull pull, GpioSpeed speed);
|
||||
void gpio_init_ex(
|
||||
const GpioPin* gpio,
|
||||
const GpioMode mode,
|
||||
const GpioPull pull,
|
||||
const GpioSpeed speed);
|
||||
|
||||
// write value to GPIO, false = LOW, true = HIGH
|
||||
static inline void gpio_write(GpioPin* gpio, bool state) {
|
||||
static inline void gpio_write(const GpioPin* gpio, const bool state) {
|
||||
hal_gpio_write(gpio, state);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user