Add shared PySetTerminal with asynchronous cancellable macros
This commit is contained in:
@@ -379,3 +379,9 @@ int pcan_abi_gui_parser_stats(const void *parser_storage, uint32_t *frames,
|
||||
if (stray_bytes != NULL) *stray_bytes = parser->stats.stray_bytes;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pcan_abi_tms2812_bus_step(int write, unsigned step, unsigned tetrad, unsigned reg,
|
||||
uint16_t data, uint32_t *address, uint16_t *value, uint8_t *command)
|
||||
{
|
||||
return tms2812_bus_step(write, step, tetrad, reg, data, address, value, command);
|
||||
}
|
||||
|
||||
@@ -137,3 +137,16 @@ int tms2812_decode_upload_response(
|
||||
memcpy(output, &data[2], byte_count);
|
||||
return TMS2812_OK;
|
||||
}
|
||||
|
||||
int tms2812_bus_step(int write, unsigned step, unsigned tetrad, unsigned reg,
|
||||
uint16_t data, uint32_t *address, uint16_t *value, uint8_t *command)
|
||||
{
|
||||
if (!address || !value || !command) return TMS2812_ERROR_ARGUMENT;
|
||||
if ((write != 0 && write != 1) || step > 1U || tetrad > 14U || reg > 15U)
|
||||
return TMS2812_ERROR_RANGE;
|
||||
*command = (!write && step == 1U) ? TMS2812_CMD_PEEK : TMS2812_CMD_POKE;
|
||||
*address = write ? (step == 0U ? 0x200AU : 0x200BU) : (step == 0U ? 0x200BU : 0x200FU);
|
||||
*value = write && step == 0U ? data : (!write && step == 1U ? 0U :
|
||||
(uint16_t)((write ? 0x8000U : 0U) | (tetrad << 4) | reg));
|
||||
return TMS2812_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user