mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-02 05:36:31 +00:00
efuse: Add new esp_efuse_write_field_bit() convenience function
This commit is contained in:
committed by
Angus Gratton
parent
9b822a3d2e
commit
1dd5a4dba4
@@ -267,6 +267,27 @@ TEST_CASE("efuse test write_field_cnt", "[efuse]")
|
||||
test_write_cnt();
|
||||
}
|
||||
|
||||
TEST_CASE("efuse test write_field_bit", "[efuse]")
|
||||
{
|
||||
esp_efuse_utility_erase_virt_blocks();
|
||||
esp_efuse_utility_debug_dump_blocks();
|
||||
|
||||
uint8_t test_bit;
|
||||
TEST_ESP_OK(esp_efuse_read_field_blob(ESP_EFUSE_TEST5_LEN_1, &test_bit, 1));
|
||||
TEST_ASSERT_EQUAL_HEX8(0, test_bit);
|
||||
|
||||
TEST_ESP_OK(esp_efuse_write_field_bit(ESP_EFUSE_TEST5_LEN_1));
|
||||
TEST_ESP_OK(esp_efuse_read_field_blob(ESP_EFUSE_TEST5_LEN_1, &test_bit, 1));
|
||||
TEST_ASSERT_EQUAL_HEX8(1, test_bit);
|
||||
|
||||
// Can write the bit again and it's a no-op
|
||||
TEST_ESP_OK(esp_efuse_write_field_bit(ESP_EFUSE_TEST5_LEN_1));
|
||||
TEST_ESP_OK(esp_efuse_read_field_blob(ESP_EFUSE_TEST5_LEN_1, &test_bit, 1));
|
||||
TEST_ASSERT_EQUAL_HEX8(1, test_bit);
|
||||
|
||||
esp_efuse_utility_debug_dump_blocks();
|
||||
}
|
||||
|
||||
void cut_tail_arr(uint8_t *arr, int num_used_bits, size_t count_bits)
|
||||
{
|
||||
if ((num_used_bits + count_bits) % 8) {
|
||||
|
||||
Reference in New Issue
Block a user