]> git.gag.com Git - fw/altos/commitdiff
altos: Add ao_radio_post (power-on self-test) for cc1200
authorKeith Packard <keithp@keithp.com>
Thu, 23 Jan 2025 17:21:26 +0000 (09:21 -0800)
committerKeith Packard <keithp@keithp.com>
Tue, 28 Jan 2025 18:23:35 +0000 (10:23 -0800)
This function checks to make sure the radio chip is present on the SPI
bus.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/drivers/ao_cc1200.c
src/kernel/ao.h

index ed1d298e1b4a8c100950da114c7ab45ed8abbce0..b3a1e57551556054a5f9a6cd31a98f6ab36c0484 100644 (file)
@@ -1456,6 +1456,22 @@ static const struct ao_cmds ao_radio_cmds[] = {
        { 0, NULL }
 };
 
+/* Make sure the radio is alive */
+bool
+ao_radio_post(void)
+{
+       uint8_t partnum;
+
+       partnum = ao_radio_reg_read(CC1200_PARTNUMBER);
+       switch (partnum) {
+       case CC1200_PARTNUMBER_CC1200:
+       case CC1200_PARTNUMBER_CC1201:
+               return true;
+       default:
+               return false;
+       }
+}
+
 void
 ao_radio_init(void)
 {
index 0437cb07f3eb9929b680e4b4640b445d68414bbb..1cfe29e9f55652c2b448cde57858cc3317f3957b 100644 (file)
@@ -667,6 +667,9 @@ ao_radio_test_on(void);
 void
 ao_radio_test_off(void);
 
+bool
+ao_radio_post(void);
+
 void
 ao_radio_init(void);